Commit 99b7cf3c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Qt4: only reset main interface window flags if needed

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.
parent ed4a1d9a
...@@ -1039,12 +1039,18 @@ void MainInterface::customEvent( QEvent *event ) ...@@ -1039,12 +1039,18 @@ void MainInterface::customEvent( QEvent *event )
if ( event->type() == (int)SetVideoOnTopEvent_Type ) if ( event->type() == (int)SetVideoOnTopEvent_Type )
{ {
SetVideoOnTopQtEvent* p_event = (SetVideoOnTopQtEvent*)event; SetVideoOnTopQtEvent* p_event = (SetVideoOnTopQtEvent*)event;
Qt::WindowFlags oldflags = windowFlags(), newflags;
if( p_event->OnTop() ) if( p_event->OnTop() )
setWindowFlags( windowFlags() | Qt::WindowStaysOnTopHint ); newflags = oldflags | Qt::WindowStaysOnTopHint;
else else
setWindowFlags( windowFlags() & ~Qt::WindowStaysOnTopHint ); newflags = oldflags & ~Qt::WindowStaysOnTopHint;
if( newflags != oldflags )
{
setWindowFlags( newflags );
show(); /* necessary to apply window flags */ show(); /* necessary to apply window flags */
} }
}
} }
void MainInterface::keyPressEvent( QKeyEvent *e ) void MainInterface::keyPressEvent( QKeyEvent *e )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment