Unfortunately, according to the Qt4 documentation, changing the window
flags hides the window (until show() is called). So I guess there is no
way to toggle the on-top mode without the ugly blinking effect. Then,
try to minimize its occurences.
if ( event->type() == (int)SetVideoOnTopEvent_Type )
{
SetVideoOnTopQtEvent* p_event = (SetVideoOnTopQtEvent*)event;
+ Qt::WindowFlags oldflags = windowFlags(), newflags;
+
if( p_event->OnTop() )
- setWindowFlags( windowFlags() | Qt::WindowStaysOnTopHint );
+ newflags = oldflags | Qt::WindowStaysOnTopHint;
else
- setWindowFlags( windowFlags() & ~Qt::WindowStaysOnTopHint );
- show(); /* necessary to apply window flags */
+ newflags = oldflags & ~Qt::WindowStaysOnTopHint;
+ if( newflags != oldflags )
+ {
+ setWindowFlags( newflags );
+ show(); /* necessary to apply window flags */
+ }
}
}