[SOLVED]QTimer locks my app
-
I have something like this:
@
QToolButton *bla = new QToolButton();
QPropertyAnimation *anim = new QPropertyAnimation(this, "geometry");
anim->setDuration(300);
anim->setvalues(...) //bla bla not important
anim->start();
QTimer timer;
timer.start(5000);
bla->setDisabled(true);
while(timer.isActive()) {}
buzzButton->setEnabled(true);
@this is a basic snippet from my actual code... But I am pretty sure that it is from the timer. Because if I don't add it it goes perfectly.
Thank you in advanceQt 4.8.4. MSVC2008 (Windows 7 x86)
-
[quote author="Andre" date="1359620982"]Instead, just connect the timeout signal of the timer to the setEnabled slot of the buzzButton[/quote]
It depends from goals. If b1gsnak3 need a function which should return some value after finishing his work then busy waiting loop is applicable, but for other ways ofcourse timeout timer is more prefered. -
[quote author="qxoz" date="1359621458"]If b1gsnak3 need a function which should return some value after finishing his work then busy waiting loop is applicable, but for other ways ofcourse timeout timer is more prefered.
[/quote]In my opinion, busy looping in a GUI thread is (almost) never acceptable. I don't think promoting it is a good idea.