[vlc-commits] Qt: limit the tooltip within the bounds of the widget
Ludovic Fauvet
git at videolan.org
Sat Apr 23 00:08:54 CEST 2011
vlc | branch: master | Ludovic Fauvet <etix at l0cal.com> | Fri Apr 22 01:19:13 2011 +0200| [ef1d21d9b380da41580fd904ffebf98a57c221e6] | committer: Jean-Baptiste Kempf
Qt: limit the tooltip within the bounds of the widget
And avoid showing a negative value. AFAIK time travel is not supported
yet (at least until #35 is closed).
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ef1d21d9b380da41580fd904ffebf98a57c221e6
---
modules/gui/qt4/util/input_slider.cpp | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index d3fb835..0788b64 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -147,10 +147,13 @@ void SeekSlider::mouseMoveEvent( QMouseEvent *event )
}
/* Tooltip */
- QPoint p( event->globalX() - mTimeTooltip->width() / 2,
+ 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 ) );
- secstotimestr( psz_length, ( event->x() * inputLength ) / size().width() );
+
+ secstotimestr( psz_length, ( posX * inputLength ) / size().width() );
mTimeTooltip->setTime( psz_length );
mTimeTooltip->move( p );
event->accept();
More information about the vlc-commits
mailing list