Qt 6.x
The Qt SDK
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)
43 Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL)
44 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
47 Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY checkedChanged 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:
55 explicit QQuickLabsPlatformMenuItem(QObject *parent = nullptr);
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
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
161
162#endif // QQUICKLABSPLATFORMMENUITEM_P_H
\inmodule QtCore
Definition qcoreevent.h:45
\reentrant
Definition qfont.h:20
\inmodule QtCore
Definition qobject.h:90
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:311
The QQmlParserStatus class provides updates on the QML parser state.
QQuickLabsPlatformIconLoader * iconLoader() const
QQuickLabsPlatformMenuItemGroup * group
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
Q_REVISION(2, 1) void iconChanged()
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:127
\inmodule QtCore
Definition qvariant.h:64
double e
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLboolean GLuint group
struct _cl_event * event
#define QML_DECLARE_TYPE(TYPE)
Definition qqml.h:19
#define QML_NAMED_ELEMENT(NAME)
#define QML_EXTENDED_NAMESPACE(EXTENDED_NAMESPACE)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INTERFACES(x)
#define Q_SLOTS
#define Q_SIGNALS