QTimer deads after laptop hibernation
-
Hello!
I use QTimer for polling SOAP server in my application like:
@pollTimer = new QTimer(this);
connect(pollTimer, SIGNAL(timeout()), this, SLOT(pollServer()));
pollTimer->start(pollTimeout);@After sometimes(1-2 days or laptop gibernation) timer stops working and client application is unable to poll server..
How to solve this problem?
-
Hi,
what means
bq. After sometimes(1-2 days or laptop gibernation) timer stops working
?
If you call QTimer::isActive(), what is the result?
if you call QTimer::remainingTime(), what is the result? -
Hi,
thank you for reply.
My problem is the following - the QTimer stops working after my laptop hasn't been used for a while. (Hibernation or sleep is generaly suspected)
Result of QTimer::isActive() - true.
I'll check the resut of QTimer::remainingTime() asap and come back with result. -
Hello!
resut of QTimer::remainingTime() is "0".
Problem was reproduced after application was running about 3 days.
-
Take a look at "this":http://qt-project.org/doc/qt-5.0/qtcore/qtimer.html#remainingTime-prop ,
Your timer must have went overdue while your computer was off or something. I suggest you should use a thread.
-
Or maybe "this":http://qt-project.org/doc/qt-5.0/qtcore/qtimer.html#singleShot-prop will help you without changing to threads.
-
Yes, but in not a single shot and timer slot should be called after each expiration.
If you sure in your doubt please propose a simple solution.
-
Oh, so you have set it to non-single-shot. I'm not sure if this will help you but you can try an activation signal received by your application, and connect it to an slot which checks your timer to see if it's overdue or not.
-
I try to write a simple application, and return with results.