Skip to content
  • QTimer does not fire slot

    Unsolved General and Desktop
    6
    0 Votes
    6 Posts
    811 Views
    JonBJ

    @ulix
    You have a QTimer in a thread which does not run the Qt event loop, does it? So no signals will be delivered. Hence your finding:

    The timer expires but the slot never gets called, by the way if a I call QCoreApplication::processEvents(); after the sleep time the slot gets called.

    That processEvents() is the first time the evet loop is invoked. Your thread needs to be running the event loop all the time if that's where the timer is ticking (unless you move the timer to the main UI thread). See QThread::run() & QThread::exec().

  • 0 Votes
    2 Posts
    3k Views
    K

    OK, it was a bit premature to ask immediately.

    I found this post https://forum.qt.io/topic/54438/solved-qt-5-4-1-qtimer-using-up-all-handles-for-window-manager-objects

    Actually with QNetworkAccessManager I was a bit sloppy. Need to check if it helps already.

    Edit[koahnig]: It helped. Therefore, pay attention when generating new QNetworkAccessManger objects.