diff options
Diffstat (limited to 'src/quick/handlers/qquickpointerdevicehandler.cpp')
-rw-r--r-- | src/quick/handlers/qquickpointerdevicehandler.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/quick/handlers/qquickpointerdevicehandler.cpp b/src/quick/handlers/qquickpointerdevicehandler.cpp index b610e083cc..a6b98ec2b5 100644 --- a/src/quick/handlers/qquickpointerdevicehandler.cpp +++ b/src/quick/handlers/qquickpointerdevicehandler.cpp @@ -110,7 +110,7 @@ Qt::KeyboardModifiers QQuickPointerDeviceHandler::acceptedModifiers() const \qml Item { TapHandler { - acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus + acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad | PointerDevice.Stylus onTapped: console.log("clicked") } TapHandler { @@ -119,6 +119,9 @@ Qt::KeyboardModifiers QQuickPointerDeviceHandler::acceptedModifiers() const } } \endqml + + \note Not all platforms are yet able to distinguish mouse and touchpad; and + on those that do, you often want to make mouse and touchpad behavior the same. */ void QQuickPointerDeviceHandler::setAcceptedDevices(QPointingDevice::DeviceTypes acceptedDevices) { @@ -139,7 +142,7 @@ void QQuickPointerDeviceHandler::setAcceptedDevices(QPointingDevice::DeviceTypes By default, this property is set to \l {QPointingDevice::PointerType} {PointerDevice.AllPointerTypes}. If you set it to an OR combination of device types, it will ignore events - from non-matching events. + from non-matching \l {PointerDevice}{devices}. For example, a control could be made to respond to mouse, touch, and stylus clicks in some way, but delete itself if tapped with an eraser tool on a graphics tablet, @@ -149,7 +152,7 @@ void QQuickPointerDeviceHandler::setAcceptedDevices(QPointingDevice::DeviceTypes Rectangle { id: rect TapHandler { - acceptedPointerTypes: PointerDevice.GenericPointer | PointerDevice.Finger | PointerDevice.Pen + acceptedPointerTypes: PointerDevice.Generic | PointerDevice.Finger | PointerDevice.Pen onTapped: console.log("clicked") } TapHandler { @@ -270,7 +273,7 @@ bool QQuickPointerDeviceHandler::wantsPointerEvent(QPointerEvent *event) if (d->acceptedModifiers != Qt::KeyboardModifierMask && event->modifiers() != d->acceptedModifiers) return false; // Some handlers (HoverHandler, PinchHandler) set acceptedButtons to Qt::NoButton to indicate that button state is irrelevant. - if (event->pointingDevice()->pointerType() != QPointingDevice::PointerType::Finger && + if (event->pointingDevice()->type() != QPointingDevice::DeviceType::TouchScreen && acceptedButtons() != Qt::NoButton && event->type() != QEvent::Wheel && (static_cast<QSinglePointEvent *>(event)->buttons() & acceptedButtons()) == 0 && (static_cast<QSinglePointEvent *>(event)->button() & acceptedButtons()) == 0) |