diff --git a/include/AutomationEditor.h b/include/AutomationEditor.h index 1110e8e4c9e..15f6dd22ec5 100644 --- a/include/AutomationEditor.h +++ b/include/AutomationEditor.h @@ -241,6 +241,8 @@ protected slots: QScrollBar * m_leftRightScroll; QScrollBar * m_topBottomScroll; + void adjustLeftRightScoll(int value); + TimePos m_currentPosition; Action m_action; diff --git a/include/PianoRoll.h b/include/PianoRoll.h index 35550a5b32f..a85e50a163b 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -374,6 +374,8 @@ protected slots: QScrollBar * m_leftRightScroll; QScrollBar * m_topBottomScroll; + void adjustLeftRightScoll(int value); + TimePos m_currentPosition; bool m_recording; bool m_doAutoQuantization{false}; diff --git a/include/SongEditor.h b/include/SongEditor.h index 98a9096fb26..1f719623a1e 100644 --- a/include/SongEditor.h +++ b/include/SongEditor.h @@ -128,6 +128,8 @@ private slots: QScrollBar * m_leftRightScroll; + void adjustLeftRightScoll(int value); + LcdSpinBox * m_tempoSpinBox; TimeLineWidget * m_timeLine; diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index df67398827e..3dc0285d282 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -1560,7 +1560,11 @@ void AutomationEditor::resizeEvent(QResizeEvent * re) update(); } - +void AutomationEditor::adjustLeftRightScoll(int value) +{ + m_leftRightScroll->setValue(m_leftRightScroll->value() - + value * 0.3f / m_zoomXLevels[m_zoomingXModel.value()]); +} // TODO: Move this method up so it's closer to the other mouse events @@ -1625,13 +1629,11 @@ void AutomationEditor::wheelEvent(QWheelEvent * we ) // FIXME: Reconsider if determining orientation is necessary in Qt6. else if(abs(we->angleDelta().x()) > abs(we->angleDelta().y())) // scrolling is horizontal { - m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().x() * 2 / 15); + adjustLeftRightScoll(we->angleDelta().x()); } else if(we->modifiers() & Qt::ShiftModifier) { - m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().y() * 2 / 15); + adjustLeftRightScoll(we->angleDelta().y()); } else { diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index f8472b6888c..2193456e459 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -3743,6 +3743,12 @@ void PianoRoll::resizeEvent(QResizeEvent* re) } +void PianoRoll::adjustLeftRightScoll(int value) +{ + m_leftRightScroll->setValue(m_leftRightScroll->value() - + value * 0.3f / m_zoomLevels[m_zoomingModel.value()]); +} + void PianoRoll::wheelEvent(QWheelEvent * we ) @@ -3875,13 +3881,11 @@ void PianoRoll::wheelEvent(QWheelEvent * we ) // FIXME: Reconsider if determining orientation is necessary in Qt6. else if(abs(we->angleDelta().x()) > abs(we->angleDelta().y())) // scrolling is horizontal { - m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().x() * 2 / 15); + adjustLeftRightScoll(we->angleDelta().x()); } else if(we->modifiers() & Qt::ShiftModifier) { - m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().y() * 2 / 15); + adjustLeftRightScoll(we->angleDelta().y()); } else { diff --git a/src/gui/editors/SongEditor.cpp b/src/gui/editors/SongEditor.cpp index f6e9fc83bf8..72ee28bc82a 100644 --- a/src/gui/editors/SongEditor.cpp +++ b/src/gui/editors/SongEditor.cpp @@ -516,6 +516,12 @@ void SongEditor::keyPressEvent( QKeyEvent * ke ) +void SongEditor::adjustLeftRightScoll(int value) +{ + m_leftRightScroll->setValue(m_leftRightScroll->value() + - value * DEFAULT_PIXELS_PER_BAR / pixelsPerBar()); +} + void SongEditor::wheelEvent( QWheelEvent * we ) { @@ -544,13 +550,11 @@ void SongEditor::wheelEvent( QWheelEvent * we ) // FIXME: Reconsider if determining orientation is necessary in Qt6. else if (std::abs(we->angleDelta().x()) > std::abs(we->angleDelta().y())) // scrolling is horizontal { - m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().x()); + adjustLeftRightScoll(we->angleDelta().x()); } else if (we->modifiers() & Qt::ShiftModifier) { - m_leftRightScroll->setValue(m_leftRightScroll->value() - - we->angleDelta().y()); + adjustLeftRightScoll(we->angleDelta().y()); } else {