diff --git a/src/widget/knobeventhandler.h b/src/widget/knobeventhandler.h index 6f3a38e60582..a5703a5d7941 100644 --- a/src/widget/knobeventhandler.h +++ b/src/widget/knobeventhandler.h @@ -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(diff.x() * diff.x() + diff.y() * diff.y())); bool y_dominant = abs(diff.y()) > abs(diff.x()); @@ -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 } } @@ -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 diff --git a/src/widget/slidereventhandler.h b/src/widget/slidereventhandler.h index a4baa9b8de98..d02155646a7e 100644 --- a/src/widget/slidereventhandler.h +++ b/src/widget/slidereventhandler.h @@ -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); @@ -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; } diff --git a/src/widget/wcoverart.cpp b/src/widget/wcoverart.cpp index ee8f8904d8f2..bde555c840a4 100644 --- a/src/widget/wcoverart.cpp +++ b/src/widget/wcoverart.cpp @@ -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 } } diff --git a/src/widget/wcoverartlabel.cpp b/src/widget/wcoverartlabel.cpp index 39dcba0ee817..69c881ea3651 100644 --- a/src/widget/wcoverartlabel.cpp +++ b/src/widget/wcoverartlabel.cpp @@ -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) { diff --git a/src/widget/weffectpushbutton.cpp b/src/widget/weffectpushbutton.cpp index fe79460de050..5e88efb61dfe 100644 --- a/src/widget/weffectpushbutton.cpp +++ b/src/widget/weffectpushbutton.cpp @@ -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; } diff --git a/src/widget/woverview.cpp b/src/widget/woverview.cpp index cd9ac5e41ce8..168418a859df 100644 --- a/src/widget/woverview.cpp +++ b/src/widget/woverview.cpp @@ -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 } } @@ -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) { @@ -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 } } } diff --git a/src/widget/wspinny.cpp b/src/widget/wspinny.cpp index d0c508f98af8..6a6881d1e8c9 100644 --- a/src/widget/wspinny.cpp +++ b/src/widget/wspinny.cpp @@ -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. @@ -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 } } } diff --git a/src/widget/wstarrating.cpp b/src/widget/wstarrating.cpp index 68e511b645b8..24c1d63f269b 100644 --- a/src/widget/wstarrating.cpp +++ b/src/widget/wstarrating.cpp @@ -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); diff --git a/src/widget/wtrackproperty.cpp b/src/widget/wtrackproperty.cpp index dfc9f3db5f7a..8fa7e386f0a8 100644 --- a/src/widget/wtrackproperty.cpp +++ b/src/widget/wtrackproperty.cpp @@ -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 } } diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index dc8522e314c6..92ee26bed0ae 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -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) { diff --git a/src/widget/wtracktableviewheader.cpp b/src/widget/wtracktableviewheader.cpp index fae519c629e4..33df6c896a3f 100644 --- a/src/widget/wtracktableviewheader.cpp +++ b/src/widget/wtracktableviewheader.cpp @@ -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) { diff --git a/src/widget/wtracktext.cpp b/src/widget/wtracktext.cpp index 93db0d62ff9c..5d78c4acf412 100644 --- a/src/widget/wtracktext.cpp +++ b/src/widget/wtracktext.cpp @@ -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 } } diff --git a/src/widget/wtrackwidgetgroup.cpp b/src/widget/wtrackwidgetgroup.cpp index ebdb9adfd3a3..aa0ed773f683 100644 --- a/src/widget/wtrackwidgetgroup.cpp +++ b/src/widget/wtrackwidgetgroup.cpp @@ -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 } } diff --git a/src/widget/wwaveformviewer.cpp b/src/widget/wwaveformviewer.cpp index 53ca7822a899..75683ba5d440 100644 --- a/src/widget/wwaveformviewer.cpp +++ b/src/widget/wwaveformviewer.cpp @@ -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