View Full Version : Want to refresh window without processEvents()
jnk5y
30th March 2006, 05:04
Whenever I use QApplication::processEvents() it allows the user to still do things in my application that I would rather them wait for the process to finish.
Is there a way to refresh the window so it doesn't look like it's frozen without having to call QApplication::processEvents() ?
If I have to use QApplication::processEvents() how can I deactivate everything until the process is done?
jpn
30th March 2006, 08:51
Maybe you could show a modal progress dialog during the process?
A modal dialog would block the user in a sophisticated way from clicking elsewhere in the application.
Sounds a bit harsh, but another option could be to disable the whole window during the process..
Kapil
30th March 2006, 08:59
Hi jpn..
Refreshing of a window or a page or else is a very fast executing operation...
Modal Dialogs are used when the process takes some time and the progress of the operation is shown...
Can this be a sol??? - > Capturing the snapshot of the entire window and then repainting the contents...
This is just a suggestion.. It can be a wrong idea also...
Kapil
jpn
30th March 2006, 09:56
Refreshing of a window or a page or else is a very fast executing operation...
Refreshing of a window is not the lengthy process we are talking here.. :)
jnk5y: if you want your application to be responsive, you will have to let it to process it's events once in a while.
So don't prevent your application from receiving it's events, rather block the user interaction somehow (modality, disabling..).
Kapil
30th March 2006, 10:15
Refreshing of a window is not the lengthy process we are talking here.. :)
Did i get the question wrong??? :confused:
Aahhh... what exactly it is??? Can u plz tel me...
Kapil
wysota
30th March 2006, 10:21
QApplication::processEvents() taken an argument which can tell it not to process user input.
If you want to refresh a window without refering to the event queue, call repaint().
But you should really use a modal dialog here instead of doing any hacks. It can be as simple as:
QDialog dlg(this);
QLabel *l = new QLabel("Please wait", &dlg);
dlg.exec();
jnk5y
31st March 2006, 01:32
I didn't realize that processEvents() took arguments.
QEventLoop::AllEvents - is the default
QEventLoop::ExcludeUserInputEvents - will allow the user to move the window and redraw it but will not let them press any buttons. I think this is what I will probably use unless there is a reason not to.
Thanks for your help.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.