PDA

View Full Version : Window performance problem



aleksjej
26th December 2010, 14:00
Hello,

I have a QThread that sends signals to QGLWidget slot function which invokes repaint() at the end. The animation in QGLWidget is OK, but when I try to do something with the window (e.g. Move it using its title bar) it responds very slow to eny reactions. It looks as if the repaint operation is invoked so frequently that the window event loop cannot process its events in appropriate time.

Do you know what`s the cause of the problem? Thanks

helloworld
26th December 2010, 15:34
I have not worked with QGLWidget specifically, but for QWidget in general you should use update() rather than calling repaint() directly since calling update() several times normally results in just one paintEvent() call.


We suggest only using repaint() if you need an immediate repaint, for example during animation. In almost all circumstances update() is better, as it permits Qt to optimize for speed and minimize flicker.

Not sure if that helps.

aleksjej
26th December 2010, 20:16
I have already tried this but this did not help. Any other ideas?

Added after 1 22 minutes:

I discovered that both QEvent::Paint and QEvent::Move and QEvent::Resize are handled by the same thread and loop. That seems to be a root cause of a problem, QEvent::Paint occurs so frequent that multiple QEvent::Move cannot be processed smoothly one after one. Can I assign some priorities to those eventsa so that QEvent::Move and QEvent::Resize would have the highest priority? Maybe there is another solution?

I can always try to invoke sleep on thread which causes repait when QEvent::Move is raised but this seems to be a bad solution...