Commit ef1d21d9 authored by Ludovic Fauvet's avatar Ludovic Fauvet Committed by 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: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 6cf9460c
......@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment