Commit 93ef5e5b authored by Benoit's avatar Benoit Committed by Jean-Baptiste Kempf

Qt: fix the Win32/Qt5 tooltip focus/raising issue

The time tooltip no longer puts the window in front on Windows, when
compiling VLC with Qt5

Close #12084 #8532
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 0fd217b2
......@@ -109,7 +109,7 @@ SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent, bool _static )
seekLimitTimer->setSingleShot( true );
/* Tooltip bubble */
mTimeTooltip = new TimeTooltip( this );
mTimeTooltip = new TimeTooltip( NULL );
mTimeTooltip->setMouseTracking( true );
/* Properties */
......@@ -174,6 +174,7 @@ SeekSlider::~SeekSlider()
delete chapters;
if ( alternativeStyle )
delete alternativeStyle;
delete mTimeTooltip;
}
/***
......
......@@ -33,29 +33,15 @@
TimeTooltip::TimeTooltip( QWidget *parent ) :
QWidget( parent )
{
setWindowFlags(
#if defined( Q_OS_WIN )
Qt::ToolTip
#else
Qt::Window |
setWindowFlags( Qt::Tool |
Qt::WindowStaysOnTopHint |
Qt::FramelessWindowHint |
Qt::X11BypassWindowManagerHint
#endif
);
Qt::X11BypassWindowManagerHint );
// Tell Qt that it doesn't need to erase the background before
// a paintEvent occurs. This should save some CPU cycles.
setAttribute( Qt::WA_OpaquePaintEvent );
#if defined( Q_OS_WIN ) || defined( Q_OS_OS2 )
/*
- This attribute is required on Windows and OS/2 to avoid focus stealing of other windows.
- When set on Linux the TimeTooltip appears behind the FSController in fullscreen.
*/
setAttribute( Qt::WA_ShowWithoutActivating );
#endif
// Inherit from the system default font size -5
mFont = QFont( "Verdana", qMax( qApp->font().pointSize() - 5, 7 ) );
mTipX = -1;
......@@ -83,7 +69,11 @@ void TimeTooltip::adjustPosition()
// The desired label position is just above the target
QPoint position( mTarget.x() - size.width() / 2,
#if defined( Q_OS_WIN )
mTarget.y() - 2 * size.height() - TIP_HEIGHT / 2 );
#else
mTarget.y() - size.height() + TIP_HEIGHT / 2 );
#endif
// Keep the tooltip on the same screen if possible
QRect screen = QApplication::desktop()->screenGeometry( mTarget );
......
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