Commit ba77b612 authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: Seek/SoundSlider: handle hijacked released mouse state (fix #8583)

parent 0708cb56
......@@ -199,9 +199,9 @@ void SeekSlider::updateBuffering( float f_buffering_ )
repaint();
}
void SeekSlider::mouseReleaseEvent( QMouseEvent *event )
void SeekSlider::processReleasedButton()
{
event->accept();
if ( !isSliding && !isJumping ) return;
isSliding = false;
bool b_seekPending = seekLimitTimer->isActive();
seekLimitTimer->stop(); /* We're not sliding anymore: only last seek on release */
......@@ -210,11 +210,21 @@ void SeekSlider::mouseReleaseEvent( QMouseEvent *event )
isJumping = false;
return;
}
QSlider::mouseReleaseEvent( event );
if( b_seekPending && isEnabled() )
updatePos();
}
void SeekSlider::mouseReleaseEvent( QMouseEvent *event )
{
if ( event->button() != Qt::LeftButton && event->button() != Qt::MidButton )
{
QSlider::mouseReleaseEvent( event );
return;
}
event->accept();
processReleasedButton();
}
void SeekSlider::mousePressEvent( QMouseEvent* event )
{
/* Right-click */
......@@ -273,6 +283,12 @@ void SeekSlider::mousePressEvent( QMouseEvent* event )
void SeekSlider::mouseMoveEvent( QMouseEvent *event )
{
if ( ! ( event->buttons() & ( Qt::LeftButton | Qt::MidButton ) ) )
{
/* Handle button release when mouserelease has been hijacked by popup */
processReleasedButton();
}
if ( !isEnabled() ) return event->accept();
if( isSliding )
......@@ -546,23 +562,30 @@ void SoundSlider::mousePressEvent( QMouseEvent *event )
}
}
void SoundSlider::mouseReleaseEvent( QMouseEvent *event )
void SoundSlider::processReleasedButton()
{
if( event->button() != Qt::RightButton )
if( !b_mouseOutside && value() != i_oldvalue )
{
if( !b_mouseOutside && value() != i_oldvalue )
{
emit sliderReleased();
setValue( value() );
emit sliderMoved( value() );
}
isSliding = false;
b_mouseOutside = false;
emit sliderReleased();
setValue( value() );
emit sliderMoved( value() );
}
isSliding = false;
b_mouseOutside = false;
}
void SoundSlider::mouseReleaseEvent( QMouseEvent *event )
{
if( event->button() != Qt::RightButton )
processReleasedButton();
}
void SoundSlider::mouseMoveEvent( QMouseEvent *event )
{
/* handle mouserelease hijacking */
if ( isSliding && ( event->buttons() & ~Qt::RightButton ) == Qt::NoButton )
processReleasedButton();
if( isSliding )
{
QRect rect( paddingL - 15, -1,
......
......@@ -71,6 +71,7 @@ protected:
virtual QSize sizeHint() const;
void processReleasedButton();
bool isAnimationRunning() const;
qreal handleOpacity() const;
void setHandleOpacity( qreal opacity );
......@@ -143,6 +144,8 @@ protected:
virtual void mouseMoveEvent( QMouseEvent * );
virtual void mouseReleaseEvent( QMouseEvent * );
void processReleasedButton();
private:
bool isSliding; /* Whether we are currently sliding by user action */
bool b_mouseOutside; /* Whether the mouse is outside or inside the Widget */
......
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