iOS: Replace usage of deprecated QPointerDevice APIs
Replace usage of QPointerDevice::setType to constructor. Fixes: QTBUG-129981 Change-Id: I757ec3cde7815363539b8cfe3fd7ae46993ce33e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit cc24213bdb286b200ad1c637ed244c48a2a32495) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
44d4d2593c
commit
f3f9b2ea8a
@ -19,7 +19,7 @@ class Q_GUI_EXPORT QInputDevice : public QObject
|
|||||||
Q_DECLARE_PRIVATE(QInputDevice)
|
Q_DECLARE_PRIVATE(QInputDevice)
|
||||||
Q_PROPERTY(QString name READ name CONSTANT)
|
Q_PROPERTY(QString name READ name CONSTANT)
|
||||||
Q_PROPERTY(DeviceType type READ type CONSTANT)
|
Q_PROPERTY(DeviceType type READ type CONSTANT)
|
||||||
Q_PROPERTY(Capabilities capabilities READ capabilities CONSTANT)
|
Q_PROPERTY(Capabilities capabilities READ capabilities)
|
||||||
Q_PROPERTY(qint64 systemId READ systemId CONSTANT)
|
Q_PROPERTY(qint64 systemId READ systemId CONSTANT)
|
||||||
Q_PROPERTY(QString seatName READ seatName CONSTANT)
|
Q_PROPERTY(QString seatName READ seatName CONSTANT)
|
||||||
Q_PROPERTY(QRect availableVirtualGeometry READ availableVirtualGeometry
|
Q_PROPERTY(QRect availableVirtualGeometry READ availableVirtualGeometry
|
||||||
|
@ -94,14 +94,13 @@ void QIOSIntegration::initialize()
|
|||||||
// Depends on a primary screen being present
|
// Depends on a primary screen being present
|
||||||
m_inputContext = new QIOSInputContext;
|
m_inputContext = new QIOSInputContext;
|
||||||
|
|
||||||
m_touchDevice = new QPointingDevice;
|
|
||||||
m_touchDevice->setType(QInputDevice::DeviceType::TouchScreen);
|
|
||||||
QPointingDevice::Capabilities touchCapabilities = QPointingDevice::Capability::Position | QPointingDevice::Capability::NormalizedPosition;
|
QPointingDevice::Capabilities touchCapabilities = QPointingDevice::Capability::Position | QPointingDevice::Capability::NormalizedPosition;
|
||||||
#if !defined(Q_OS_VISIONOS)
|
#if !defined(Q_OS_VISIONOS)
|
||||||
if (mainScreen.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)
|
if (mainScreen.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)
|
||||||
touchCapabilities |= QPointingDevice::Capability::Pressure;
|
touchCapabilities |= QPointingDevice::Capability::Pressure;
|
||||||
#endif
|
#endif
|
||||||
m_touchDevice->setCapabilities(touchCapabilities);
|
m_touchDevice = new QPointingDevice("touchscreen", 0, QInputDevice::DeviceType::TouchScreen,
|
||||||
|
QPointingDevice::PointerType::Finger, touchCapabilities, 10, 0);
|
||||||
QWindowSystemInterface::registerInputDevice(m_touchDevice);
|
QWindowSystemInterface::registerInputDevice(m_touchDevice);
|
||||||
#if QT_CONFIG(tabletevent)
|
#if QT_CONFIG(tabletevent)
|
||||||
QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false);
|
QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false);
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <QtGui/private/qguiapplication_p.h>
|
#include <QtGui/private/qguiapplication_p.h>
|
||||||
#include <QtGui/private/qwindow_p.h>
|
#include <QtGui/private/qwindow_p.h>
|
||||||
#include <QtGui/private/qapplekeymapper_p.h>
|
#include <QtGui/private/qapplekeymapper_p.h>
|
||||||
|
#include <QtGui/private/qpointingdevice_p.h>
|
||||||
#include <qpa/qwindowsysteminterface_p.h>
|
#include <qpa/qwindowsysteminterface_p.h>
|
||||||
|
|
||||||
Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
|
Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
|
||||||
@ -346,12 +347,10 @@ inline ulong getTimeStamp(UIEvent *event)
|
|||||||
[super traitCollectionDidChange: previousTraitCollection];
|
[super traitCollectionDidChange: previousTraitCollection];
|
||||||
|
|
||||||
QPointingDevice *touchDevice = QIOSIntegration::instance()->touchDevice();
|
QPointingDevice *touchDevice = QIOSIntegration::instance()->touchDevice();
|
||||||
QPointingDevice::Capabilities touchCapabilities = touchDevice->capabilities();
|
auto *devicePriv = QPointingDevicePrivate::get(touchDevice);
|
||||||
|
|
||||||
touchCapabilities.setFlag(QPointingDevice::Capability::Pressure,
|
devicePriv->capabilities.setFlag(QPointingDevice::Capability::Pressure,
|
||||||
(self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable));
|
(self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable));
|
||||||
|
|
||||||
touchDevice->setCapabilities(touchCapabilities);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
|
-(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
|
||||||
|
Loading…
x
Reference in New Issue
Block a user