diff --git a/include/MixerChannelLcdSpinBox.h b/include/MixerChannelLcdSpinBox.h index 0abd9f100f1..251cf7da259 100644 --- a/include/MixerChannelLcdSpinBox.h +++ b/include/MixerChannelLcdSpinBox.h @@ -50,6 +50,8 @@ class MixerChannelLcdSpinBox : public LcdSpinBox void contextMenuEvent(QContextMenuEvent* event) override; private: + void enterValue(); + TrackView * m_tv; }; diff --git a/src/gui/widgets/MixerChannelLcdSpinBox.cpp b/src/gui/widgets/MixerChannelLcdSpinBox.cpp index 8a67394de91..73e21b479b4 100644 --- a/src/gui/widgets/MixerChannelLcdSpinBox.cpp +++ b/src/gui/widgets/MixerChannelLcdSpinBox.cpp @@ -24,6 +24,9 @@ #include "MixerChannelLcdSpinBox.h" +#include +#include + #include "CaptionMenu.h" #include "MixerView.h" #include "GuiApplication.h" @@ -40,6 +43,13 @@ void MixerChannelLcdSpinBox::setTrackView(TrackView * tv) void MixerChannelLcdSpinBox::mouseDoubleClickEvent(QMouseEvent* event) { + if (!(event->modifiers() & Qt::ShiftModifier) && + !(event->modifiers() & Qt::ControlModifier)) + { + enterValue(); + return; + } + getGUI()->mixerView()->setCurrentMixerChannel(model()->value()); getGUI()->mixerView()->parentWidget()->show(); @@ -69,5 +79,18 @@ void MixerChannelLcdSpinBox::contextMenuEvent(QContextMenuEvent* event) contextMenu->exec(QCursor::pos()); } +void MixerChannelLcdSpinBox::enterValue() +{ + const auto val = model()->value(); + const auto min = model()->minValue(); + const auto max = model()->maxValue(); + const auto step = model()->step(); + const auto label = tr("Please enter a new value between %1 and %2:").arg(min).arg(max); + + auto ok = false; + const auto newVal = QInputDialog::getInt(this, tr("Set value"), label, val, min, max, step, &ok); + + if (ok) { model()->setValue(newVal); } +} } // namespace lmms::gui