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 QQUICKSWITCHDELEGATE_P_H
5#define QQUICKSWITCHDELEGATE_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/qquickitemdelegate_p.h>
19
20QT_BEGIN_NAMESPACE
21
22class QQuickSwitchDelegatePrivate;
23
24class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwitchDelegate : public QQuickItemDelegate
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(SwitchDelegate)
30 QML_ADDED_IN_VERSION(2, 0)
31
32public:
33 explicit QQuickSwitchDelegate(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 QFont defaultFont() const override;
51
52 void mirrorChange() override;
53
54 void nextCheckState() override;
55 void buttonChange(ButtonChange change) override;
56
57private:
58 Q_DISABLE_COPY(QQuickSwitchDelegate)
59 Q_DECLARE_PRIVATE(QQuickSwitchDelegate)
60};
61
62QT_END_NAMESPACE
63
64QML_DECLARE_TYPE(QQuickSwitchDelegate)
65
66#endif // QQUICKSWITCHDELEGATE_P_H
67

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