I'm trying to run a method on the GUI thread using QMetaObject::invokeMethod, which returns true. But, if I use Qt::QueuedConnection my method never gets called (even if invokeMethod returns true).
This is what I'm using:
QMetaObject::invokeMethod(this, "draw_widgets", Qt::QueuedConnection)
I don't get any error messages or anything... If I use Qt::AutoConnection or Qt::DirectConnection the method does get called, but from the same thread of course. Not from the GUI thread, which is what I need.
draw_widgets is a public slot of type void draw_widgets() and my class inherits QObject and uses the Q_OBJECT macro as well.
I would appreciate any help on this, or on how to check why the method is not being called.
Thanks.
Q_OBJECT
. The instance of this class is created in the main loop. Then, while executing a method of the same class in the main loop, I callQMetaObject::invokeMethod(this, "hideListsSlot", Qt::QueuedConnection);
, wherevoid hideListsSlot()
is a public slot of the class. The slot is never invoked. – Giorgio