PDA

View Full Version : QThread::Sleep goes to not responding state



kiboi
2nd January 2013, 09:49
Hi guys,

I'm currently using QThread::Sleep yet i have observe the application went to "not responding" state during sleep.Is there a way to prevent this? Is there any option to set the application into halt for several seconds without experiencing not responding? I want that the UI wont be accessible during the specified time frame.

Thanks!

Santosh Reddy
2nd January 2013, 10:02
Where did you use QThread::Sleep in code?

One way to stop UI responding is don;t let the control go back to event loop. (Block/Loop/Sleep in a Slot, and signal the slot as required)

anda_skoa
2nd January 2013, 15:05
Where did you use QThread::Sleep in code?

Good question!



One way to stop UI responding is don;t let the control go back to event loop. (Block/Loop/Sleep in a Slot, and signal the slot as required)

True, but the problem is the UI not responding so another way to achieve an unresponsive UI is probably not that helpful :)

Everything that blocks the main thread will lead to an unresponsive UI. The good thing is that the main thread doesn't do anything if doesn't have to, so it will "sleep" by default.

Cheers,
_

Urthas
4th January 2013, 06:30
In lieu of sleeping or blocking per se, you might consider simply disabling your interface: highLevelWidget.setEnabled(false). When the "specified time frame" has elapsed, you then simply re-enable the interface using a signal-slot connection.

amleto
4th January 2013, 17:17
Hi guys,

I'm currently using QThread::Sleep yet i have observe the application went to "not responding" state during sleep.Is there a way to prevent this? Is there any option to set the application into halt for several seconds without experiencing not responding? I want that the UI wont be accessible during the specified time frame.

Thanks!

use a modal dialog.