Commit 8b7486e8 authored by Francois Cartegnie's avatar Francois Cartegnie

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

parent 86027501
...@@ -147,6 +147,8 @@ void SeekSlider::mouseMoveEvent( QMouseEvent *event ) ...@@ -147,6 +147,8 @@ void SeekSlider::mouseMoveEvent( QMouseEvent *event )
} }
/* Tooltip */ /* Tooltip */
if ( inputLength > 0 )
{
int posX = qMax( rect().left(), qMin( rect().right(), event->x() ) ); int posX = qMax( rect().left(), qMin( rect().right(), event->x() ) );
QPoint p( event->globalX() - ( event->x() - posX ) - ( mTimeTooltip->width() / 2 ), QPoint p( event->globalX() - ( event->x() - posX ) - ( mTimeTooltip->width() / 2 ),
...@@ -156,6 +158,7 @@ void SeekSlider::mouseMoveEvent( QMouseEvent *event ) ...@@ -156,6 +158,7 @@ void SeekSlider::mouseMoveEvent( QMouseEvent *event )
secstotimestr( psz_length, ( posX * inputLength ) / size().width() ); secstotimestr( psz_length, ( posX * inputLength ) / size().width() );
mTimeTooltip->setTime( psz_length ); mTimeTooltip->setTime( psz_length );
mTimeTooltip->move( p ); mTimeTooltip->move( p );
}
event->accept(); event->accept();
} }
...@@ -176,7 +179,7 @@ void SeekSlider::wheelEvent( QWheelEvent *event ) ...@@ -176,7 +179,7 @@ void SeekSlider::wheelEvent( QWheelEvent *event )
void SeekSlider::enterEvent( QEvent *e ) void SeekSlider::enterEvent( QEvent *e )
{ {
/* Don't show the tooltip if the slider is disabled */ /* Don't show the tooltip if the slider is disabled */
if( isEnabled() ) if( isEnabled() && inputLength > 0 )
mTimeTooltip->show(); mTimeTooltip->show();
} }
......
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