diff --git a/src/gui/clips/MidiClipView.cpp b/src/gui/clips/MidiClipView.cpp index 3cbf3fa96c6..b735913e4d0 100644 --- a/src/gui/clips/MidiClipView.cpp +++ b/src/gui/clips/MidiClipView.cpp @@ -332,13 +332,7 @@ void MidiClipView::wheelEvent(QWheelEvent * we) } Note * n = m_clip->noteAtStep( step ); - int direction = we->angleDelta().y() > 0 ? 1 : -1; -#if QT_VERSION >= 0x050700 - if (we->inverted()) { - // Handle "natural" scrolling, which is common on trackpads and touch devices - direction = -direction; - } -#endif + const int direction = (we->angleDelta().y() > 0 ? 1 : -1) * (we->inverted() ? -1 : 1); if(!n && direction > 0) { n = m_clip->addStepNote( step ); diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 743415c506d..e7565c2558a 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3774,13 +3774,7 @@ void PianoRoll::wheelEvent(QWheelEvent * we ) } if( nv.size() > 0 ) { - int step = we->angleDelta().y() > 0 ? 1 : -1; -#if QT_VERSION >= 0x050700 - if (we->inverted()) { - // Handle "natural" scrolling, which is common on trackpads and touch devices - step = -step; - } -#endif + const int step = (we->angleDelta().y() > 0 ? 1 : -1) * (we->inverted() ? -1 : 1); if( m_noteEditMode == NoteEditMode::Volume ) { diff --git a/src/gui/widgets/ComboBox.cpp b/src/gui/widgets/ComboBox.cpp index 8d31d6cd59f..0daae1b240b 100644 --- a/src/gui/widgets/ComboBox.cpp +++ b/src/gui/widgets/ComboBox.cpp @@ -220,13 +220,7 @@ void ComboBox::wheelEvent( QWheelEvent* event ) { if( model() ) { - int direction = event->angleDelta().y() < 0 ? 1 : -1; -#if QT_VERSION >= 0x050700 - if (event->inverted()) { - // Handle "natural" scrolling, which is common on trackpads and touch devices - direction = -direction; - } -#endif + const int direction = (event->angleDelta().y() < 0 ? 1 : -1) * (event->inverted() ? -1 : 1); model()->setInitValue(model()->value() + direction); update(); event->accept(); diff --git a/src/gui/widgets/Fader.cpp b/src/gui/widgets/Fader.cpp index e6c6f19132c..d2d7c1c2ea9 100644 --- a/src/gui/widgets/Fader.cpp +++ b/src/gui/widgets/Fader.cpp @@ -193,14 +193,7 @@ void Fader::mouseReleaseEvent(QMouseEvent* mouseEvent) void Fader::wheelEvent (QWheelEvent* ev) { ev->accept(); - int direction = ev->angleDelta().y() > 0 ? 1 : -1; - -#if QT_VERSION >= 0x050700 - if (ev->inverted()) { - // Handle "natural" scrolling, which is common on trackpads and touch devices - direction = -direction; - } -#endif + const int direction = (ev->angleDelta().y() > 0 ? 1 : -1) * (ev->inverted() ? -1 : 1); model()->incValue(direction); updateTextFloat(); diff --git a/src/gui/widgets/FloatModelEditorBase.cpp b/src/gui/widgets/FloatModelEditorBase.cpp index 1cb430ba692..ebd0d3d9dc7 100644 --- a/src/gui/widgets/FloatModelEditorBase.cpp +++ b/src/gui/widgets/FloatModelEditorBase.cpp @@ -326,12 +326,10 @@ void FloatModelEditorBase::wheelEvent(QWheelEvent * we) } } -#if QT_VERSION >= 0x050700 // Handle "natural" scrolling, which is common on trackpads and touch devices if (we->inverted()) { direction = -direction; } -#endif // Compute the number of steps but make sure that we always do at least one step const float stepMult = std::max(range / numberOfStepsForFullSweep / step, 1.f); diff --git a/src/gui/widgets/LcdSpinBox.cpp b/src/gui/widgets/LcdSpinBox.cpp index fc32c46019d..3f12360ccdc 100644 --- a/src/gui/widgets/LcdSpinBox.cpp +++ b/src/gui/widgets/LcdSpinBox.cpp @@ -141,14 +141,7 @@ void LcdSpinBox::mouseReleaseEvent(QMouseEvent*) void LcdSpinBox::wheelEvent(QWheelEvent * we) { we->accept(); - int direction = we->angleDelta().y() > 0 ? 1 : -1; - -#if QT_VERSION >= 0x050700 - if (we->inverted()) { - // Handle "natural" scrolling, which is common on trackpads and touch devices - direction = -direction; - } -#endif + const int direction = (we->angleDelta().y() > 0 ? 1 : -1) * (we->inverted() ? -1 : 1); model()->setValue(model()->value() + direction * model()->step()); emit manualChange();