1 | // Copyright (C) 2017 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 | |
4 | #ifndef QQUICKSWITCH_P_H |
5 | #define QQUICKSWITCH_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtQuickTemplates2/private/qquickabstractbutton_p.h> |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | |
22 | class QQuickSwitchPrivate; |
23 | |
24 | class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwitch : public QQuickAbstractButton |
25 | { |
26 | Q_OBJECT |
27 | Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL) |
28 | Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL) |
29 | QML_NAMED_ELEMENT(Switch) |
30 | QML_ADDED_IN_VERSION(2, 0) |
31 | |
32 | public: |
33 | explicit QQuickSwitch(QQuickItem *parent = nullptr); |
34 | |
35 | qreal position() const; |
36 | void setPosition(qreal position); |
37 | |
38 | qreal visualPosition() const; |
39 | |
40 | Q_SIGNALS: |
41 | void positionChanged(); |
42 | void visualPositionChanged(); |
43 | |
44 | protected: |
45 | void mouseMoveEvent(QMouseEvent *event) override; |
46 | #if QT_CONFIG(quicktemplates2_multitouch) |
47 | void touchEvent(QTouchEvent *event) override; |
48 | #endif |
49 | |
50 | void mirrorChange() override; |
51 | |
52 | void nextCheckState() override; |
53 | void buttonChange(ButtonChange change) override; |
54 | |
55 | QFont defaultFont() const override; |
56 | |
57 | private: |
58 | Q_DISABLE_COPY(QQuickSwitch) |
59 | Q_DECLARE_PRIVATE(QQuickSwitch) |
60 | }; |
61 | |
62 | QT_END_NAMESPACE |
63 | |
64 | QML_DECLARE_TYPE(QQuickSwitch) |
65 | |
66 | #endif // QQUICKSWITCH_P_H |
67 |