1

I'm trying to run a public slot in another thread using invokeMethod:

QMetaObject::invokeMethod(m_manager, "onEventRequest", Qt::QueuedConnection, Q_ARG(int, 0));

Now, invokeMethod returns true and no error message are reported, but the slot onEventRequest is never called. I added a breakpoint in onEventRequest which is never triggered.

m_manager is created in the main thread, this class inherits QObject and uses the Q_OBJECT macro invokeMethod is executed in another thread created by QThread::run().

I would appreciate any help on this, or on how to check why the method is not being called.

gengisdave
  • 1,969
  • 5
  • 21
  • 22
Zhao Leo
  • 101
  • 1
  • 3
  • 4
    Are you sure the target thread has an event loop running? Check `m_manager->thread()->isRunning()` – dtech Aug 18 '15 at 08:10
  • *another thread created by QThread::run()* - the [run](http://doc.qt.io/qt-5/qthread.html#run) function does not create a QThread. I suggest you provide more code, in the form of an [mcve](http://stackoverflow.com/help/mcve). As it stands, the question lacks detail required for others to help you and answers are only likely to be guesses as to what the problem is. – TheDarkKnight Aug 18 '15 at 08:17

0 Answers0