View Full Version : Qt interface running extremely slowly...

3rd February 2006, 19:37
I'm having some serious latency problems with my Qt widgets, and I'm hoping someone can point me in the right direction. (And when I say "serious latency," I'm talking about 10 second lags between a button and its action.) :confused:

Our main widget is a qglwidget. It displays video at 30fps, and we do some opengl drawing on top of the video. The qglwidget instantiates a user interface. The interface includes buttons, spinboxes, & sliders that allow the user to change the way the opengl cubes move, and some labels that display the new movement. Because we do some calculations to the user input before drawing, the flow of information is this:

User clicks a button, spinbox, or slider to change way the cubes move. The interface emits a signal.
The qglwidget receives the new info & runs a bunch of calculations. Final info is used to draw cubes, and is sent back to the interface (via a function call, not a signal [with a signal it's even slower] )
The interface uses a setText call to write the new info (post calculations) onto a label.

Some things to note:

The video is running like clockwork at 30fps. It sends the video feed to the calculation function, where the drawing function is called. Cube drawing happens at 30fps.
All buttons, sliders, & spinboxes have huge amounts of lag. When the user clicks a spinbox, for example, it takes up to 12 seconds for the cubes to begin moving in the new way, and then another 15 seconds or so for the label to get changed.
Even moving the application window to a different part of the monitor takes many seconds.
This program didn't have this problem a few months ago. Since then we've done a lot of updating, but the two changes I think are worthy of comment are the change from Qt 3.3 to Qt 4.1, and the addition of more cubes (we used to only have one cube).
My development box is a dual core, and when I check the task manager, one of the processors is always flatlined (but not the other).
I tried putting a call to qApp->processEvents at the end of the calculation function, but all it did was cause the program to crash.

Please let me know any ideas you have on why this might be happening. When we switched to Qt 4, I didn't recode our program in a Qt 4 way, I just ran qt3to4 and then fixed the things that were keeping it from running. Are there other changes between Qt 3.3 and Qt 4.1 that could cause this? Also, our setup is a little unusual, with the interface widget inside the qglwidget -- could that make this happen? Would we be better to have a main window that included the interface, then instantiate a qglwidget inside that?

Thanks so much for your help in advance!

4th February 2006, 12:12
Can we see some code and screenshots? Do you use multiple threads?