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:
HIDAKA Takahiro 2024-09-11 09:51:33 +09:00 committed by Qt Cherry-pick Bot
parent 44d4d2593c
commit f3f9b2ea8a
3 changed files with 7 additions and 9 deletions

View File

@ -19,7 +19,7 @@ class Q_GUI_EXPORT QInputDevice : public QObject
Q_DECLARE_PRIVATE(QInputDevice)
Q_PROPERTY(QString name READ name 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(QString seatName READ seatName CONSTANT)
Q_PROPERTY(QRect availableVirtualGeometry READ availableVirtualGeometry

View File

@ -94,14 +94,13 @@ void QIOSIntegration::initialize()
// Depends on a primary screen being present
m_inputContext = new QIOSInputContext;
m_touchDevice = new QPointingDevice;
m_touchDevice->setType(QInputDevice::DeviceType::TouchScreen);
QPointingDevice::Capabilities touchCapabilities = QPointingDevice::Capability::Position | QPointingDevice::Capability::NormalizedPosition;
#if !defined(Q_OS_VISIONOS)
if (mainScreen.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)
touchCapabilities |= QPointingDevice::Capability::Pressure;
#endif
m_touchDevice->setCapabilities(touchCapabilities);
m_touchDevice = new QPointingDevice("touchscreen", 0, QInputDevice::DeviceType::TouchScreen,
QPointingDevice::PointerType::Finger, touchCapabilities, 10, 0);
QWindowSystemInterface::registerInputDevice(m_touchDevice);
#if QT_CONFIG(tabletevent)
QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false);

View File

@ -20,6 +20,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qwindow_p.h>
#include <QtGui/private/qapplekeymapper_p.h>
#include <QtGui/private/qpointingdevice_p.h>
#include <qpa/qwindowsysteminterface_p.h>
Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
@ -346,12 +347,10 @@ inline ulong getTimeStamp(UIEvent *event)
[super traitCollectionDidChange: previousTraitCollection];
QPointingDevice *touchDevice = QIOSIntegration::instance()->touchDevice();
QPointingDevice::Capabilities touchCapabilities = touchDevice->capabilities();
auto *devicePriv = QPointingDevicePrivate::get(touchDevice);
touchCapabilities.setFlag(QPointingDevice::Capability::Pressure,
(self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable));
touchDevice->setCapabilities(touchCapabilities);
devicePriv->capabilities.setFlag(QPointingDevice::Capability::Pressure,
(self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable));
}
-(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event