From ab8ea993b3320ec917ba9cece14a3ea911aad3cf Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Thu, 1 Jun 2017 11:35:38 +0200 Subject: [PATCH] qpa: start using QT_DEPRECATED_SINCE to increase visibility ... when platform plugins are using compatibility APIs. Even though QPA is not a public API and does not promise source/binary compatibility, we still try to not break things when possible. Eventually deprectated APIs will be dropped (e.g between major Qt versions). Having deprecation warnings here would help maintainers to notice API changes even before their code stops compiling due to removed QPA APIs. This will also ensure that we won't forget to remove compatibility APIs. Change-Id: If13786eb7d42a595708ace00b2ddea5209df18db Reviewed-by: Shawn Rutledge --- src/gui/kernel/qwindowsysteminterface.cpp | 7 +++++++ src/gui/kernel/qwindowsysteminterface.h | 25 +++++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index f1f74e1342..dfad6bc2d8 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -445,9 +445,13 @@ QWindowSystemInterfacePrivate::WheelEvent::WheelEvent(QWindow *window, ulong tim { } +#if QT_DEPRECATED_SINCE(5, 10) void QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods) { unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED handleWheelEvent(window, time, local, global, d, o, mods); +QT_WARNING_POP } void QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods) @@ -455,6 +459,7 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, QPoint point = (o == Qt::Vertical) ? QPoint(0, d) : QPoint(d, 0); handleWheelEvent(window, timestamp, local, global, QPoint(), point, mods); } +#endif // QT_DEPRECATED_SINCE(5, 10) void QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source) { @@ -768,6 +773,7 @@ void QWindowSystemInterface::handleTabletEvent(QWindow *window, const QPointF &l xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers); } +#if QT_DEPRECATED_SINCE(5, 10) void QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp, bool down, const QPointF &local, const QPointF &global, int device, int pointerType, qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, qreal rotation, int z, qint64 uid, @@ -785,6 +791,7 @@ void QWindowSystemInterface::handleTabletEvent(QWindow *window, bool down, const handleTabletEvent(window, local, global, device, pointerType, (down ? Qt::LeftButton : Qt::NoButton), pressure, xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers); } +#endif // QT_DEPRECATED_SINCE(5, 10) void QWindowSystemInterface::handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid) { diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index d3dd5ac2e9..bf3a9a6886 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -121,9 +121,10 @@ public: Qt::MouseEventSource source = Qt::MouseEventNotSynthesized, bool inverted = false); - // Wheel event compatibility functions. Will be removed: do not use. - static void handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier); - static void handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier); +#if QT_DEPRECATED_SINCE(5, 10) + QT_DEPRECATED static void handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier); + QT_DEPRECATED static void handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier); +#endif struct TouchPoint { TouchPoint() : id(0), uniqueId(-1), pressure(0), rotation(0), state(Qt::TouchPointStationary) { } @@ -208,14 +209,16 @@ public: int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, qreal rotation, int z, qint64 uid, Qt::KeyboardModifiers modifiers = Qt::NoModifier); - static void handleTabletEvent(QWindow *window, ulong timestamp, bool down, const QPointF &local, const QPointF &global, - int device, int pointerType, qreal pressure, int xTilt, int yTilt, - qreal tangentialPressure, qreal rotation, int z, qint64 uid, - Qt::KeyboardModifiers modifiers = Qt::NoModifier); // ### remove in Qt 6 - static void handleTabletEvent(QWindow *window, bool down, const QPointF &local, const QPointF &global, - int device, int pointerType, qreal pressure, int xTilt, int yTilt, - qreal tangentialPressure, qreal rotation, int z, qint64 uid, - Qt::KeyboardModifiers modifiers = Qt::NoModifier); // ### remove in Qt 6 +#if QT_DEPRECATED_SINCE(5, 10) + QT_DEPRECATED static void handleTabletEvent(QWindow *window, ulong timestamp, bool down, const QPointF &local, const QPointF &global, + int device, int pointerType, qreal pressure, int xTilt, int yTilt, + qreal tangentialPressure, qreal rotation, int z, qint64 uid, + Qt::KeyboardModifiers modifiers = Qt::NoModifier); + QT_DEPRECATED static void handleTabletEvent(QWindow *window, bool down, const QPointF &local, const QPointF &global, + int device, int pointerType, qreal pressure, int xTilt, int yTilt, + qreal tangentialPressure, qreal rotation, int z, qint64 uid, + Qt::KeyboardModifiers modifiers = Qt::NoModifier); +#endif static void handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid); static void handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid); static void handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);