Some features:
1) Use another slot for things to do after sleep:
QTimer::singleShot(3000, this, SLOT(anotherSlot()); ... void MyClass::anotherSlot() { system(...); }
2) Without another slot, using a local event loop:
//write file QEventLoop loop; QTimer::singleShot(3000, &loop, SLOT(quit()) ); loop.exec(); //do more stuff
I would avoid the local event loop and prefer 1), although local event loops can cause a lot of subtle errors (anything can happen during the .exec () loop).
Frank Osterfeld Jun 30 '10 at 13:45 2010-06-30 13:45
source share