From eabbeb18557d8aba3c34c6cba2f2a0ba9304dff5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Sat, 8 Sep 2007 01:14:23 +0000 Subject: [PATCH] Fix duration slider. Patch by Hannes Domani --- modules/gui/qt4/util/directslider.hpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/modules/gui/qt4/util/directslider.hpp b/modules/gui/qt4/util/directslider.hpp index 02ec2296e5..d6ea43dcf9 100644 --- a/modules/gui/qt4/util/directslider.hpp +++ b/modules/gui/qt4/util/directslider.hpp @@ -38,19 +38,17 @@ public: void mousePressEvent(QMouseEvent* event) { - if(event->button() == Qt::LeftButton) + if( event->button() != Qt::LeftButton && event->button() != Qt::MidButton ) { -#ifdef WIN32 - int width1 = qobject_cast(parent())->sizeHint().width() - - 2 * qobject_cast(parent())->layout()->margin(); -#else - int width1 = width(); -#endif - int pos = (int)(minimum() + - (double)(event->x())/width1*(maximum()-minimum()) ); - setValue( pos ); - QSlider::mousePressEvent(event); + QSlider::mousePressEvent( event ); + return; } + + QMouseEvent newEvent( event->type(), event->pos(), event->globalPos(), + Qt::MouseButton( event->button() ^ Qt::LeftButton ^ Qt::MidButton ), + Qt::MouseButtons( event->buttons() ^ Qt::LeftButton ^ Qt::MidButton ), + event->modifiers() ); + QSlider::mousePressEvent( &newEvent ); } }; #endif -- 2.39.2