Connecting signal to an arbitrary function in Qt
-
hi,
am i able to connect a signal to a function which is in some other namespace and also not inside a particular class. -
Hi and welcome to devnet,
With Qt 4: no
With Qt 5: it depends, take a look at "this":http://qt-project.org/wiki/New_Signal_Slot_SyntaxHope it helps
-
thank u for the reply.i have 1 more doubt can i simply call a function in some other namespace in qt 4.8 , when i tried i got errors with the emit function in a header file??
-
Signals and slots must be members of a QObject
-
I am not trying to connect function to a slot.I am just trying to call a function in Qt4.8 which in some other namespace. Do i need to mention something in .pro file for that ?
-
Can you show your code ? And the error you are getting ? It will be easier to help you then.
-
Have a look at "this":http://qt-project.org/doc/qt-4.8/signalsandslots.html#using-qt-with-3rd-party-signals-and-slots .
The library uses at least one same keyword as Qt, so this is how to make them play together
-
Thank u for the answer.
-
You're welcome !
If this solves your problem don't forget to update the thread's title prepending [solved] to it :)