
Originally Posted by
Kapil
In my application there are events which when activated take some 'n' time to get executed... Now this 'n' depends on the input data from the user.. If its small then 'n' would be small and vice versa...
So presumably you should be able to calculate (or at least estimate) the duration.
Now presently whats happening is that once the event is invoked, things just stop... it seems that the application has entered into a non-responding mode n the moment the event finishes, the control returns back to the user...
You will have to let the application to process it's events once in a while. Otherwise it won't respond to any user interaction.
#include <QApplication>
// a lengthy operation
for (int i = 0; i < MILLION; ++i)
{
QApplication::processEvents();
// let app process pending events // do something
}
#include <QApplication>
// a lengthy operation
for (int i = 0; i < MILLION; ++i)
{
QApplication::processEvents(); // let app process pending events
// do something
}
To copy to clipboard, switch view to plain text mode
Now i need to display something like a progress bar showing the precentage work finished or some interactive message or dialog which asks user to wait...
Did you notice QProgressDialog?
so how do i solve it in which i am unaware of the execution time of the event.. its just independent of the code and depends entirely on the input file..
This you will have to do by yourself..
Bookmarks