[vlc-commits] Qt: Fix corner-case with some top level windows

Ludovic Fauvet git at videolan.org
Fri Sep 30 16:31:45 CEST 2011


vlc | branch: master | Ludovic Fauvet <etix at videolan.org> | Thu Sep 29 18:45:51 2011 +0200| [ee3754df7b0df025a5d85788bdec93069c177be0] | committer: Jean-Baptiste Kempf

Qt: Fix corner-case with some top level windows

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/qt4/util/input_slider.cpp |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index 28f6e48..382cfb4 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -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 * )



More information about the vlc-commits mailing list