Commit eabbeb18 authored by Rafaël Carré's avatar Rafaël Carré

Fix duration slider. Patch by Hannes Domani

parent fc63146c
...@@ -38,19 +38,17 @@ public: ...@@ -38,19 +38,17 @@ public:
void mousePressEvent(QMouseEvent* event) void mousePressEvent(QMouseEvent* event)
{ {
if(event->button() == Qt::LeftButton) if( event->button() != Qt::LeftButton && event->button() != Qt::MidButton )
{ {
#ifdef WIN32 QSlider::mousePressEvent( event );
int width1 = qobject_cast<QWidget*>(parent())->sizeHint().width() - return;
2 * qobject_cast<QWidget*>(parent())->layout()->margin();
#else
int width1 = width();
#endif
int pos = (int)(minimum() +
(double)(event->x())/width1*(maximum()-minimum()) );
setValue( pos );
QSlider::mousePressEvent(event);
} }
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 #endif
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