This concerns C++ (MinGW), Qt, Windows Vista:
all this while i's developing non-GUI applications in C++. Recently i decided to try a GUI one in Qt and am having some design issues.
Here's the problem:
- step 1: Load and display a background gif Animation using QMovie...
- step 2: process huge dump files (over 2GB's)....so when i reached step 2 expectedly my GUI froze..
i was using while(getline(inputFileStream,stringLine)) {...} so i placed QCoreApplication::processEvents(); inside the loop.
The application became really slow. So i placed a counter which only if it reaches a particular value will QCoreApplication::processEvents(); be executed.
Now the gif animation has become more like series of frames with visible transition from one to another.
Any faster triggering of processEvents() slows the application down (which anyway is nowhere near the non-GUI execution time).
As i see from Windows Task Manager one core has high utilization while other has low during the execution period.
So what approach should i take? Should i delve into mutithreading (i'v never used it before)?
Stripping down everything to explain the question the program looks like this:
class Animation;
class FileProcessing;
main(int argc,char** argv) {
QApplication* app=new QApplication(argc,argv);
QLabel* label1=new QLabel(...);
QLabel* label2=new QLabel(...);
Animation* objAnim=new Animation(...); //QMovie plays gif
objAnim->show();
//fileDialogs --> ask for files..this is modal so animation is fine till this point
FileProcessing* objFileProcessing=new FileProcessing(...);
objFileProcessing->processFiles(label1,label2); //process >2GB files
//in this i repeatedly call processEvents() as written above
//delete labels,objAnim and objFileProcessing;
delete app;
return 0;
}