PDA

View Full Version : Signal/Slot Query



nleverin
2nd August 2007, 06:30
Hi,

I am trying to implement a signal slot connection as follows:
connect (Object1, signal1, Object2, slot1);

the class the connection is being generated is a sub class of a Qt designer ui file where Object1 was actually implemented in the .ui file.

Will the subclass successfully inherit this action?

Also Object2 is not in scope of the connection function and therefore to try to give it access to the object i have used a singleton pattern and tired to get access to the option as object 2 was instantiated within the singleton object, as shown below:

connect ( ui_DesignerAction, SIGNAL(activated), Singleton::Instance()->getObject2, SLOT(obj2slot()));

im assuming from my code not working that you cannot call functions from within the string?

does anyone have a better idea of how i can implement this?

marcel
2nd August 2007, 08:34
What action are you talking about?
You had a small mistake in there:


connect ( ui_DesignerAction, SIGNAL(activated()), Singleton::Instance()->getObject2(), SLOT(obj2slot()));


Singletons will work just fine and it is preferred in this cases. There is no problem( if you implemented it ok).



im assuming from my code not working that you cannot call functions from within the string?

No, it must be something else.
If after correcting the connect statement, if it still doesn't work, then post some code.

Regards