It doesn't have any chance to work then. If you want to use timers, you have to call QApplication::exec() before or right after Start() and do the rest as small steps triggered by another timer with timeout set to 0, more or less like so:
void MyClass::init1(){
//...
QTimer::singleShot(0,
this,
SLOT(init2
()));
}
void MyClass::init2(){
//...
QTimer::singleShot(0,
this,
SLOT(init3
()));
}
// ...
QTimer::singleShot(0,
&MyObjectOfMyClass,
SLOT(init1
()));
return app.exec();
void MyClass::init1(){
//...
QTimer::singleShot(0, this, SLOT(init2()));
}
void MyClass::init2(){
//...
QTimer::singleShot(0, this, SLOT(init3()));
}
// ...
QTimer::singleShot(0, &MyObjectOfMyClass, SLOT(init1()));
return app.exec();
To copy to clipboard, switch view to plain text mode
Timers can only timeout() when the control is in the event loop, so having a single long operation won't allow them to be triggered as well. You either have to use QApplication:
rocessEvents() or use 0-timeout timers like on the example above.
Bookmarks