Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/AutomatableSlider.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ class AutomatableSlider : public QSlider, public IntModelView
void mousePressEvent( QMouseEvent * _me ) override;
void mouseReleaseEvent( QMouseEvent * _me ) override;
void wheelEvent( QWheelEvent * _me ) override;
void mouseDoubleClickEvent(QMouseEvent* ev) override;

void modelChanged() override;


private:
bool m_showStatus;
void enterValue();


private slots:
Expand Down
25 changes: 25 additions & 0 deletions src/gui/widgets/AutomatableSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "AutomatableSlider.h"

#include <QMouseEvent>
#include <QInputDialog>

#include "CaptionMenu.h"

Expand Down Expand Up @@ -111,7 +112,31 @@ void AutomatableSlider::wheelEvent( QWheelEvent * _me )
m_showStatus = old_status;
}

void AutomatableSlider::mouseDoubleClickEvent(QMouseEvent*)
{
enterValue();
}

void AutomatableSlider::enterValue()
{
bool ok;
int newVal;

newVal = QInputDialog::getInt(
this, tr("Set value"),
tr("Please enter a new value between %1 and %2:")
.arg(model()->minValue())
.arg(model()->maxValue()),
model()->value(),
model()->minValue(),
model()->maxValue(),
model()->step<int>(), &ok);

if (ok)
{
model()->setValue(newVal);
}
}


void AutomatableSlider::modelChanged()
Expand Down
Loading