Important: Please read the Qt Code of Conduct -

[SOLVED] What mistake am I making when passing the signals to the Main Window slot?

  • I have a class tCamera that is supposed to send signals to the Main Window. The qDebug statements show that the code is going where it is supposed to go, however, the application hangs, and I do not see the printer statements.

    NOTE: The mistake I was making was that I was giving control to another loop in a different source file, that never returned control to the main event loop. I fixed this by implementing threads (using QThread).

  • Moderators

    No time to check it thoroughly now, but just some quick thoughts that might suggest you the solution:

    signals and slots work in 2 modes: Qt::DirectConnection and Qt::QueuedConnection - you might need to check that.

    Signals and slots (queued) are handled by app's event loop. Your mutex locking might be getting in the way here.

    Instead (or in addition to) using the WaitCondition, you should consider using qApp->processEvents() in your loop. This method allows events to be handled while you wait in your loop.

  • I took out the wait condition and the same thing occurred: It hanged and didn't print of the emitted signals even though the qDebug statements went through.

Log in to reply