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
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.
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.