Skip to content

Commit

Permalink
Remove QT_VERSION guards
Browse files Browse the repository at this point in the history
  • Loading branch information
tresf committed May 9, 2024
1 parent 35a00be commit 33760c4
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 39 deletions.
8 changes: 1 addition & 7 deletions src/gui/clips/MidiClipView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
8 changes: 1 addition & 7 deletions src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down
8 changes: 1 addition & 7 deletions src/gui/widgets/ComboBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
9 changes: 1 addition & 8 deletions src/gui/widgets/Fader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 0 additions & 2 deletions src/gui/widgets/FloatModelEditorBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 1 addition & 8 deletions src/gui/widgets/LcdSpinBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>());
emit manualChange();
Expand Down

0 comments on commit 33760c4

Please sign in to comment.