Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 12 additions & 0 deletions src/widget/knobeventhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ class KnobEventHandler {
}

double valueFromMouseEvent(T* pWidget, QMouseEvent* e) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QPoint cur(e->globalPosition().toPoint());
#else
QPoint cur(e->globalPos());
#endif
QPoint diff(cur - m_prevPos);
double dist = sqrt(static_cast<double>(diff.x() * diff.x() + diff.y() * diff.y()));
bool y_dominant = abs(diff.y()) > abs(diff.x());
Expand All @@ -47,7 +51,11 @@ class KnobEventHandler {
double value = valueFromMouseEvent(pWidget, e);
pWidget->setControlParameterDown(value);
pWidget->inputActivity();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_prevPos = e->globalPosition().toPoint();
#else
m_prevPos = e->globalPos();
#endif
}
}

Expand All @@ -59,7 +67,11 @@ class KnobEventHandler {
break;
case Qt::LeftButton:
case Qt::MiddleButton:
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_startPos = e->globalPosition().toPoint();
#else
m_startPos = e->globalPos();
#endif
m_prevPos = m_startPos;
// Somehow using Qt::BlankCursor does not work on Windows
// https://mixxx.org/forums/viewtopic.php?p=40298#p40298
Expand Down
16 changes: 16 additions & 0 deletions src/widget/slidereventhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,17 @@ class SliderEventHandler {
void mouseMoveEvent(T* pWidget, QMouseEvent* e) {
if (!m_bRightButtonPressed) {
if (m_bHorizontal) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_dPos = e->position().x() - m_dHandleLength / 2;
#else
m_dPos = e->x() - m_dHandleLength / 2;
#endif
} else {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_dPos = e->position().y() - m_dHandleLength / 2;
#else
m_dPos = e->y() - m_dHandleLength / 2;
#endif
}

m_dPos = m_dStartHandlePos + (m_dPos - m_dStartMousePos);
Expand Down Expand Up @@ -81,9 +89,17 @@ class SliderEventHandler {
m_bRightButtonPressed = true;
} else {
if (m_bHorizontal) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_dStartMousePos = e->position().x() - m_dHandleLength / 2;
#else
m_dStartMousePos = e->x() - m_dHandleLength / 2;
#endif
} else {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_dStartMousePos = e->position().y() - m_dHandleLength / 2;
#else
m_dStartMousePos = e->y() - m_dHandleLength / 2;
#endif
}
m_dStartHandlePos = m_dPos;
}
Expand Down
4 changes: 4 additions & 0 deletions src/widget/wcoverart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,11 @@ void WCoverArt::contextMenuEvent(QContextMenuEvent* event) {
event->accept();
if (m_loadedTrack) {
m_pMenu->setCoverArt(m_lastRequestedCover);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_pMenu->popup(event->globalPosition().toPoint());
#else
m_pMenu->popup(event->globalPos());
#endif
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/widget/wcoverartlabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ void WCoverArtLabel::slotCoverMenu(const QPoint& pos) {

void WCoverArtLabel::contextMenuEvent(QContextMenuEvent* event) {
event->accept();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_pCoverMenu->popup(event->globalPosition().toPoint());
#else
m_pCoverMenu->popup(event->globalPos());
#endif
}

void WCoverArtLabel::loadTrack(TrackPointer pTrack) {
Expand Down
4 changes: 4 additions & 0 deletions src/widget/weffectpushbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ void WEffectPushButton::onConnectedControlChanged(double dParameter, double dVal
void WEffectPushButton::mousePressEvent(QMouseEvent* e) {
const bool rightClick = e->button() == Qt::RightButton;
if (rightClick && m_pButtonMenu->actions().size()) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_pButtonMenu->exec(e->globalPosition().toPoint());
#else
m_pButtonMenu->exec(e->globalPos());
#endif
return;
}

Expand Down
20 changes: 20 additions & 0 deletions src/widget/woverview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,17 @@ void WOverview::receiveCuesUpdated() {
void WOverview::mouseMoveEvent(QMouseEvent* e) {
if (m_bLeftClickDragging) {
if (m_orientation == Qt::Horizontal) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_iPickupPos = math_clamp(e->position().x(), 0, width() - 1);
#else
m_iPickupPos = math_clamp(e->x(), 0, width() - 1);
#endif
} else {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_iPickupPos = math_clamp(e->position().y(), 0, height() - 1);
#else
m_iPickupPos = math_clamp(e->y(), 0, height() - 1);
#endif
}
}

Expand Down Expand Up @@ -500,9 +508,17 @@ void WOverview::mousePressEvent(QMouseEvent* e) {
}
if (e->button() == Qt::LeftButton) {
if (m_orientation == Qt::Horizontal) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_iPickupPos = math_clamp(e->position().x(), 0, width() - 1);
#else
m_iPickupPos = math_clamp(e->x(), 0, width() - 1);
#endif
} else {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_iPickupPos = math_clamp(e->position().y(), 0, height() - 1);
#else
m_iPickupPos = math_clamp(e->y(), 0, height() - 1);
#endif
}

if (m_pHoveredMark != nullptr) {
Expand Down Expand Up @@ -544,7 +560,11 @@ void WOverview::mousePressEvent(QMouseEvent* e) {
return;
} else {
m_pCueMenuPopup->setTrackAndCue(m_pCurrentTrack, pHoveredCue);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_pCueMenuPopup->popup(e->globalPosition().toPoint());
#else
m_pCueMenuPopup->popup(e->globalPos());
#endif
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/widget/wspinny.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,13 @@ void WSpinny::updateSlipEnabled(double enabled) {
}

void WSpinny::mouseMoveEvent(QMouseEvent * e) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
int y = e->position().y();
int x = e->position().x();
#else
int y = e->y();
int x = e->x();
#endif

// Keeping these around in case we want to switch to control relative
// to the original mouse position.
Expand Down Expand Up @@ -653,7 +658,11 @@ void WSpinny::mousePressEvent(QMouseEvent * e) {
if (!m_loadedCover.isNull()) {
m_pDlgCoverArt->init(m_loadedTrack);
} else if (!m_pDlgCoverArt->isVisible() && m_bShowCover) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_pCoverMenu->popup(e->globalPosition().toPoint());
#else
m_pCoverMenu->popup(e->globalPos());
#endif
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/widget/wstarrating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ void WStarRating::mouseMoveEvent(QMouseEvent *event) {
}

m_focused = true;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
int star = starAtPosition(event->position().x());
#else
int star = starAtPosition(event->x());
#endif

if (star != m_starRating.starCount() && star != -1) {
m_starRating.setStarCount(star);
Expand Down
4 changes: 4 additions & 0 deletions src/widget/wtrackproperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ void WTrackProperty::contextMenuEvent(QContextMenuEvent* event) {
if (m_pCurrentTrack) {
m_pTrackMenu->loadTrack(m_pCurrentTrack, m_group);
// Create the right-click menu
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_pTrackMenu->popup(event->globalPosition().toPoint());
#else
m_pTrackMenu->popup(event->globalPos());
#endif
}
}
4 changes: 4 additions & 0 deletions src/widget/wtracktableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,11 @@ void WTrackTableView::contextMenuEvent(QContextMenuEvent* event) {
m_pTrackMenu->loadTrackModelIndices(indices);

//Create the right-click menu
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_pTrackMenu->popup(event->globalPosition().toPoint());
#else
m_pTrackMenu->popup(event->globalPos());
#endif
}

void WTrackTableView::onSearch(const QString& text) {
Expand Down
4 changes: 4 additions & 0 deletions src/widget/wtracktableviewheader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ WTrackTableViewHeader::WTrackTableViewHeader(Qt::Orientation orientation,
}

void WTrackTableViewHeader::contextMenuEvent(QContextMenuEvent* event) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_menu.popup(event->globalPosition().toPoint());
#else
m_menu.popup(event->globalPos());
#endif
}

void WTrackTableViewHeader::setModel(QAbstractItemModel* model) {
Expand Down
4 changes: 4 additions & 0 deletions src/widget/wtracktext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ void WTrackText::contextMenuEvent(QContextMenuEvent* event) {
if (m_pCurrentTrack) {
m_pTrackMenu->loadTrack(m_pCurrentTrack, m_group);
// Create the right-click menu
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_pTrackMenu->popup(event->globalPosition().toPoint());
#else
m_pTrackMenu->popup(event->globalPos());
#endif
}
}
4 changes: 4 additions & 0 deletions src/widget/wtrackwidgetgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ void WTrackWidgetGroup::contextMenuEvent(QContextMenuEvent* event) {
if (m_pCurrentTrack) {
m_pTrackMenu->loadTrack(m_pCurrentTrack, m_group);
// Create the right-click menu
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_pTrackMenu->popup(event->globalPosition().toPoint());
#else
m_pTrackMenu->popup(event->globalPos());
#endif
}
}
4 changes: 4 additions & 0 deletions src/widget/wwaveformviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ void WWaveformViewer::mousePressEvent(QMouseEvent* event) {
auto cueAtClickPos = getCuePointerFromCueMark(m_pHoveredMark);
if (cueAtClickPos) {
m_pCueMenuPopup->setTrackAndCue(currentTrack, cueAtClickPos);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_pCueMenuPopup->popup(event->globalPosition().toPoint());
#else
m_pCueMenuPopup->popup(event->globalPos());
#endif
}
} else {
// If we are scratching then disable and reset because the two shouldn't
Expand Down