[SOLVED]QTimer locks my app
I have something like this:
QToolButton *bla = new QToolButton();
QPropertyAnimation *anim = new QPropertyAnimation(this, "geometry");
anim->setvalues(...) //bla bla not important
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 advance
Qt 4.8.4. MSVC2008 (Windows 7 x86)
Why are you introducing a busy waiting loop then?
Instead, just connect the timeout signal of the timer to the setEnabled slot of the buzzButton
I guess not timer locks your app
change code it like this:
[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.
In my opinion, busy looping in a GUI thread is (almost) never acceptable. I don't think promoting it is a good idea.
I am agree with you, but, what alternative can be used in function like this?:
@QString getRemoteId(QString login, QString pass);@
function should connect with server via tcp and return result to main programm.
You'd replace it by an asynchronous call. Especially since the above may fail in all kinds of ways. Look to [[doc:QNetworkAccessManager]] for one possible implementation, and to [[doc:QFuture]] for another one.
Thanks Andre :)
Thank you I solved using the timeout signal.