From 688e5da4e71cb5262fcd689e9067070b312a6fc4 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 10 Apr 2020 12:55:43 +0200 Subject: [PATCH] Remove obsolete storage, constructors and accessors in QEvent subclasses Change-Id: I5c51244031ff40f1972106ad4fe27010c8be1193 Reviewed-by: Volker Hilsheimer --- src/gui/kernel/qevent.cpp | 270 +--------------------- src/gui/kernel/qevent.h | 88 +------ src/gui/kernel/qguiapplication.cpp | 14 +- src/gui/kernel/qwindowsysteminterface.cpp | 83 +------ src/gui/kernel/qwindowsysteminterface.h | 40 +--- src/widgets/kernel/qapplication.cpp | 16 -- src/widgets/kernel/qwidgetwindow.cpp | 4 - 7 files changed, 14 insertions(+), 501 deletions(-) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 13a5bbb009..b91b2d63d8 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -655,7 +655,7 @@ QHoverEvent::~QHoverEvent() { } - +#if QT_CONFIG(wheelevent) /*! \class QWheelEvent \brief The QWheelEvent class contains parameters that describe a wheel event. @@ -743,106 +743,6 @@ QHoverEvent::~QHoverEvent() \l inverted always returns false. */ -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \fn Qt::Orientation QWheelEvent::orientation() const - \obsolete - - Use angleDelta() instead. -*/ -#endif - -#if QT_CONFIG(wheelevent) -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \obsolete - This constructor has been deprecated. -*/ -QWheelEvent::QWheelEvent(const QPointF &pos, int delta, - Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, - Qt::Orientation orient) - : QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons), - src(Qt::MouseEventNotSynthesized), invertedScrolling(false), ph(Qt::NoScrollPhase) -{ - g = QCursor::pos(); - if (orient == Qt::Vertical) - angleD = QPoint(0, delta); - else - angleD = QPoint(delta, 0); -} - -/*! - \obsolete - This constructor has been deprecated. -*/ -QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta, - Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, - Qt::Orientation orient) - : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons), - src(Qt::MouseEventNotSynthesized), invertedScrolling(false), ph(Qt::NoScrollPhase) -{ - if (orient == Qt::Vertical) - angleD = QPoint(0, delta); - else - angleD = QPoint(delta, 0); -} - -/*! - \obsolete - This constructor has been deprecated. -*/ -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED -QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, - QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, - Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) - : QWheelEvent(pos, globalPos, pixelDelta, angleDelta, qt4Delta, qt4Orientation, - buttons, modifiers, Qt::NoScrollPhase) -{} -QT_WARNING_POP - -/*! - \obsolete - This constructor has been deprecated. -*/ -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED -QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, - QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, - Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase) - : QWheelEvent(pos, globalPos, pixelDelta, angleDelta, qt4Delta, qt4Orientation, - buttons, modifiers, phase, Qt::MouseEventNotSynthesized) -{} -QT_WARNING_POP - -/*! - \obsolete - This constructor has been deprecated. -*/ - -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED -QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, - QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, - Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source) - : QWheelEvent(pos, globalPos, pixelDelta, angleDelta, qt4Delta, qt4Orientation, - buttons, modifiers, phase, source, false) -{} -QT_WARNING_POP - -/*! - \obsolete - This constructor has been deprecated. -*/ -QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, - QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, - Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source, bool inverted) - : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), - angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), src(source), - invertedScrolling(inverted), ph(phase) -{} -#endif // QT_DEPRECATED_SINCE(5, 15) - /*! Constructs a wheel event object. @@ -877,10 +777,8 @@ QWheelEvent::QWheelEvent(QPointF pos, QPointF globalPos, QPoint pixelDelta, QPoi Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, bool inverted, Qt::MouseEventSource source) : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), angleD(angleDelta), - qt4O(qAbs(angleDelta.x()) > qAbs(angleDelta.y()) ? Qt::Horizontal : Qt::Vertical), - mouseState(buttons), src(source), invertedScrolling(inverted), ph(phase) + mouseState(buttons), src(source), ph(phase), invertedScrolling(inverted) { - qt4D = (qt4O == Qt::Horizontal ? angleDelta.x() : angleDelta.y()); } /*! @@ -974,72 +872,6 @@ QWheelEvent::~QWheelEvent() \sa position() */ -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \fn int QWheelEvent::delta() const - \obsolete - - This function has been deprecated, use pixelDelta() or angleDelta() instead. -*/ - -/*! - \fn QPoint QWheelEvent::pos() const - \obsolete - - This function has been deprecated, use position() instead. -*/ - -/*! - \fn int QWheelEvent::x() const - \obsolete - - This function has been deprecated, use position() instead. -*/ - -/*! - \fn int QWheelEvent::y() const - \obsolete - - This function has been deprecated, use position() instead. -*/ - - -/*! - \fn QPoint QWheelEvent::globalPos() const - \obsolete - - This function has been deprecated, use globalPosition() instead. -*/ - -/*! - \fn int QWheelEvent::globalX() const - \obsolete - - This function has been deprecated, use globalPosition() instead. -*/ - -/*! - \fn int QWheelEvent::globalY() const - \obsolete - - This function has been deprecated, use globalPosition() instead. -*/ - -/*! - \fn const QPointF &QWheelEvent::posF() const - \obsolete - - This function has been deprecated, use position() instead. -*/ - -/*! - \fn const QPointF &QWheelEvent::globalPosF() const - \obsolete - - This function has been deprecated, use globalPosition() instead. -*/ -#endif - /*! \fn Qt::ScrollPhase QWheelEvent::phase() const \since 5.2 @@ -2637,18 +2469,6 @@ Qt::MouseButtons QTabletEvent::buttons() const \sa Qt::NativeGestureType, QGestureEvent */ -#if QT_DEPRECATED_SINCE(5, 10) -/*! - \deprecated The QTouchDevice parameter is now required -*/ -QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos, - const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue) - : QInputEvent(QEvent::NativeGesture), mGestureType(type), - mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue), - mSequenceId(sequenceId), mIntValue(intValue) -{ } -#endif - /*! Constructs a native gesture event of type \a type originating from \a device. @@ -3880,15 +3700,8 @@ QDebug operator<<(QDebug dbg, const QEvent *e) case QEvent::Wheel: { const QWheelEvent *we = static_cast(e); dbg << "QWheelEvent(" << we->phase(); -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED // delta() and orientation() if (!we->pixelDelta().isNull() || !we->angleDelta().isNull()) dbg << ", pixelDelta=" << we->pixelDelta() << ", angleDelta=" << we->angleDelta(); -#if QT_DEPRECATED_SINCE(5, 14) - else if (int qt4Delta = we->delta()) - dbg << ", delta=" << qt4Delta << ", orientation=" << we->orientation(); -#endif -QT_WARNING_POP dbg << ')'; } break; @@ -4573,47 +4386,6 @@ QPointF QTouchEvent::TouchPoint::lastNormalizedPos() const return d->lastNormalizedPos; } -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \deprecated This function is deprecated since 5.9 because it returns the outer bounds - of the touchpoint regardless of rotation, whereas a touchpoint is more correctly - modeled as an ellipse at position pos() with ellipseDiameters() - which are independent of rotation(). -*/ -QRectF QTouchEvent::TouchPoint::rect() const -{ - QRectF ret(QPointF(), d->ellipseDiameters); - ret.moveCenter(d->pos); - return ret; -} - -/*! - \deprecated This function is deprecated since 5.9 because it returns the outer bounds - of the touchpoint regardless of rotation, whereas a touchpoint is more correctly - modeled as an ellipse at position scenePos() with ellipseDiameters() - which are independent of rotation(). -*/ -QRectF QTouchEvent::TouchPoint::sceneRect() const -{ - QRectF ret(QPointF(), d->ellipseDiameters); - ret.moveCenter(d->scenePos); - return ret; -} - -/*! - \deprecated This function is deprecated since 5.9 because it returns the outer bounds of the - touchpoint regardless of rotation, whereas a touchpoint is more correctly - modeled as an ellipse at position screenPos() with ellipseDiameters() - which are independent of rotation(). -*/ -QRectF QTouchEvent::TouchPoint::screenRect() const -{ - QRectF ret(QPointF(), d->ellipseDiameters); - ret.moveCenter(d->screenPos); - return ret; -} -#endif - /*! Returns the pressure of this touch point. The return value is in the range 0.0 to 1.0. @@ -4811,42 +4583,6 @@ void QTouchEvent::TouchPoint::setLastNormalizedPos(const QPointF &lastNormalized d->lastNormalizedPos = lastNormalizedPos; } -#if QT_DEPRECATED_SINCE(5, 15) -// ### remove the following 3 setRect functions and their usages soon -/*! \internal - \obsolete -*/ -void QTouchEvent::TouchPoint::setRect(const QRectF &rect) -{ - if (d->ref.loadRelaxed() != 1) - d = d->detach(); - d->pos = rect.center(); - d->ellipseDiameters = rect.size(); -} - -/*! \internal - \obsolete -*/ -void QTouchEvent::TouchPoint::setSceneRect(const QRectF &sceneRect) -{ - if (d->ref.loadRelaxed() != 1) - d = d->detach(); - d->scenePos = sceneRect.center(); - d->ellipseDiameters = sceneRect.size(); -} - -/*! \internal - \obsolete -*/ -void QTouchEvent::TouchPoint::setScreenRect(const QRectF &screenRect) -{ - if (d->ref.loadRelaxed() != 1) - d = d->detach(); - d->screenPos = screenRect.center(); - d->ellipseDiameters = screenRect.size(); -} -#endif - /*! \internal */ void QTouchEvent::TouchPoint::setPressure(qreal pressure) { diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index fb1df36848..648b6f2077 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -173,35 +173,6 @@ class Q_GUI_EXPORT QWheelEvent : public QInputEvent public: enum { DefaultDeltasPerStep = 120 }; -#if QT_DEPRECATED_SINCE(5, 15) - // Actually deprecated since 5.0, in docs - QT_DEPRECATED_VERSION_X_5_15("Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted") - QWheelEvent(const QPointF &pos, int delta, - Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, - Qt::Orientation orient = Qt::Vertical); - // Actually deprecated since 5.0, in docs - QT_DEPRECATED_VERSION_X_5_15("Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted") - QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta, - Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, - Qt::Orientation orient = Qt::Vertical); - QT_DEPRECATED_VERSION_X_5_15("Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted") - QWheelEvent(const QPointF &pos, const QPointF& globalPos, - QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, - Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); - QT_DEPRECATED_VERSION_X_5_15("Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted") - QWheelEvent(const QPointF &pos, const QPointF& globalPos, - QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, - Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase); - QT_DEPRECATED_VERSION_X_5_15("Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted") - QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta, - int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, - Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source); - QT_DEPRECATED_VERSION_X_5_15("Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted") - QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta, - int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, - Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source, bool inverted); -#endif - QWheelEvent(QPointF pos, QPointF globalPos, QPoint pixelDelta, QPoint angleDelta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, bool inverted, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); @@ -211,33 +182,6 @@ public: inline QPoint pixelDelta() const { return pixelD; } inline QPoint angleDelta() const { return angleD; } -#if QT_DEPRECATED_SINCE(5, 15) - // Actually deprecated since 5.0, in docs - QT_DEPRECATED_VERSION_X_5_15("Use angleDelta()") - inline int delta() const { return qt4D; } - // Actually deprecated since 5.0, in docs - QT_DEPRECATED_VERSION_X_5_15("Use angleDelta()") - inline Qt::Orientation orientation() const { return qt4O; } -#ifndef QT_NO_INTEGER_EVENT_COORDINATES - QT_DEPRECATED_VERSION_X_5_15("Use position()") - inline QPoint pos() const { return p.toPoint(); } - QT_DEPRECATED_VERSION_X_5_15("Use globalPosition()") - inline QPoint globalPos() const { return g.toPoint(); } - QT_DEPRECATED_VERSION_X_5_15("Use position()") - inline int x() const { return int(p.x()); } - QT_DEPRECATED_VERSION_X_5_15("Use position()") - inline int y() const { return int(p.y()); } - QT_DEPRECATED_VERSION_X_5_15("Use globalPosition()") - inline int globalX() const { return int(g.x()); } - QT_DEPRECATED_VERSION_X_5_15("Use globalPosition()") - inline int globalY() const { return int(g.y()); } -#endif - QT_DEPRECATED_VERSION_X_5_15("Use position()") - inline const QPointF &posF() const { return p; } - QT_DEPRECATED_VERSION_X_5_15("Use globalPosition()") - inline const QPointF &globalPosF() const { return g; } -#endif // QT_DEPRECATED_SINCE(5, 15) - inline QPointF position() const { return p; } inline QPointF globalPosition() const { return g; } @@ -253,14 +197,11 @@ protected: QPointF g; QPoint pixelD; QPoint angleD; - int qt4D = 0; - Qt::Orientation qt4O = Qt::Vertical; - Qt::MouseButtons mouseState = Qt::NoButton; - uint _unused_ : 2; // Kept for binary compatibility + Qt::MouseButtons mouseState; uint src: 2; - bool invertedScrolling : 1; uint ph : 3; - int reserved : 24; + bool invertedScrolling : 1; + int reserved : 26; friend class QApplication; }; @@ -321,10 +262,6 @@ protected: class Q_GUI_EXPORT QNativeGestureEvent : public QInputEvent { public: -#if QT_DEPRECATED_SINCE(5, 10) - QT_DEPRECATED QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos, - const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument); -#endif QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *dev, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument); ~QNativeGestureEvent(); @@ -888,23 +825,6 @@ public: QPointF startNormalizedPos() const; QPointF lastNormalizedPos() const; -#if QT_DEPRECATED_SINCE(5, 15) - // All these are actually deprecated since 5.9, in docs - QT_DEPRECATED_VERSION_X_5_15("Use pos() and ellipseDiameters()") - QRectF rect() const; - QT_DEPRECATED_VERSION_X_5_15("Use scenePos() and ellipseDiameters()") - QRectF sceneRect() const; - QT_DEPRECATED_VERSION_X_5_15("Use screenPos() and ellipseDiameters()") - QRectF screenRect() const; - - // internal - QT_DEPRECATED_VERSION_X_5_15("Use setPos() and setEllipseDiameters()") - void setRect(const QRectF &rect); // deprecated - QT_DEPRECATED_VERSION_X_5_15("Use setScenePos() and setEllipseDiameters()") - void setSceneRect(const QRectF &sceneRect); // deprecated - QT_DEPRECATED_VERSION_X_5_15("Use setScreenPos() and setEllipseDiameters()") - void setScreenRect(const QRectF &screenRect); // deprecated -#endif qreal pressure() const; qreal rotation() const; QSizeF ellipseDiameters() const; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 8fe06c87e5..45df47730d 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2016 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** @@ -2302,16 +2302,8 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh return; } -#if QT_DEPRECATED_SINCE(5, 14) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - QWheelEvent ev(localPoint, globalPoint, e->pixelDelta, e->angleDelta, e->qt4Delta, e->qt4Orientation, - mouse_buttons, e->modifiers, e->phase, e->source, e->inverted); -QT_WARNING_POP -#else - QWheelEvent ev(localPoint, globalPoint, e->pixelDelta, e->angleDelta, - mouse_buttons, e->modifiers, e->phase, e->inverted, e->source); -#endif + QWheelEvent ev(localPoint, globalPoint, e->pixelDelta, e->angleDelta, + mouse_buttons, e->modifiers, e->phase, e->inverted, e->source); ev.setTimestamp(e->timestamp); QGuiApplication::sendSpontaneousEvent(window, &ev); #else diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 5658968de4..42676fbf3e 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -367,31 +367,6 @@ QT_DEFINE_QPA_EVENT_HANDLER(bool, handleCloseEvent, QWindow *window) \a w == 0 means that the event is in global coords only, \a local will be ignored in this case */ -#if QT_DEPRECATED_SINCE(5, 11) -QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, - Qt::KeyboardModifiers mods, Qt::MouseEventSource source) -{ - return handleMouseEvent(window, local, global, b, Qt::NoButton, QEvent::None, mods, source); -} - -QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, - Qt::KeyboardModifiers mods, Qt::MouseEventSource source) -{ - return handleMouseEvent(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source); -} - -bool QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, - Qt::KeyboardModifiers mods, Qt::MouseEventSource source) -{ - return handleFrameStrutMouseEvent(window, local, global, b, Qt::NoButton, QEvent::None, mods, source); -} - -bool QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, - Qt::KeyboardModifiers mods, Qt::MouseEventSource source) -{ - return handleFrameStrutMouseEvent(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source); -} -#endif // QT_DEPRECATED_SINCE(5, 11) QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons state, @@ -548,22 +523,6 @@ QWindowSystemInterfacePrivate::WheelEvent::WheelEvent(QWindow *window, ulong tim { } -#if QT_DEPRECATED_SINCE(5, 10) -bool 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 - return handleWheelEvent(window, time, local, global, d, o, mods); -QT_WARNING_POP -} - -bool QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods) -{ - QPoint point = (o == Qt::Vertical) ? QPoint(0, d) : QPoint(d, 0); - return handleWheelEvent(window, timestamp, local, global, QPoint(), point, mods); -} -#endif // QT_DEPRECATED_SINCE(5, 10) - bool QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source) { unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); @@ -688,7 +647,7 @@ QList p.setState(point->state); p.setScreenPos(QHighDpi::fromNativePixels(point->area.center(), window)); - p.setEllipseDiameters(point->area.size()); + p.setEllipseDiameters(QHighDpi::fromNativePixels(point->area.size(), window)); // The local pos and rect are not set, they will be calculated // when the event gets processed by QGuiApplication. @@ -751,6 +710,7 @@ QList p.normalPosition = QHighDpi::toNativeLocalPosition(pt.normalizedPos(), window); QRectF area(QPointF(), pt.ellipseDiameters()); area.moveCenter(pt.screenPos()); + // TODO store ellipseDiameters in QWindowSystemInterface::TouchPoint or just use QTouchEvent::TouchPoint p.area = QHighDpi::toNativePixels(area, window); p.pressure = pt.pressure(); p.state = pt.state(); @@ -899,23 +859,6 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleThemeChange, QWindow *window) } #if QT_CONFIG(draganddrop) -#if QT_DEPRECATED_SINCE(5, 11) -QPlatformDragQtResponse QWindowSystemInterface::handleDrag(QWindow *window, const QMimeData *dropData, - const QPoint &p, Qt::DropActions supportedActions) -{ - return QGuiApplicationPrivate::processDrag(window, dropData, p, supportedActions, - QGuiApplication::mouseButtons(), - QGuiApplication::keyboardModifiers()); -} - -QPlatformDropQtResponse QWindowSystemInterface::handleDrop(QWindow *window, const QMimeData *dropData, - const QPoint &p, Qt::DropActions supportedActions) -{ - return QGuiApplicationPrivate::processDrop(window, dropData, p, supportedActions, - QGuiApplication::mouseButtons(), - QGuiApplication::keyboardModifiers()); -} -#endif // QT_DEPRECATED_SINCE(5, 11) /*! Drag and drop events are sent immediately. @@ -997,26 +940,6 @@ bool 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, - Qt::KeyboardModifiers modifiers) -{ - handleTabletEvent(window, timestamp, local, global, device, pointerType, (down ? Qt::LeftButton : Qt::NoButton), pressure, - xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers); -} - -void QWindowSystemInterface::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) -{ - 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) - bool QWindowSystemInterface::handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid) { QWindowSystemInterfacePrivate::TabletEnterProximityEvent *e = diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index f7f1dc3f4d..1ea9fbaa1c 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -76,23 +76,6 @@ public: struct AsynchronousDelivery {}; struct DefaultDelivery {}; -#if QT_DEPRECATED_SINCE(5, 11) - template - QT_DEPRECATED static bool handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, - Qt::KeyboardModifiers mods = Qt::NoModifier, - Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); - template - QT_DEPRECATED static bool handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, - Qt::KeyboardModifiers mods = Qt::NoModifier, - Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); - - QT_DEPRECATED static bool handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, - Qt::KeyboardModifiers mods = Qt::NoModifier, - Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); - QT_DEPRECATED static bool handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, - Qt::KeyboardModifiers mods = Qt::NoModifier, - Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); -#endif template static bool handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type, @@ -148,11 +131,6 @@ public: Qt::MouseEventSource source = Qt::MouseEventNotSynthesized, bool inverted = false); -#if QT_DEPRECATED_SINCE(5, 10) - QT_DEPRECATED static bool handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier); - QT_DEPRECATED static bool 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) { } int id; // for application use @@ -219,12 +197,6 @@ public: static bool handleApplicationTermination(); #if QT_CONFIG(draganddrop) -#if QT_DEPRECATED_SINCE(5, 11) - QT_DEPRECATED static QPlatformDragQtResponse handleDrag(QWindow *window, const QMimeData *dropData, - const QPoint &p, Qt::DropActions supportedActions); - QT_DEPRECATED static QPlatformDropQtResponse handleDrop(QWindow *window, const QMimeData *dropData, - const QPoint &p, Qt::DropActions supportedActions); -#endif // #if QT_DEPRECATED_SINCE(5, 11) static QPlatformDragQtResponse handleDrag(QWindow *window, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); @@ -263,16 +235,6 @@ 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); -#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 bool handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid); static void handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid); static bool handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid); diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 1567f7173b..78eccc91d6 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3029,16 +3029,8 @@ bool QApplication::notify(QObject *receiver, QEvent *e) if (spontaneous && (phase == Qt::NoScrollPhase || phase == Qt::ScrollUpdate)) QApplicationPrivate::giveFocusAccordingToFocusPolicy(w, e, relpos); -#if QT_DEPRECATED_SINCE(5, 14) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(), - wheel->modifiers(), phase, wheel->source(), wheel->inverted()); -QT_WARNING_POP -#else QWheelEvent we(relpos, wheel->globalPosition(), wheel->pixelDelta(), wheel->angleDelta(), wheel->buttons(), wheel->modifiers(), phase, wheel->inverted(), wheel->source()); -#endif we.setTimestamp(wheel->timestamp()); bool eventAccepted; do { @@ -3074,16 +3066,8 @@ QT_WARNING_POP // sending those events until we get a ScrollEnd, which signifies // the end of the natural scrolling sequence. const QPoint &relpos = QApplicationPrivate::wheel_widget->mapFromGlobal(wheel->globalPosition().toPoint()); -#if QT_DEPRECATED_SINCE(5, 0) -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(), - wheel->modifiers(), wheel->phase(), wheel->source()); -QT_WARNING_POP -#else QWheelEvent we(relpos, wheel->globalPosition(), wheel->pixelDelta(), wheel->angleDelta(), wheel->buttons(), wheel->modifiers(), wheel->phase(), wheel->inverted(), wheel->source()); -#endif we.setTimestamp(wheel->timestamp()); we.spont = true; we.ignore(); diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 6d759abde0..f2d0fd9c55 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -863,12 +863,8 @@ void QWidgetWindow::handleWheelEvent(QWheelEvent *event) QPoint mapped = widget->mapFrom(rootWidget, pos); -#if QT_DEPRECATED_SINCE(5, 0) - QWheelEvent translated(mapped, event->globalPos(), event->pixelDelta(), event->angleDelta(), event->delta(), event->orientation(), event->buttons(), event->modifiers(), event->phase(), event->source(), event->inverted()); -#else QWheelEvent translated(QPointF(mapped), event->globalPosition(), event->pixelDelta(), event->angleDelta(), event->buttons(), event->modifiers(), event->phase(), event->inverted(), event->source()); -#endif translated.setTimestamp(event->timestamp()); QGuiApplication::forwardEvent(widget, &translated, event); }