From a061a646429c6e9d695458fc0ecb0021a30e12ee Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 4 Jun 2020 18:07:06 +0200 Subject: Replace calls to deprecated QEvent accessor functions Many of these were generated by clazy using the new qevent-accessors check. Change-Id: Ie17af17f50fdc9f47d7859d267c14568cc350fd0 Reviewed-by: Volker Hilsheimer --- src/gui/kernel/qevent.cpp | 24 ++++++++++----------- src/gui/kernel/qguiapplication.cpp | 36 +++++++++++++++---------------- src/gui/kernel/qsimpledrag.cpp | 10 ++++----- src/gui/kernel/qwindowsysteminterface.cpp | 2 +- 4 files changed, 36 insertions(+), 36 deletions(-) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 95b6a49018..f7939f4986 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -40,7 +40,7 @@ #include "qevent.h" #include "qcursor.h" #include "private/qguiapplication_p.h" -#include "private/qtouchdevice_p.h" +#include "qtouchdevice.h" #include "qpa/qplatformintegration.h" #include "private/qevent_p.h" #include "qfile.h" @@ -3585,13 +3585,13 @@ static void formatDropEvent(QDebug d, const QDropEvent *e) d << ", possibleActions="; QtDebugUtils::formatQFlags(d, e->possibleActions()); d << ", posF="; - QtDebugUtils::formatQPoint(d, e->posF()); + QtDebugUtils::formatQPoint(d, e->position()); if (type == QEvent::DragMove || type == QEvent::DragEnter) d << ", answerRect=" << static_cast(e)->answerRect(); d << ", formats=" << e->mimeData()->formats(); - QtDebugUtils::formatNonNullQFlags(d, ", keyboardModifiers=", e->keyboardModifiers()); + QtDebugUtils::formatNonNullQFlags(d, ", keyboardModifiers=", e->modifiers()); d << ", "; - QtDebugUtils::formatQFlags(d, e->mouseButtons()); + QtDebugUtils::formatQFlags(d, e->buttons()); } # endif // QT_CONFIG(draganddrop) @@ -3609,7 +3609,7 @@ static void formatTabletEvent(QDebug d, const QTabletEvent *e) d << ", pointerType="; QtDebugUtils::formatQEnum(d, e->pointerType()); d << ", uniqueId=" << e->uniqueId() - << ", pos=" << e->posF() + << ", pos=" << e->position() << ", z=" << e->z() << ", xTilt=" << e->xTilt() << ", yTilt=" << e->yTilt() @@ -3630,7 +3630,7 @@ QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &tp) QDebugStateSaver saver(dbg); dbg.nospace(); dbg << "TouchPoint(" << Qt::hex << tp.id() << Qt::dec << " ("; - QtDebugUtils::formatQPoint(dbg, tp.pos()); + QtDebugUtils::formatQPoint(dbg, tp.position()); dbg << ") "; QtDebugUtils::formatQEnum(dbg, tp.state()); dbg << " pressure " << tp.pressure() << " ellipse (" @@ -3638,11 +3638,11 @@ QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &tp) << " angle " << tp.rotation() << ") vel ("; QtDebugUtils::formatQPoint(dbg, tp.velocity().toPointF()); dbg << ") start ("; - QtDebugUtils::formatQPoint(dbg, tp.startPos()); + QtDebugUtils::formatQPoint(dbg, tp.pressPosition()); dbg << ") last ("; QtDebugUtils::formatQPoint(dbg, tp.lastPos()); dbg << ") delta ("; - QtDebugUtils::formatQPoint(dbg, tp.pos() - tp.lastPos()); + QtDebugUtils::formatQPoint(dbg, tp.position() - tp.lastPos()); dbg << ')'; return dbg; } @@ -3688,9 +3688,9 @@ QDebug operator<<(QDebug dbg, const QEvent *e) } QtDebugUtils::formatNonNullQFlags(dbg, ", ", me->modifiers()); dbg << ", localPos="; - QtDebugUtils::formatQPoint(dbg, me->localPos()); + QtDebugUtils::formatQPoint(dbg, me->position()); dbg << ", screenPos="; - QtDebugUtils::formatQPoint(dbg, me->screenPos()); + QtDebugUtils::formatQPoint(dbg, me->globalPosition()); QtDebugUtils::formatNonNullQEnum(dbg, ", ", me->source()); QtDebugUtils::formatNonNullQFlags(dbg, ", flags=", me->flags()); dbg << ')'; @@ -3791,7 +3791,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e) dbg << "QNativeGestureEvent("; QtDebugUtils::formatQEnum(dbg, ne->gestureType()); dbg << ", localPos="; - QtDebugUtils::formatQPoint(dbg, ne->localPos()); + QtDebugUtils::formatQPoint(dbg, ne->position()); dbg << ", value=" << ne->value() << ')'; } break; @@ -3816,7 +3816,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e) break; # endif // QT_CONFIG(tabletevent) case QEvent::Enter: - dbg << "QEnterEvent(" << static_cast(e)->pos() << ')'; + dbg << "QEnterEvent(" << static_cast(e)->position() << ')'; break; case QEvent::Timer: dbg << "QTimerEvent(id=" << static_cast(e)->timerId() << ')'; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index cde21dc8dd..a1e5da4a32 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2842,15 +2842,15 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To if (!w) { // determine which window this event will go to if (!window) - window = QGuiApplication::topLevelAt(touchPoint.screenPos().toPoint()); + window = QGuiApplication::topLevelAt(touchPoint.globalPosition().toPoint()); if (!window) continue; w = window; } touchInfo.window = w; - touchPoint.d->startScreenPos = touchPoint.screenPos(); - touchPoint.d->lastScreenPos = touchPoint.screenPos(); + touchPoint.d->startScreenPos = touchPoint.globalPosition(); + touchPoint.d->lastScreenPos = touchPoint.globalPosition(); touchPoint.d->startNormalizedPos = touchPoint.normalizedPos(); touchPoint.d->lastNormalizedPos = touchPoint.normalizedPos(); if (touchPoint.pressure() < qreal(0.)) @@ -2865,10 +2865,10 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To continue; previousTouchPoint = touchInfo.touchPoint; - touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos(); - touchPoint.d->lastScreenPos = previousTouchPoint.screenPos(); - touchPoint.d->startPos = previousTouchPoint.startPos(); - touchPoint.d->lastPos = previousTouchPoint.pos(); + touchPoint.d->startScreenPos = previousTouchPoint.globalPressPosition(); + touchPoint.d->lastScreenPos = previousTouchPoint.globalPosition(); + touchPoint.d->startPos = previousTouchPoint.pressPosition(); + touchPoint.d->lastPos = previousTouchPoint.position(); touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos(); touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos(); if (touchPoint.pressure() < qreal(0.)) @@ -2882,10 +2882,10 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To continue; previousTouchPoint = touchInfo.touchPoint; - touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos(); - touchPoint.d->lastScreenPos = previousTouchPoint.screenPos(); - touchPoint.d->startPos = previousTouchPoint.startPos(); - touchPoint.d->lastPos = previousTouchPoint.pos(); + touchPoint.d->startScreenPos = previousTouchPoint.globalPressPosition(); + touchPoint.d->lastScreenPos = previousTouchPoint.globalPosition(); + touchPoint.d->startPos = previousTouchPoint.pressPosition(); + touchPoint.d->lastPos = previousTouchPoint.position(); touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos(); touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos(); if (touchPoint.pressure() < qreal(0.)) @@ -2916,8 +2916,8 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To // Note: touchPoint is a reference to the one from activeTouchPoints, // so we can modify it as long as we're careful NOT to call setters and // otherwise NOT to cause the d-pointer to be detached. - touchPoint.d->scenePos = touchPoint.screenPos(); - touchPoint.d->startScenePos = touchPoint.startScreenPos(); + touchPoint.d->scenePos = touchPoint.globalPosition(); + touchPoint.d->startScenePos = touchPoint.globalPressPosition(); touchPoint.d->lastScenePos = touchPoint.lastScreenPos(); StatesAndTouchPoints &maskAndPoints = windowsNeedingEvents[w.data()]; @@ -2981,7 +2981,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To QTouchEvent::TouchPoint &touchPoint = touchEvent._touchPoints[i]; // preserve the sub-pixel resolution - const QPointF screenPos = touchPoint.screenPos(); + const QPointF screenPos = touchPoint.globalPosition(); const QPointF delta = screenPos - screenPos.toPoint(); touchPoint.d->pos = w->mapFromGlobal(screenPos.toPoint()) + delta; @@ -2989,7 +2989,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To // touchPoint is actually a reference to one that is stored in activeTouchPoints, // and we are now going to store the startPos and lastPos there, for the benefit // of future moves and releases. It's important that the d-pointer is NOT detached. - touchPoint.d->startPos = w->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta; + touchPoint.d->startPos = w->mapFromGlobal(touchPoint.globalPressPosition().toPoint()) + delta; touchPoint.d->lastPos = w->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta; } } @@ -3023,12 +3023,12 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To if (touchPoint.id() == m_fakeMouseSourcePointId) { if (eventType != QEvent::TouchEnd) self->synthesizedMousePoints.insert(w, SynthesizedMouseData( - touchPoint.pos(), touchPoint.screenPos(), w)); + touchPoint.position(), touchPoint.globalPosition(), w)); // All touch events that are not accepted by the application will be translated to // left mouse button events instead (see AA_SynthesizeMouseForUnhandledTouchEvents docs). QWindowSystemInterfacePrivate::MouseEvent fake(w, e->timestamp, - touchPoint.pos(), - touchPoint.screenPos(), + touchPoint.position(), + touchPoint.globalPosition(), buttons, e->modifiers, button, diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index 55e92d2a5d..58fdf7a2c3 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -114,7 +114,7 @@ void QBasicDrag::disableEventFilter() static inline QPoint getNativeMousePos(QEvent *e, QWindow *window) { - return QHighDpi::toNativePixels(static_cast(e)->globalPos(), window); + return QHighDpi::toNativePixels(static_cast(e)->globalPosition().toPoint(), window); } bool QBasicDrag::eventFilter(QObject *o, QEvent *e) @@ -176,13 +176,13 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e) // If there is no such window (belonging to this Qt application), // make the event relative to the window where the drag started. (QTBUG-66103) const QMouseEvent *release = static_cast(e); - const QWindow *releaseWindow = topLevelAt(release->globalPos()); - qCDebug(lcDnd) << "mouse released over" << releaseWindow << "after drag from" << m_sourceWindow << "globalPos" << release->globalPos(); + const QWindow *releaseWindow = topLevelAt(release->globalPosition().toPoint()); + qCDebug(lcDnd) << "mouse released over" << releaseWindow << "after drag from" << m_sourceWindow << "globalPos" << release->globalPosition().toPoint(); if (!releaseWindow) releaseWindow = m_sourceWindow; - QPoint releaseWindowPos = (releaseWindow ? releaseWindow->mapFromGlobal(release->globalPos()) : release->globalPos()); + QPoint releaseWindowPos = (releaseWindow ? releaseWindow->mapFromGlobal(release->globalPosition().toPoint()) : release->globalPosition().toPoint()); QMouseEvent *newRelease = new QMouseEvent(release->type(), - releaseWindowPos, releaseWindowPos, release->screenPos(), + releaseWindowPos, releaseWindowPos, release->globalPosition(), release->button(), release->buttons(), release->modifiers(), release->source()); QCoreApplication::postEvent(o, newRelease); diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 42676fbf3e..5ad47d3866 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -709,7 +709,7 @@ QList p.flags = pt.flags(); p.normalPosition = QHighDpi::toNativeLocalPosition(pt.normalizedPos(), window); QRectF area(QPointF(), pt.ellipseDiameters()); - area.moveCenter(pt.screenPos()); + area.moveCenter(pt.globalPosition()); // TODO store ellipseDiameters in QWindowSystemInterface::TouchPoint or just use QTouchEvent::TouchPoint p.area = QHighDpi::toNativePixels(area, window); p.pressure = pt.pressure(); -- cgit v1.2.3