QTimer can only be used with threads started with QThread

前端 未结 2 2025
情深已故
情深已故 2020-12-11 15:48

So I have an interesting problem....a program I am (trying) to write is crashing with this error:

QObject::startTimer: QTimer can only be used with threads s         


        
2条回答
  •  情深已故
    2020-12-11 16:13

    To use a QTimer you need to have an event loop. QNAM obviously uses a timer to periodically check for the network reply.

    You need to start the application event loop with QCoreApplication::exec() and then call QNAM methods like post after that.

    I think you can call post before exec but you may come across this bug.

    Also, note that up to Qt 4.7 QNAM did not use threading but with 4.8 this is changing.

提交回复
热议问题