Hi,
I am facing problem with QBasicTimer, here i am posting my demo code which will reproduce and explain my problem.
#include <QCoreApplication>
#include <QBasicTimer>
#include <iostream>
using namespace std;
{
public:
MyClass(){};
};
int main( int argc, char *argv[] )
{
MyClass *mc = new MyClass();
bt.start( 120 * 1000, mc );
while( bt.isActive() == true ) //It should get timeout after 2 minute, but here its not the case.
{
cout << "Basic Timer is Running : " << bt.timerId() << " ..!!!!!" << endl;
}
return app.exec();
}
#include <QCoreApplication>
#include <QBasicTimer>
#include <iostream>
using namespace std;
class MyClass:public QObject
{
public:
MyClass(){};
};
int main( int argc, char *argv[] )
{
QCoreApplication app( argc, argv );
MyClass *mc = new MyClass();
QBasicTimer bt;
bt.start( 120 * 1000, mc );
while( bt.isActive() == true ) //It should get timeout after 2 minute, but here its not the case.
{
cout << "Basic Timer is Running : " << bt.timerId() << " ..!!!!!" << endl;
}
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Output...
Basic Timer is Running : 1 ..!!!!
Basic Timer is Running : 1 ..!!!!
Basic Timer is Running : 1 ..!!!!
Basic Timer is Running : 1 ..!!!!
Basic Timer is Running : 1 ..!!!!
Basic Timer is Running : 1 ..!!!!
Basic Timer is Running : 1 ..!!!!
Basic Timer is Running : 1 ..!!!!
.
.
.
.
.
//infinite time !!
When the timer will get timeout ? or I have to stop it explicitly to get Timer state isActive() = false ???
Bookmarks