PDA

View Full Version : Screen refresh during heavy computation



martinb0820
14th November 2008, 23:52
I'm working on an application that uses Qt 4.4.3, Mercury Open Inventor, HDF and some proprietary very math intensive legacy Fortran libraries.

The program performs some very processor intensive computation on input files. While this is going on, dragging another window over the application corrupts it until the computation ends, and the main window is refreshed. The progress bar also doesn't appear for quite awhile.

The computations populate data structures, but the data isn't used until the processinjg is complete. Basiclly, while the computation is going on, the only thing the program needs to do is keep the screen looking OK and show the progress bar.

I think I need to stick to a thread-based approach, since the legacy code would be very difficult to break into chunks.

I tried putting the computation in its own thread, and even experimented with lower priorities (e.g. QThread::LowPriority) but this didn't seem to help.

Any ideas would be appreciated. Thanks in advance!

wysota
16th November 2008, 17:20
Are you a commercial Qt user? Do you have access to the latest Qt Quarterly? There is an article there that helps solve such issues. Besides that, are you sure you actually started the other thread? If you experience what you experience, it is likely you still do the computation in the main thread.

martinb0820
17th November 2008, 15:27
Yes, I'm a commercial user. How do I access the Qt Quarterly?

wysota
17th November 2008, 19:06
You should have received a link to the PDF by e-mail about 4 weeks ago. If you didn't get it, contact Qt Software.

martinb0820
17th November 2008, 19:44
Thanks! The article is exactly what I needed. The e-mail from Trolltech had gone to someone else in the company, so I wasn't aware of it until your reply.

wysota
17th November 2008, 23:20
Thanks! The article is exactly what I needed.

I'm glad you like it :)