Qt GUI math application hangs out GUI while computing
I have a simple GUI for my application = I have to set some input
parameters for my math function, then click 'compute' button, and function
starts. Math function(s) are written in pure C so there are no objects,
just functions.
It looks like this:
#include "mymath.h"
class myMath : public QMainWindow
{
Q_OBJECT
// ...
void compute();
};
void myMath::compute()
{
//get parameters from gui
call_C_fun();
// save results to GUI
}
The main problem with this code is that when I click 'compute' (it does
sooo much computation, it takes up to 5 minutes or so) it hangs out my GUI
so I can't do anything else (I cant even see my gui, window is "frozen"
for the time that computation is running. After the function is finished,
it prints out results on QLabels, and GUI is once again "alive". How can I
solve this? I dont want my GUI to be "frozen" when computation takes time.
Any ideas? I thought about QThread - but Im kinda new in threads-thing, so
please, give simple-easy-to-understand answers for newbie :)
No comments:
Post a Comment