aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickevents.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/items/qquickevents.cpp')
-rw-r--r--src/quick/items/qquickevents.cpp112
1 files changed, 46 insertions, 66 deletions
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index ba9082cc2a..d6d012a021 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQuick module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qquickevents_p_p.h"
#include <QtCore/qmap.h>
@@ -133,16 +97,15 @@ Item {
This property holds the keyboard modifier flags that existed immediately
before the event occurred.
- It contains a bitwise combination of:
- \list
- \li \l {Qt::NoModifier} {Qt.NoModifier} - No modifier key is pressed.
- \li \l {Qt::ShiftModifier} {Qt.ShiftModifier} - A Shift key on the keyboard is pressed.
- \li \l {Qt::ControlModifier} {Qt.ControlModifier} - A Ctrl key on the keyboard is pressed.
- \li \l {Qt::AltModifier} {Qt.AltModifier} - An Alt key on the keyboard is pressed.
- \li \l {Qt::MetaModifier} {Qt.MetaModifier} - A Meta key on the keyboard is pressed.
- \li \l {Qt::KeypadModifier} {Qt.KeypadModifier} - A keypad button is pressed.
- \li \l {Qt::GroupSwitchModifier} {Qt.GroupSwitchModifier} - X11 only. A Mode_switch key on the keyboard is pressed.
- \endlist
+ It contains a bitwise combination of numeric values (the same as in Qt::KeyboardModifier):
+
+ \value Qt.NoModifier No modifier key is pressed.
+ \value Qt.ShiftModifier} A Shift key on the keyboard is pressed.
+ \value Qt.ControlModifier A Ctrl key on the keyboard is pressed.
+ \value Qt.AltModifier An Alt key on the keyboard is pressed.
+ \value Qt.MetaModifier A Meta key on the keyboard is pressed.
+ \value Qt.KeypadModifier A keypad button is pressed.
+ \value Qt.GroupSwitchModifier X11 only. A Mode_switch key on the keyboard is pressed.
For example, to react to a Shift key + Enter key combination:
\qml
@@ -289,6 +252,7 @@ bool QQuickKeyEvent::matches(QKeySequence::StandardKey matchKey) const
/*!
\qmlproperty int QtQuick::MouseEvent::source
\since 5.7
+ \deprecated [6.2] Use \l {Qt Quick Input Handlers}{input handlers} with \l {PointerDeviceHandler::acceptedDevices}{acceptedDevices} set.
This property holds the source of the mouse event.
@@ -364,10 +328,9 @@ bool QQuickKeyEvent::matches(QKeySequence::StandardKey matchKey) const
\ingroup qtquick-input-events
\brief Provides information about a mouse wheel event.
- The position of the mouse can be found via the
- \l {Item::x} {x} and \l {Item::y} {y} properties.
+ The position of the mouse can be found via the \l x and \l y properties.
- \sa MouseArea
+ \sa WheelHandler, MouseArea
*/
/*!
@@ -380,16 +343,20 @@ bool QQuickKeyEvent::matches(QKeySequence::StandardKey matchKey) const
\qmlproperty real QtQuick::WheelEvent::y
These properties hold the coordinates of the position supplied by the wheel event.
+
+ \sa QWheelEvent::position()
*/
/*!
\qmlproperty bool QtQuick::WheelEvent::accepted
- Setting \a accepted to true prevents the wheel event from being
- propagated to items below this item.
+ Setting \a accepted to \c true prevents the wheel event from being
+ propagated to items below the receiving item or handler.
- Generally, if the item acts on the wheel event then it should be accepted
+ Generally, if the item acts on the wheel event, it should be accepted
so that items lower in the stacking order do not also respond to the same event.
+
+ \sa QWheelEvent::accepted
*/
/*!
@@ -403,32 +370,39 @@ bool QQuickKeyEvent::matches(QKeySequence::StandardKey matchKey) const
\li \l {Qt::RightButton} {Qt.RightButton}
\li \l {Qt::MiddleButton} {Qt.MiddleButton}
\endlist
+
+ \sa QWheelEvent::buttons()
*/
/*!
\qmlproperty point QtQuick::WheelEvent::angleDelta
- This property holds the distance that the wheel is rotated in wheel degrees.
- The x and y cordinate of this property holds the delta in horizontal and
- vertical orientation.
+ This property holds the relative amount that the wheel was rotated, in
+ eighths of a degree. The \c x and \c y coordinates of this property hold
+ the delta in horizontal and vertical orientations, respectively.
A positive value indicates that the wheel was rotated up/right;
a negative value indicates that the wheel was rotated down/left.
- Most mouse types work in steps of 15 degrees, in which case the delta value is a
- multiple of 120; i.e., 120 units * 1/8 = 15 degrees.
+ Most mouse types work in steps of \c 15 degrees, in which case the delta value is a
+ multiple of \c 120; i.e., \c {120 units * 1/8 = 15 degrees}.
+
+ \sa QWheelEvent::angleDelta()
*/
/*!
\qmlproperty point QtQuick::WheelEvent::pixelDelta
This property holds the delta in screen pixels and is available in platforms that
- have high-resolution trackpads, such as \macos.
- The x and y cordinate of this property holds the delta in horizontal and
- vertical orientation. The value should be used directly to scroll content on screen.
+ have high-resolution \l {QInputDevice::DeviceType::TouchPad}{trackpads}, such as \macos.
+ The \c x and \c y coordinates of this property hold the delta in horizontal
+ and vertical orientations, respectively. The values can be used directly to
+ scroll content on screen.
- For platforms without high-resolution trackpad support, pixelDelta will always be (0,0),
- and angleDelta should be used instead.
+ For platforms without \l {QInputDevice::Capability::PixelScroll}{high-resolution trackpad}
+ support, pixelDelta will always be \c {(0,0)}, and \l angleDelta should be used instead.
+
+ \sa QWheelEvent::pixelDelta()
*/
/*!
@@ -449,7 +423,7 @@ bool QQuickKeyEvent::matches(QKeySequence::StandardKey matchKey) const
For example, to react to a Control key pressed during the wheel event:
\qml
- MouseArea {
+ WheelHandler {
onWheel: (wheel)=> {
if (wheel.modifiers & Qt.ControlModifier) {
adjustZoom(wheel.angleDelta.y / 120);
@@ -457,6 +431,8 @@ bool QQuickKeyEvent::matches(QKeySequence::StandardKey matchKey) const
}
}
\endqml
+
+ \sa QWheelEvent::modifiers()
*/
/*!
@@ -478,7 +454,11 @@ bool QQuickKeyEvent::matches(QKeySequence::StandardKey matchKey) const
negate the angleDelta or pixelDelta values.
\note Many platforms provide no such information. On such platforms
- \l inverted always returns false.
+ \c inverted always returns \c false.
+
+ \sa QWheelEvent::inverted()
*/
QT_END_NAMESPACE
+
+#include "moc_qquickevents_p_p.cpp"