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 QQUICKMENUITEM_P_H
5#define QQUICKMENUITEM_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 QQuickMenu;
23class QQuickMenuItemPrivate;
24
25class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenuItem : public QQuickAbstractButton
26{
27 Q_OBJECT
28 Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL)
29 // 2.3 (Qt 5.10)
30 Q_PROPERTY(QQuickItem *arrow READ arrow WRITE setArrow NOTIFY arrowChanged FINAL REVISION(2, 3))
31 Q_PROPERTY(QQuickMenu *menu READ menu NOTIFY menuChanged FINAL REVISION(2, 3))
32 Q_PROPERTY(QQuickMenu *subMenu READ subMenu NOTIFY subMenuChanged FINAL REVISION(2, 3))
33 Q_CLASSINFO("DeferredPropertyNames", "arrow,background,contentItem,indicator")
34 QML_NAMED_ELEMENT(MenuItem)
35 QML_ADDED_IN_VERSION(2, 0)
36
37public:
38 explicit QQuickMenuItem(QQuickItem *parent = nullptr);
39
40 bool isHighlighted() const;
41 void setHighlighted(bool highlighted);
42
43 // 2.3 (Qt 5.10)
44 QQuickItem *arrow() const;
45 void setArrow(QQuickItem *arrow);
46
47 QQuickMenu *menu() const;
48 QQuickMenu *subMenu() const;
49
50Q_SIGNALS:
51 void triggered();
52 void highlightedChanged();
53 // 2.3 (Qt 5.10)
54 Q_REVISION(2, 3) void arrowChanged();
55 Q_REVISION(2, 3) void menuChanged();
56 Q_REVISION(2, 3) void subMenuChanged();
57
58protected:
59 void componentComplete() override;
60
61 QFont defaultFont() const override;
62
63#if QT_CONFIG(accessibility)
64 QAccessible::Role accessibleRole() const override;
65#endif
66
67private:
68 Q_DISABLE_COPY(QQuickMenuItem)
69 Q_DECLARE_PRIVATE(QQuickMenuItem)
70};
71
72QT_END_NAMESPACE
73
74QML_DECLARE_TYPE(QQuickMenuItem)
75
76#endif // QQUICKMENUITEM_P_H
77

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