[vlc-commits] Qt: SeekSlider: Don't show tooltip for unknown time positions

Francois Cartegnie git at videolan.org
Mon Apr 25 16:13:14 CEST 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Apr 25 16:12:45 2011 +0200| [8b7486e8bbbcc6bb7495ddf78d4133b5eecaf3f2] | committer: Francois Cartegnie

Qt: SeekSlider: Don't show tooltip for unknown time positions

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

 modules/gui/qt4/util/input_slider.cpp |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index 0788b64..d990d9a 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -147,15 +147,18 @@ void SeekSlider::mouseMoveEvent( QMouseEvent *event )
     }
 
     /* Tooltip */
-    int posX = qMax( rect().left(), qMin( rect().right(), event->x() ) );
+    if ( inputLength > 0 )
+    {
+        int posX = qMax( rect().left(), qMin( rect().right(), event->x() ) );
 
-    QPoint p( event->globalX() - ( event->x() - posX ) - ( mTimeTooltip->width() / 2 ),
-               QWidget::mapToGlobal( pos() ).y() - ( mTimeTooltip->height() + 2 ) );
+        QPoint p( event->globalX() - ( event->x() - posX ) - ( mTimeTooltip->width() / 2 ),
+                  QWidget::mapToGlobal( pos() ).y() - ( mTimeTooltip->height() + 2 ) );
 
 
-    secstotimestr( psz_length, ( posX * inputLength ) / size().width() );
-    mTimeTooltip->setTime( psz_length );
-    mTimeTooltip->move( p );
+        secstotimestr( psz_length, ( posX * inputLength ) / size().width() );
+        mTimeTooltip->setTime( psz_length );
+        mTimeTooltip->move( p );
+    }
     event->accept();
 }
 
@@ -176,7 +179,7 @@ void SeekSlider::wheelEvent( QWheelEvent *event )
 void SeekSlider::enterEvent( QEvent *e )
 {
     /* Don't show the tooltip if the slider is disabled */
-    if( isEnabled() )
+    if( isEnabled() && inputLength > 0 )
         mTimeTooltip->show();
 }
 



More information about the vlc-commits mailing list