View Full Version : My SDI application freezes when it is inactive ...why ?

5th September 2006, 17:24
Hi everybody !

I have a SDI application which plays a movie. When the main window is not active, the movie is paused and resumed when the main window is active again.

This is not the good behaviour because the movie should not be paused when the SDI application is inactive.

Here are some more details ... The QApplication object has a QMainWindow object which has a QWidget objet as its central widget. In the paintEvent function of the QWidget object I use another object to get the bitmpa to display. I can see that the paintEvent function is not called when my application is not active. None of my widgets have a focus policy (the default focus policy value is used ... QWidget::NoFocus). The Qt version I use is 3.02.

I hope someone could give me some clues to find out my problem.

thanks in advance.

5th September 2006, 17:37
Paint event won't be called because the window doesn't need to be refreshed. You can use a QTimer object to trigger QWidget::update() in regular intervals of time. Better yet, connect it to a custom slot, fetch the "next frame" there and call QWidget::update() from there. The paint event shouldn't contain any routines not connected with painting, because you never know when it will be called.