View Full Version : Flickering when change QWidget window state between showMaximized() and showFullScree

22nd October 2013, 10:45

I have problems with 'WindowStateChange' events in my QWidget.
I have created a simple test widget with 3 buttons, to set window state:
Normal: showNormal();
MAX: showMaximized();
FullScreen: showFullScreen();
and trace window state events (QEvent::WindowStateChange).

When I change 'normal' < > 'max' there is no problem (altough i receive twice 'max' event), BUT when i change 'max' <> 'fullscreen' i receive this events:

'max' --> 'fullscreen'
0 No State
4 FullScreen

'fullscreen' --> 'max'
6 Maximized
4 FullScreen
6 Maximized
2 Maximized

with code like this:

state = windowState();
if ( state & Qt::WindowMaximized )
qDebug() << state << "Maximized";

So my widget has in both cases a strange flickering. That is, when 'max' --> 'fullscreen', it has an 'intermediate' "normal" state (0), and when 'fullscreen' --> 'max', it has several 'intermediate' states...

In my application, I must show/hide things when app is normal/maximized/fullScreened, so this flickering is really a problem.

Is it possible to do anything?

Thanks in advance,


22nd October 2013, 18:00
You could try delaying the visibilty change of your elements, e.g. using a single shot QTimer or QMetaObject::invokeMethod with Qt::QueuedConnection.

I.e. so that your change is done after the event series.