Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 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
31 changes: 19 additions & 12 deletions src/widget/wwaveformviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ WWaveformViewer::WWaveformViewer(

setAttribute(Qt::WA_OpaquePaintEvent);
setFocusPolicy(Qt::NoFocus);

setCursor(Qt::OpenHandCursor);
}

WWaveformViewer::~WWaveformViewer() {
Expand Down Expand Up @@ -178,18 +180,7 @@ void WWaveformViewer::mouseMoveEvent(QMouseEvent* event) {
}

void WWaveformViewer::mouseReleaseEvent(QMouseEvent* /*event*/) {
if (m_bScratching) {
m_pScratchPositionEnable->set(0.0);
m_bScratching = false;
}
if (m_bBending) {
m_pWheel->setParameter(0.5);
m_bBending = false;
}
m_mouseAnchor = QPoint();

// Set the cursor back to an arrow.
setCursor(Qt::ArrowCursor);
stopScratchingAndBending();
}

void WWaveformViewer::wheelEvent(QWheelEvent* event) {
Expand Down Expand Up @@ -219,6 +210,22 @@ void WWaveformViewer::leaveEvent(QEvent*) {
unhighlightMark(m_pHoveredMark);
m_pHoveredMark = nullptr;
}
stopScratchingAndBending();
}

void WWaveformViewer::stopScratchingAndBending() {
if (m_bScratching) {
m_pScratchPositionEnable->set(0.0);
m_bScratching = false;
}
if (m_bBending) {
m_pWheel->setParameter(0.5);
m_bBending = false;
}
m_mouseAnchor = QPoint();

// Set the cursor back to an open hand.
setCursor(Qt::OpenHandCursor);
}

void WWaveformViewer::slotTrackLoaded(TrackPointer track) {
Expand Down
2 changes: 2 additions & 0 deletions src/widget/wwaveformviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class WWaveformViewer : public WWidget, public TrackDropTarget {
void setDisplayBeatGridAlpha(int alpha);
void setPlayMarkerPosition(double position);

void stopScratchingAndBending();

private:
const QString m_group;
UserSettingsPointer m_pConfig;
Expand Down