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 QQUICKCHECKDELEGATE_P_H
5#define QQUICKCHECKDELEGATE_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 QQuickCheckDelegatePrivate;
23
24class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickCheckDelegate : public QQuickItemDelegate
25{
26 Q_OBJECT
27 Q_PROPERTY(bool tristate READ isTristate WRITE setTristate NOTIFY tristateChanged FINAL)
28 Q_PROPERTY(Qt::CheckState checkState READ checkState WRITE setCheckState NOTIFY checkStateChanged FINAL)
29 // 2.4 (Qt 5.11)
30 Q_PRIVATE_PROPERTY(QQuickCheckDelegate::d_func(), QJSValue nextCheckState MEMBER nextCheckState WRITE setNextCheckState NOTIFY nextCheckStateChanged FINAL REVISION(2, 4))
31 QML_NAMED_ELEMENT(CheckDelegate)
32 QML_ADDED_IN_VERSION(2, 0)
33
34public:
35 explicit QQuickCheckDelegate(QQuickItem *parent = nullptr);
36
37 bool isTristate() const;
38 void setTristate(bool tristate);
39
40 Qt::CheckState checkState() const;
41 void setCheckState(Qt::CheckState state);
42
43Q_SIGNALS:
44 void tristateChanged();
45 void checkStateChanged();
46 // 2.4 (Qt 5.11)
47 Q_REVISION(2, 4) void nextCheckStateChanged();
48
49protected:
50 QFont defaultFont() const override;
51
52 void buttonChange(ButtonChange change) override;
53 void nextCheckState() override;
54
55#if QT_CONFIG(accessibility)
56 QAccessible::Role accessibleRole() const override;
57#endif
58
59private:
60 Q_DISABLE_COPY(QQuickCheckDelegate)
61 Q_DECLARE_PRIVATE(QQuickCheckDelegate)
62};
63
64QT_END_NAMESPACE
65
66QML_DECLARE_TYPE(QQuickCheckDelegate)
67
68#endif // QQUICKCHECKDELEGATE_P_H
69

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