diff --git a/src/util/scopedoverridecursor.h b/src/util/scopedoverridecursor.h index af08eb50d3d..1287cd0c17c 100644 --- a/src/util/scopedoverridecursor.h +++ b/src/util/scopedoverridecursor.h @@ -1,16 +1,16 @@ #pragma once -#include +#include class ScopedOverrideCursor { public: inline explicit ScopedOverrideCursor(const QCursor& cursor) { - QApplication::setOverrideCursor(cursor); - QApplication::processEvents(); + QGuiApplication::setOverrideCursor(cursor); + QCoreApplication::processEvents(); } inline virtual ~ScopedOverrideCursor() { - QApplication::restoreOverrideCursor(); + QGuiApplication::restoreOverrideCursor(); } }; diff --git a/src/widget/knobeventhandler.h b/src/widget/knobeventhandler.h index 5ab63c85df9..348f4977005 100644 --- a/src/widget/knobeventhandler.h +++ b/src/widget/knobeventhandler.h @@ -4,7 +4,6 @@ #include #include #include -#include #include #include @@ -21,8 +20,9 @@ class KnobEventHandler { } double valueFromMouseEvent(T* pWidget, QMouseEvent* e) { - QPoint cur(e->globalPos()); - QPoint diff(cur - m_prevPos); + QPoint cur = e->globalPos(); + QPoint diff = cur - m_prevPos; + m_prevPos = cur; double dist = sqrt(static_cast(diff.x() * diff.x() + diff.y() * diff.y())); bool y_dominant = abs(diff.y()) > abs(diff.x()); @@ -47,7 +47,6 @@ class KnobEventHandler { double value = valueFromMouseEvent(pWidget, e); pWidget->setControlParameterDown(value); pWidget->inputActivity(); - m_prevPos = e->globalPos(); } } @@ -63,7 +62,7 @@ class KnobEventHandler { m_prevPos = m_startPos; // Somehow using Qt::BlankCursor does not work on Windows // https://mixxx.org/forums/viewtopic.php?p=40298#p40298 - QApplication::setOverrideCursor(m_blankCursor); + pWidget->setCursor(m_blankCursor); break; default: break; @@ -76,7 +75,7 @@ class KnobEventHandler { case Qt::LeftButton: case Qt::MiddleButton: QCursor::setPos(m_startPos); - QApplication::restoreOverrideCursor(); + pWidget->unsetCursor(); value = valueFromMouseEvent(pWidget, e); pWidget->setControlParameterUp(value); pWidget->inputActivity();