can a slot be a global func?
General and Desktop
4
Posts
2
Posters
928
Views
2
Watching
-
Slot should be a method inside a class that is derived from QObject. It can be global, I think.
And with the new connection syntax in Qt 5, you can use any method (including a lambda function) as a slot: just pass the functor there.
-
Slot should be a method inside a class that is derived from QObject. It can be global, I think.
And with the new connection syntax in Qt 5, you can use any method (including a lambda function) as a slot: just pass the functor there.
-
Let's see if that works:
void myFunc() { qDebug() << "Aha!"; } int main () { MyClass a; QObject::connect(&a, &MyClass::someSignal, &myFunc); // or just myFunc // ... }