From 5e96f43fe03e16d7ca68f0dd888c4518a98694f2 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 12 Sep 2019 09:41:38 +0200 Subject: doc: explain more about acceptedModifiers in PointerDeviceHandler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Having neither a list of all possible modifiers nor a link to Qt::KeyboardModifier was inconvenient. Clarify that bitwise OR results in logical-AND behavior, while having multiple handlers results in logical-OR behavior, and that a switch statement in JS allows you do anything you like with modifiers. Fix the manual test to test the switch statement and deal with the fact that point.event.modifiers is undefined: TapHandler can use eventPoint.modifiers, but any DeviceHandler can use point.modifiers. Fixes: QTBUG-78234 Change-Id: Iba2a03950aa1279ef454cc76fc8de1b2dab14dfb Reviewed-by: Venugopal Shivashankar Reviewed-by: Jan Arve Sæther --- tests/manual/pointer/tapWithModifiers.qml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'tests/manual') diff --git a/tests/manual/pointer/tapWithModifiers.qml b/tests/manual/pointer/tapWithModifiers.qml index 8ca1c1bd63..da3c0cb30a 100644 --- a/tests/manual/pointer/tapWithModifiers.qml +++ b/tests/manual/pointer/tapWithModifiers.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the manual tests of the Qt Toolkit. @@ -40,6 +40,16 @@ Item { onTapped: console.log("tapped with no modifiers") } TapHandler { - onTapped: console.log("tapped with modifiers " + point.event.modifiers) + onTapped: + switch (point.modifiers) { + case Qt.ControlModifier | Qt.AltModifier: + console.log("CTRL+ALT"); + break; + case Qt.ControlModifier | Qt.AltModifier | Qt.MetaModifier: + console.log("CTRL+META+ALT"); + break; + default: + console.log("other modifiers", point.modifiers) + } } } -- cgit v1.2.3