Initial cleanup of qevent.h for Qt6

Takes care of the first round of todos and deprecations for Qt6 in
qevent.

Not touching anything that might interfere with changing the class
hierarchy as the file also suggest.

Change-Id: If72d63d8932f1af588785bf77b34532358639a63
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2020-02-14 16:21:52 +01:00
parent 73301b252a
commit eb09b7aa75
15 changed files with 34 additions and 141 deletions

View File

@ -2368,52 +2368,6 @@ QTabletEvent::QTabletEvent(Type type, const QPointF &pos, const QPointF &globalP
{
}
#if QT_DEPRECATED_SINCE(5, 15)
/*!
Construct a tablet event of the given \a type.
The \a pos parameter indicates where the event occurred in the
widget; \a globalPos is the corresponding position in absolute
coordinates.
\a pressure contains the pressure exerted on the \a device.
\a pointerType describes the type of pen that is being used.
\a xTilt and \a yTilt contain the device's degree of tilt from the
x and y axes respectively.
\a keyState specifies which keyboard modifiers are pressed (e.g.,
\uicontrol{Ctrl}).
The \a uniqueID parameter contains the unique ID for the current device.
The \a z parameter contains the coordinate of the device on the tablet, this
is usually given by a wheel on 4D mouse. If the device does not support a
Z-axis, pass zero here.
The \a tangentialPressure parameter contins the tangential pressure of an air
brush. If the device does not support tangential pressure, pass 0 here.
\a rotation contains the device's rotation in degrees. 4D mice support
rotation. If the device does not support rotation, pass 0 here.
\sa pos(), globalPos(), device(), pressure(), xTilt(), yTilt(), uniqueId(), rotation(),
tangentialPressure(), z()
\deprecated in 5.4: use the constructor with MouseButton status
*/
QTabletEvent::QTabletEvent(Type type, const QPointF &pos, const QPointF &globalPos,
int device, int pointerType,
qreal pressure, int xTilt, int yTilt, qreal tangentialPressure,
qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID)
: QTabletEvent(type, pos, globalPos, device, pointerType, pressure, xTilt, yTilt,
tangentialPressure, rotation, z, keyState, uniqueID, Qt::NoButton, Qt::NoButton)
{
}
#endif
/*!
\internal
*/
@ -2450,12 +2404,6 @@ Qt::MouseButtons QTabletEvent::buttons() const
return static_cast<QTabletEventPrivate *>(mExtra)->buttonState;
}
/*!
\fn TabletDevices QTabletEvent::device() const
\deprecated Use deviceType().
*/
/*!
\fn TabletDevices QTabletEvent::deviceType() const
@ -2584,7 +2532,7 @@ Qt::MouseButtons QTabletEvent::buttons() const
Returns the global x position of the mouse pointer at the time of
the event.
\sa globalY(), globalPos(), hiResGlobalX()
\sa globalY(), globalPos()
*/
/*!
@ -2593,7 +2541,7 @@ Qt::MouseButtons QTabletEvent::buttons() const
Returns the global y position of the tablet device at the time of
the event.
\sa globalX(), globalPos(), hiResGlobalY()
\sa globalX(), globalPos()
*/
/*!
@ -2619,22 +2567,6 @@ Qt::MouseButtons QTabletEvent::buttons() const
\sa pointerType()
*/
/*!
\fn qreal &QTabletEvent::hiResGlobalX() const
The high precision x position of the tablet device.
\obsolete use globalPosF()
*/
/*!
\fn qreal &QTabletEvent::hiResGlobalY() const
The high precision y position of the tablet device.
\obsolete use globalPosF()
*/
/*!
\fn const QPointF &QTabletEvent::posF() const
@ -5018,9 +4950,8 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
The \a startPos is the position of a touch or mouse event that started the scrolling.
*/
QScrollPrepareEvent::QScrollPrepareEvent(const QPointF &startPos)
: QEvent(QEvent::ScrollPrepare), m_target(nullptr), m_startPos(startPos)
: QEvent(QEvent::ScrollPrepare), m_startPos(startPos)
{
Q_UNUSED(m_target);
}
/*!

View File

@ -41,31 +41,31 @@
#define QEVENT_H
#include <QtGui/qtguiglobal.h>
#include <QtGui/qwindowdefs.h>
#include <QtGui/qregion.h>
#include <QtCore/qcoreevent.h>
#include <QtCore/qiodevice.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qstring.h>
#include <QtCore/qvariant.h>
#include <QtCore/qvector.h>
#include <QtCore/qurl.h>
#include <QtGui/qregion.h>
#include <QtGui/qvector2d.h>
#include <QtGui/qwindowdefs.h>
#if QT_CONFIG(shortcut)
# include <QtGui/qkeysequence.h>
#endif
#include <QtCore/qcoreevent.h>
#include <QtCore/qvariant.h>
#include <QtCore/qmap.h> // ### Qt 6: Remove
#include <QtCore/qvector.h>
#include <QtCore/qset.h> // ### Qt 6: Remove
#include <QtCore/qurl.h>
#include <QtCore/qfile.h> // ### Qt 6: Replace by <QtCore/qiodevice.h> and forward declare QFile
#include <QtGui/qvector2d.h>
#include <QtGui/qtouchdevice.h> // ### Qt 6: Replace by forward declaration
QT_BEGIN_NAMESPACE
class QFile;
class QGuiAction;
#ifndef QT_NO_GESTURES
class QScreen;
class QTouchDevice;
#if QT_CONFIG(gestures)
class QGesture;
#endif
class QScreen;
class Q_GUI_EXPORT QInputEvent : public QEvent
{
@ -136,10 +136,6 @@ public:
inline void setLocalPos(const QPointF &localPosition) { l = localPosition; }
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline QPointF posF() const { return l; }
#endif
Qt::MouseEventSource source() const;
Qt::MouseEventFlags flags() const;
@ -281,14 +277,6 @@ public:
enum PointerType { UnknownPointer, Pen, Cursor, Eraser };
Q_ENUM(PointerType)
#if QT_DEPRECATED_SINCE(5, 15)
// Actually deprecated since 5.4, in docs
QT_DEPRECATED_VERSION_X_5_15("Use the other QTabletEvent constructor")
QTabletEvent(Type t, const QPointF &pos, const QPointF &globalPos,
int device, int pointerType, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z,
Qt::KeyboardModifiers keyState, qint64 uniqueID); // ### remove in Qt 6
#endif
QTabletEvent(Type t, const QPointF &pos, const QPointF &globalPos,
int device, int pointerType, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z,
@ -298,9 +286,6 @@ public:
inline QPoint pos() const { return mPos.toPoint(); }
inline QPoint globalPos() const { return mGPos.toPoint(); }
#if QT_DEPRECATED_SINCE(5,0)
QT_DEPRECATED inline const QPointF &hiResGlobalPos() const { return mPos; }
#endif
inline const QPointF &posF() const { return mPos; }
inline const QPointF &globalPosF() const { return mGPos; }
@ -309,14 +294,6 @@ public:
inline int y() const { return qRound(mPos.y()); }
inline int globalX() const { return qRound(mGPos.x()); }
inline int globalY() const { return qRound(mGPos.y()); }
#if QT_DEPRECATED_SINCE(5, 15)
QT_DEPRECATED_VERSION_X_5_15("use globalPosF().x()")
inline qreal hiResGlobalX() const { return mGPos.x(); }
QT_DEPRECATED_VERSION_X_5_15("use globalPosF().y()")
inline qreal hiResGlobalY() const { return mGPos.y(); }
QT_DEPRECATED_VERSION_X_5_15("Use deviceType()")
inline TabletDevice device() const { return TabletDevice(mDev); }
#endif
inline TabletDevice deviceType() const { return TabletDevice(mDev); }
inline PointerType pointerType() const { return PointerType(mPointerType); }
inline qint64 uniqueId() const { return mUnique; }
@ -341,7 +318,7 @@ protected:
};
#endif // QT_CONFIG(tabletevent)
#ifndef QT_NO_GESTURES
#if QT_CONFIG(gestures)
class Q_GUI_EXPORT QNativeGestureEvent : public QInputEvent
{
public:
@ -375,7 +352,7 @@ protected:
quint64 mIntValue;
const QTouchDevice *mDevice;
};
#endif // QT_NO_GESTURES
#endif // QT_CONFIG(gestures)
class Q_GUI_EXPORT QKeyEvent : public QInputEvent
{
@ -400,22 +377,6 @@ public:
inline quint32 nativeVirtualKey() const { return nVirtualKey; }
inline quint32 nativeModifiers() const { return nModifiers; }
// Functions for the extended key event information
#if QT_DEPRECATED_SINCE(5, 0)
static inline QKeyEvent *createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
quint32 nativeScanCode, quint32 nativeVirtualKey,
quint32 nativeModifiers,
const QString& text = QString(), bool autorep = false,
ushort count = 1)
{
return new QKeyEvent(type, key, modifiers,
nativeScanCode, nativeVirtualKey, nativeModifiers,
text, autorep, count);
}
inline bool hasExtendedInfo() const { return true; }
#endif
protected:
QString txt;
int k;
@ -976,13 +937,6 @@ public:
friend class QQuickMultiPointTouchArea;
};
#if QT_DEPRECATED_SINCE(5, 0)
enum DeviceType {
TouchScreen,
TouchPad
};
#endif
explicit QTouchEvent(QEvent::Type eventType,
QTouchDevice *device = nullptr,
Qt::KeyboardModifiers modifiers = Qt::NoModifier,
@ -992,9 +946,6 @@ public:
inline QWindow *window() const { return _window; }
inline QObject *target() const { return _target; }
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline QTouchEvent::DeviceType deviceType() const { return static_cast<DeviceType>(int(_device->type())); }
#endif
inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; }
inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; }
inline QTouchDevice *device() const { return _device; }
@ -1045,7 +996,6 @@ public:
void setContentPos(const QPointF &pos);
private:
QObject* m_target; // Qt 6 remove.
QPointF m_startPos;
QSizeF m_viewportSize;
QRectF m_contentPosRange;

View File

@ -65,6 +65,7 @@
#include "QtGui/qtextcursor.h"
#include "QtCore/qmap.h"
#include "QtCore/qvariant.h"
#include "QtCore/qset.h"
#include "QtCore/qurl.h"
#include "private/qcssparser_p.h"

View File

@ -42,6 +42,7 @@
#include "qwindowsfontdatabase_p.h"
#include <QtCore/qendian.h>
#include <QtCore/qfile.h>
#include <QtCore/qstringbuilder.h>
#include <QtCore/qvarlengtharray.h>

View File

@ -42,6 +42,7 @@
#include <libinput.h>
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
#include <QtGui/QTouchDevice>
#include <QtGui/private/qhighdpiscaling_p.h>
QT_BEGIN_NAMESPACE

View File

@ -45,6 +45,7 @@
#include "qandroidplatformintegration.h"
#include <qpa/qwindowsysteminterface.h>
#include <QTouchDevice>
#include <QTouchEvent>
#include <QPointer>

View File

@ -46,8 +46,9 @@
#if QT_CONFIG(opengl)
#include <QtPlatformCompositorSupport/qpa/qplatformbackingstoreopenglsupport.h>
#endif
#include <QThread>
#include <QOffscreenSurface>
#include <QThread>
#include <QTouchDevice>
#include <QtEglSupport/private/qeglpbuffer_p.h>
#include <qpa/qwindowsysteminterface.h>

View File

@ -58,6 +58,7 @@
#include <qpa/qwindowsysteminterface.h>
#include <qhash.h>
#include <QtCore>
#include <QtGui/qtouchdevice.h>
QT_BEGIN_NAMESPACE

View File

@ -43,6 +43,7 @@
#include "qeglfskmsgbmscreen.h"
#include "qeglfskmsgbmdevice.h"
#include <QtCore/QFile>
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
#include <QtCore/QJsonArray>

View File

@ -53,6 +53,7 @@
#include "qiosservices.h"
#include "qiosoptionalplugininterface.h"
#include <QtGui/qtouchdevice.h>
#include <QtGui/private/qguiapplication_p.h>
#include <qoffscreensurface.h>

View File

@ -48,6 +48,7 @@
#include <QtCore/private/qcore_mac_p.h>
#include <QtGui/qtouchdevice.h>
#include <QtGui/private/qwindow_p.h>
#include <private/qcoregraphics_p.h>
#include <qpa/qwindowsysteminterface.h>

View File

@ -49,6 +49,7 @@
#include "qiosmenu.h"
#endif
#include <QtGui/qtouchdevice.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qwindow_p.h>
#include <qpa/qwindowsysteminterface_p.h>

View File

@ -70,6 +70,7 @@
#include <qpa/qplatformnativeinterface.h>
#include <QtGui/qguiapplication.h>
#include <QtGui/qopenglcontext.h>
#include <QtGui/qtouchdevice.h>
#include <QtCore/qset.h>
#include <QtCore/qhash.h>

View File

@ -52,6 +52,7 @@
#include <QtCore/qmap.h>
#include <QtGui/qevent.h>
#include <QtGui/qwindow.h>
#include <QtGui/qtouchdevice.h>
#ifdef QT_WIDGETS_LIB
#include <QtWidgets/qwidget.h>
#endif

View File

@ -1717,7 +1717,7 @@ public:
eventType = ev->type();
eventGlobal = ev->globalPosF();
eventLocal = ev->posF();
eventDevice = ev->device();
eventDevice = ev->deviceType();
}
QEvent::Type eventType = QEvent::None;
@ -1730,7 +1730,7 @@ public:
|| ev->type() == QEvent::TabletLeaveProximity) {
eventType = ev->type();
QTabletEvent *te = static_cast<QTabletEvent *>(ev);
eventDevice = te->device();
eventDevice = te->deviceType();
}
return QWindow::eventFilter(obj, ev);
}