Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquicklabsplatformmenuitem_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
4#ifndef QQUICKLABSPLATFORMMENUITEM_P_H
5#define QQUICKLABSPLATFORMMENUITEM_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 <QtCore/qobject.h>
19#include <QtCore/qurl.h>
20#include <QtGui/qfont.h>
21#include <QtGui/qpa/qplatformmenu.h>
22#include <QtQml/qqmlparserstatus.h>
23#include <QtQml/qqml.h>
24
26
28
33
35{
37 QML_NAMED_ELEMENT(MenuItem)
48 Q_PROPERTY(QPlatformMenuItem::MenuRole role READ role WRITE setRole NOTIFY roleChanged FINAL)
49 Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
51 Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged FINAL)
52 Q_PROPERTY(QQuickLabsPlatformIcon icon READ icon WRITE setIcon NOTIFY iconChanged FINAL REVISION(1, 1))
53
54public:
57
60 void sync();
61
64
67
70
71 bool isEnabled() const;
72 void setEnabled(bool enabled);
73
74 bool isVisible() const;
75 void setVisible(bool visible);
76
77 bool isSeparator() const;
78 void setSeparator(bool separator);
79
80 bool isCheckable() const;
81 void setCheckable(bool checkable);
82
83 bool isChecked() const;
84 void setChecked(bool checked);
85
86 QPlatformMenuItem::MenuRole role() const;
87 void setRole(QPlatformMenuItem::MenuRole role);
88
89 QString text() const;
90 void setText(const QString &text);
91
92 QVariant shortcut() const;
93 void setShortcut(const QVariant& shortcut);
94
95 QFont font() const;
96 void setFont(const QFont &font);
97
100
101public Q_SLOTS:
102 void toggle();
103
105 void triggered();
106 void hovered();
107
120 Q_REVISION(2, 1) void iconChanged();
121
122protected:
123 void classBegin() override;
124 void componentComplete() override;
125
127
128 bool event(QEvent *e) override;
130 void activate();
131 void updateIcon();
132
133private:
134 void addShortcut();
135 void removeShortcut();
136
137 bool m_complete;
138 bool m_enabled;
139 bool m_visible;
140 bool m_separator;
141 bool m_checkable;
142 bool m_checked;
143 QPlatformMenuItem::MenuRole m_role;
144 QString m_text;
145 QVariant m_shortcut;
146 QFont m_font;
148 QQuickLabsPlatformMenu *m_subMenu;
150 mutable QQuickLabsPlatformIconLoader *m_iconLoader;
151 QPlatformMenuItem *m_handle;
152 int m_shortcutId = -1;
153
156};
157
159
160#endif // QQUICKLABSPLATFORMMENUITEM_P_H
\inmodule QtCore
Definition qcoreevent.h:45
\reentrant
Definition qfont.h:22
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
The QQmlParserStatus class provides updates on the QML parser state.
QQuickLabsPlatformIconLoader * iconLoader() const
bool isChecked() const
\qmlproperty bool Qt.labs.platform::MenuItem::checked
void setIcon(const QQuickLabsPlatformIcon &icon)
bool isCheckable() const
\qmlproperty bool Qt.labs.platform::MenuItem::checkable
bool isEnabled() const
\qmlproperty bool Qt.labs.platform::MenuItem::enabled
void setRole(QPlatformMenuItem::MenuRole role)
void setMenu(QQuickLabsPlatformMenu *menu)
void setSubMenu(QQuickLabsPlatformMenu *menu)
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
bool isVisible() const
\qmlproperty bool Qt.labs.platform::MenuItem::visible
void setGroup(QQuickLabsPlatformMenuItemGroup *group)
bool isSeparator() const
\qmlproperty bool Qt.labs.platform::MenuItem::separator
void classBegin() override
Invoked after class creation, but before any properties have been set.
void toggle()
\qmlmethod void Qt.labs.platform::MenuItem::toggle()
void setShortcut(const QVariant &shortcut)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
GLuint64 GLenum void * handle
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLboolean GLuint group
struct _cl_event * event
#define QML_NAMED_ELEMENT(NAME)
#define QML_EXTENDED_NAMESPACE(EXTENDED_NAMESPACE)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_INTERFACES(x)
#define Q_SLOTS
#define Q_SIGNALS
#define explicit