]> git.sesse.net Git - vlc/commitdiff
Qt: Fix corner-case with some top level windows
authorLudovic Fauvet <etix@videolan.org>
Thu, 29 Sep 2011 16:45:51 +0000 (18:45 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Fri, 30 Sep 2011 14:27:55 +0000 (16:27 +0200)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/gui/qt4/util/input_slider.cpp

index 28f6e4844c398ec649b7068f36c38b6a437b61c0..382cfb4551c3d7752c3a0ce68c78b11dba2ccf31 100644 (file)
@@ -47,6 +47,7 @@
 #include <QColor>
 #include <QPoint>
 #include <QPropertyAnimation>
+#include <QApplication>
 
 #define MINIMUM 0
 #define MAXIMUM 1000
@@ -291,16 +292,23 @@ void SeekSlider::enterEvent( QEvent * )
         animHandle->setDirection( QAbstractAnimation::Forward );
         animHandle->start();
     }
-    /* Don't show the tooltip if the slider is disabled */
-    if( isEnabled() && inputLength > 0 )
+    /* Don't show the tooltip if the slider is disabled or a menu is open */
+    if( isEnabled() && inputLength > 0 && !qApp->activePopupWidget() )
         mTimeTooltip->show();
 }
 
 void SeekSlider::leaveEvent( QEvent * )
 {
     hideHandleTimer->start();
-    if( !rect().contains( mapFromGlobal( QCursor::pos() ) ) )
+    /* Hide the tooltip
+       - if the mouse leave the slider rect (Note: it can still be
+         over the tooltip!)
+       - if another window is on the way of the cursor */
+    if( !rect().contains( mapFromGlobal( QCursor::pos() ) ) ||
+      ( !isActiveWindow() && !mTimeTooltip->isActiveWindow() ) )
+    {
         mTimeTooltip->hide();
+    }
 }
 
 void SeekSlider::hideEvent( QHideEvent * )