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
20QT_BEGIN_NAMESPACE
21
22class QQuickSwitchPrivate;
23
24class 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
32public:
33 explicit QQuickSwitch(QQuickItem *parent = nullptr);
34
35 qreal position() const;
36 void setPosition(qreal position);
37
38 qreal visualPosition() const;
39
40Q_SIGNALS:
41 void positionChanged();
42 void visualPositionChanged();
43
44protected:
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
57private:
58 Q_DISABLE_COPY(QQuickSwitch)
59 Q_DECLARE_PRIVATE(QQuickSwitch)
60};
61
62QT_END_NAMESPACE
63
64QML_DECLARE_TYPE(QQuickSwitch)
65
66#endif // QQUICKSWITCH_P_H
67

source code of qtdeclarative/src/quicktemplates/qquickswitch_p.h