Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickmenuitem_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKMENUITEM_P_H
6#define QQUICKMENUITEM_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
20#include <QtQmlModels/private/qtqmlmodelsglobal_p.h>
21
23
24QT_BEGIN_NAMESPACE
25
26class QQuickMenu;
28
29class Q_QUICKTEMPLATES2_EXPORT QQuickMenuItem : public QQuickAbstractButton
30{
31 Q_OBJECT
32 Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL)
33 // 2.3 (Qt 5.10)
34 Q_PROPERTY(QQuickItem *arrow READ arrow WRITE setArrow NOTIFY arrowChanged FINAL REVISION(2, 3))
35 Q_PROPERTY(QQuickMenu *menu READ menu NOTIFY menuChanged FINAL REVISION(2, 3))
36 Q_PROPERTY(QQuickMenu *subMenu READ subMenu NOTIFY subMenuChanged FINAL REVISION(2, 3))
37 Q_PROPERTY(qreal implicitTextPadding READ implicitTextPadding WRITE setImplicitTextPadding NOTIFY implicitTextPaddingChanged REVISION(6, 8))
38 Q_PROPERTY(qreal textPadding READ textPadding NOTIFY textPaddingChanged REVISION(6, 8))
39 Q_CLASSINFO("DeferredPropertyNames", "arrow,background,contentItem,indicator")
40 QML_NAMED_ELEMENT(MenuItem)
41 QML_ADDED_IN_VERSION(2, 0)
42
43public:
44 explicit QQuickMenuItem(QQuickItem *parent = nullptr);
45
46 bool isHighlighted() const;
47 void setHighlighted(bool highlighted);
48
49 // 2.3 (Qt 5.10)
50 QQuickItem *arrow() const;
51 void setArrow(QQuickItem *arrow);
52
53 QQuickMenu *menu() const;
54 QQuickMenu *subMenu() const;
55
56 qreal textPadding() const;
57 qreal implicitTextPadding() const;
58 void setImplicitTextPadding(qreal newImplicitTextPadding);
59
60Q_SIGNALS:
61 void triggered();
62 void highlightedChanged();
63 // 2.3 (Qt 5.10)
64 Q_REVISION(2, 3) void arrowChanged();
65 Q_REVISION(2, 3) void menuChanged();
66 Q_REVISION(2, 3) void subMenuChanged();
67 Q_REVISION(6, 8) void implicitTextPaddingChanged();
68 Q_REVISION(6, 8) void textPaddingChanged();
69
70protected:
71 void componentComplete() override;
72
73 QFont defaultFont() const override;
74
75#if QT_CONFIG(accessibility)
76 QAccessible::Role accessibleRole() const override;
77#endif
78
79private:
80 Q_DISABLE_COPY(QQuickMenuItem)
81 Q_DECLARE_PRIVATE(QQuickMenuItem)
82};
83
84#ifndef QT_NO_DEBUG_STREAM
85Q_QUICKTEMPLATES2_EXPORT QDebug operator<<(QDebug debug, const QQuickMenuItem *menuItem);
86#endif
87
88QT_END_NAMESPACE
89
90#endif // QQUICKMENUITEM_P_H
QPalette defaultPalette() const override
void setSubMenu(QQuickMenu *subMenu)
void executeArrow(bool complete=false)
bool acceptKeyClick(Qt::Key key) const override
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2568
QT_REQUIRE_CONFIG(qml_object_model)
static QString arrowName()
QDebug operator<<(QDebug debug, const QQuickMenuItem *menuItem)