1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#include "qquickpointerhandler_p.h"
4
5#ifndef QQUICKPOINTERDEVICEHANDLER_H
6#define QQUICKPOINTERDEVICEHANDLER_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19QT_BEGIN_NAMESPACE
20
21class QQuickPointerDeviceHandlerPrivate;
22
23class Q_QUICK_PRIVATE_EXPORT QQuickPointerDeviceHandler : public QQuickPointerHandler
24{
25 Q_OBJECT
26 Q_PROPERTY(QInputDevice::DeviceTypes acceptedDevices READ acceptedDevices WRITE
27 setAcceptedDevices NOTIFY acceptedDevicesChanged FINAL)
28 Q_PROPERTY(QPointingDevice::PointerTypes acceptedPointerTypes READ acceptedPointerTypes WRITE setAcceptedPointerTypes NOTIFY acceptedPointerTypesChanged FINAL)
29 Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged FINAL)
30 Q_PROPERTY(Qt::KeyboardModifiers acceptedModifiers READ acceptedModifiers WRITE setAcceptedModifiers NOTIFY acceptedModifiersChanged FINAL)
31
32public:
33 explicit QQuickPointerDeviceHandler(QQuickItem *parent = nullptr);
34
35 QInputDevice::DeviceTypes acceptedDevices() const;
36 QPointingDevice::PointerTypes acceptedPointerTypes() const;
37 Qt::MouseButtons acceptedButtons() const;
38 Qt::KeyboardModifiers acceptedModifiers() const;
39
40public Q_SLOTS:
41 void setAcceptedDevices(QInputDevice::DeviceTypes acceptedDevices);
42 void setAcceptedPointerTypes(QPointingDevice::PointerTypes acceptedPointerTypes);
43 void setAcceptedButtons(Qt::MouseButtons buttons);
44 void setAcceptedModifiers(Qt::KeyboardModifiers acceptedModifiers);
45
46Q_SIGNALS:
47 void acceptedDevicesChanged();
48 void acceptedPointerTypesChanged();
49 void acceptedButtonsChanged();
50 void acceptedModifiersChanged();
51
52protected:
53 QQuickPointerDeviceHandler(QQuickPointerDeviceHandlerPrivate &dd, QQuickItem *parent = nullptr);
54
55 bool wantsPointerEvent(QPointerEvent *event) override;
56
57 Q_DECLARE_PRIVATE(QQuickPointerDeviceHandler)
58};
59
60QT_END_NAMESPACE
61
62#endif // QQUICKPOINTERDEVICEHANDLER_H
63

source code of qtdeclarative/src/quick/handlers/qquickpointerdevicehandler_p.h