[vlc-commits] Qt: fix the Win32/Qt5 tooltip focus/raising issue

Benoit du Payrat git at videolan.org
Thu May 26 15:04:21 CEST 2016


vlc/vlc-2.2 | branch: master | Benoit du Payrat <benoit at videolabs.io> | Thu May 26 14:49:12 2016 +0200| [3e39b615c113ab8b78eb6679f1a399919f55ff4b] | committer: 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 <jb at videolan.org>
(cherry picked from commit 93ef5e5b18888dfc1fc2a24dd5e4a0caecfdad17)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=3e39b615c113ab8b78eb6679f1a399919f55ff4b
---

 modules/gui/qt4/util/input_slider.cpp |    3 ++-
 modules/gui/qt4/util/timetooltip.cpp  |   22 ++++++----------------
 2 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index d947d86..7aade81 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -100,7 +100,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 */
@@ -143,6 +143,7 @@ SeekSlider::~SeekSlider()
     delete chapters;
     if ( alternativeStyle )
         delete alternativeStyle;
+    delete mTimeTooltip;
 }
 
 /***
diff --git a/modules/gui/qt4/util/timetooltip.cpp b/modules/gui/qt4/util/timetooltip.cpp
index 574eca9..28fa7de 100644
--- a/modules/gui/qt4/util/timetooltip.cpp
+++ b/modules/gui/qt4/util/timetooltip.cpp
@@ -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 );



More information about the vlc-commits mailing list