diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2024-02-16 21:49:42 -0700 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2024-02-21 06:27:53 -0700 |
commit | 32a56ba8f08ddefa3d20c3003ed8599553b6d960 (patch) | |
tree | 4959c8cfdac54f24888b62bd1dd80ce5ae9eacad /src/quick/handlers | |
parent | 5f7b25a694eb46cc520b6dd2651f1e3f99e310f0 (diff) |
Accept mouse or touchpad in snippets with acceptedDevices
This is a workaround for platforms (such as Wayland and macOS) that are
sometimes failing to distinguish mouse and touchpad. It's better for
illustrative purposes anyway, since a laptop user may really be using a
touchpad rather than a mouse, and we hope to eventually distinguish
them on as many platforms as possible.
Task-number: QTBUG-63363
Task-number: QTBUG-112432
Pick-to: 6.5 6.6 6.7
Change-Id: Ic7a374f1257d4aa57f29385b44da85ccaf4f5ec6
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
Diffstat (limited to 'src/quick/handlers')
-rw-r--r-- | src/quick/handlers/qquickhoverhandler.cpp | 3 | ||||
-rw-r--r-- | src/quick/handlers/qquickpointerdevicehandler.cpp | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/quick/handlers/qquickhoverhandler.cpp b/src/quick/handlers/qquickhoverhandler.cpp index 1643f89fea..9a19296c92 100644 --- a/src/quick/handlers/qquickhoverhandler.cpp +++ b/src/quick/handlers/qquickhoverhandler.cpp @@ -230,6 +230,9 @@ void QQuickHoverHandler::setHovered(bool hovered) \value PointerDevice.Puck A digitizer with crosshairs, on a graphics tablet. \value PointerDevice.AllDevices Any type of pointing device. + \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. + \sa QInputDevice::DeviceType */ diff --git a/src/quick/handlers/qquickpointerdevicehandler.cpp b/src/quick/handlers/qquickpointerdevicehandler.cpp index 4c871d93f5..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) { |