QTimer can only be used with threads started with QThread

前端 未结 2 2024
情深已故
情深已故 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:08

    This may be related to creating the QNetworkAccessManager inside the Send method - try instead using RAII.

    Define the QNetworkAccessManager in the header for Transmissions as a class variable, and create a class instance it in the ctor, then you will be able to post to it from the Send thread.

    Otherwise I think it goes out of scope.

提交回复
热议问题