PDA

View Full Version : retrieving signal name in a slot



Baschterl
10th November 2008, 09:36
Hi guys,

I'm connecting different signals of different objects to one slot.
By invocation of this slot I want to retrieve the object name, the
class name and the signal name of the "invoking" object.

The object name is simply retrievable by QObject::sender()->objectName()
The class name is also simple: QObject::sender()->metaObject()->className().

But I don't know how to get the signal name.

This signal name is very important, because I'm programming a
GUI element (QDesigner plugin) to which the signals of other GUI elements
(like QPushButton.clicked(), ...) are connected. If one clicks for example
on the QPushButton B1 then my plugin forwards the Information
"B1 of type QPushButton has been clicked" via TCP to another application.
So it's important to habe the object name, the class name and the signal name.

Had someone just a similar problem and knows the solution?

Thanks a lot,
Sebastian

Sheng
10th November 2008, 13:58
How about use a global string to store the most recent signal name?
Before sending out signal, changed the string name; then in slot function, you can display the string.



Hi guys,

I'm connecting different signals of different objects to one slot.
By invocation of this slot I want to retrieve the object name, the
class name and the signal name of the "invoking" object.

The object name is simply retrievable by QObject::sender()->objectName()
The class name is also simple: QObject::sender()->metaObject()->className().

But I don't know how to get the signal name.

This signal name is very important, because I'm programming a
GUI element (QDesigner plugin) to which the signals of other GUI elements
(like QPushButton.clicked(), ...) are connected. If one clicks for example
on the QPushButton B1 then my plugin forwards the Information
"B1 of type QPushButton has been clicked" via TCP to another application.
So it's important to habe the object name, the class name and the signal name.

Had someone just a similar problem and knows the solution?

Thanks a lot,
Sebastian

jacek
10th November 2008, 20:44
You can't access signal name trough Qt --- it doesn't store it anywhere. You might look up the stack trace and use debugging information to obtain that name.