Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qquicklabsplatformmenu_p.h
Go to the documentation of this file.
1
// Copyright (C) 2020 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
QQUICKLABSPLATFORMMENU_P_H
6
#
define
QQUICKLABSPLATFORMMENU_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
<
QtCore
/
qloggingcategory
.
h
>
20
#
include
<
QtCore
/
qobject
.
h
>
21
#
include
<
QtCore
/
qurl
.
h
>
22
#
include
<
QtGui
/
qfont
.
h
>
23
#
include
<
QtGui
/
qpa
/
qplatformmenu
.
h
>
24
#
include
<
QtQml
/
qqmlparserstatus
.
h
>
25
#
include
<
QtQml
/
qqmllist
.
h
>
26
#
include
<
QtQml
/
qqml
.
h
>
27
28
#
include
"qquicklabsplatformicon_p.h"
29
30
QT_BEGIN_NAMESPACE
31
32
Q_DECLARE_LOGGING_CATEGORY(qtLabsPlatformMenus)
33
34
class
QIcon;
35
class
QWindow;
36
class
QQuickItem;
37
class
QPlatformMenu;
38
class
QQuickLabsPlatformMenuBar
;
39
class
QQuickLabsPlatformMenuItem
;
40
class
QQuickLabsPlatformIconLoader
;
41
class
QQuickLabsPlatformSystemTrayIcon
;
42
43
class
QQuickLabsPlatformMenu
:
public
QObject
,
public
QQmlParserStatus
44
{
45
Q_OBJECT
46
QML_NAMED_ELEMENT(Menu)
47
QML_ADDED_IN_VERSION
(1, 0)
48
QML_EXTENDED_NAMESPACE
(
QPlatformMenu
)
49
Q_INTERFACES
(
QQmlParserStatus
)
50
Q_PROPERTY
(
QQmlListProperty
<
QObject
>
data
READ
data
FINAL
)
51
Q_PROPERTY
(
QQmlListProperty
<
QQuickLabsPlatformMenuItem
>
items
READ
items
NOTIFY
itemsChanged
FINAL
)
52
Q_PROPERTY
(
QQuickLabsPlatformMenuBar
*
menuBar
READ
menuBar
NOTIFY
menuBarChanged
FINAL
)
53
Q_PROPERTY
(
QQuickLabsPlatformMenu
*
parentMenu
READ
parentMenu
NOTIFY
parentMenuChanged
FINAL
)
54
#
if
QT_CONFIG
(
systemtrayicon
)
55
Q_PROPERTY
(
QQuickLabsPlatformSystemTrayIcon
*
systemTrayIcon
READ
systemTrayIcon
NOTIFY
systemTrayIconChanged
FINAL
)
56
#
endif
57
Q_PROPERTY
(
QQuickLabsPlatformMenuItem
*
menuItem
READ
menuItem
CONSTANT
FINAL
)
58
Q_PROPERTY
(
bool
enabled
READ
isEnabled
WRITE
setEnabled
NOTIFY
enabledChanged
FINAL
)
59
Q_PROPERTY
(
bool
visible
READ
isVisible
WRITE
setVisible
NOTIFY
visibleChanged
FINAL
)
60
Q_PROPERTY
(
int
minimumWidth
READ
minimumWidth
WRITE
setMinimumWidth
NOTIFY
minimumWidthChanged
FINAL
)
61
Q_PROPERTY
(
QPlatformMenu
::
MenuType
type
READ
type
WRITE
setType
NOTIFY
typeChanged
FINAL
)
62
Q_PROPERTY
(
QString
title
READ
title
WRITE
setTitle
NOTIFY
titleChanged
FINAL
)
63
Q_PROPERTY
(
QFont
font
READ
font
WRITE
setFont
NOTIFY
fontChanged
FINAL
)
64
Q_PROPERTY
(
QQuickLabsPlatformIcon
icon
READ
icon
WRITE
setIcon
NOTIFY
iconChanged
FINAL
REVISION
(1, 1))
65
Q_CLASSINFO
(
"DefaultProperty"
,
"data"
)
66
67
public
:
68
explicit
QQuickLabsPlatformMenu
(
QObject
*
parent
=
nullptr
);
69
~
QQuickLabsPlatformMenu
();
70
71
QPlatformMenu *
handle
()
const
;
72
QPlatformMenu *
create
();
73
void
destroy
();
74
void
sync
();
75
76
QQmlListProperty
<
QObject
>
data
();
77
QQmlListProperty
<
QQuickLabsPlatformMenuItem
>
items
();
78
79
QQuickLabsPlatformMenuBar
*
menuBar
()
const
;
80
void
setMenuBar
(
QQuickLabsPlatformMenuBar
*menuBar);
81
82
QQuickLabsPlatformMenu
*
parentMenu
()
const
;
83
void
setParentMenu
(
QQuickLabsPlatformMenu
*menu);
84
85
#
if
QT_CONFIG
(
systemtrayicon
)
86
QQuickLabsPlatformSystemTrayIcon
*
systemTrayIcon
()
const
;
87
void
setSystemTrayIcon
(
QQuickLabsPlatformSystemTrayIcon
*
icon
);
88
#
endif
89
90
QQuickLabsPlatformMenuItem
*
menuItem
()
const
;
91
92
bool
isEnabled
()
const
;
93
void
setEnabled
(
bool
enabled);
94
95
bool
isVisible
()
const
;
96
void
setVisible
(
bool
visible);
97
98
int
minimumWidth
()
const
;
99
void
setMinimumWidth
(
int
width);
100
101
QPlatformMenu
::
MenuType
type
()
const
;
102
void
setType
(QPlatformMenu::MenuType type);
103
104
QString
title
()
const
;
105
void
setTitle
(
const
QString &title);
106
107
QFont
font
()
const
;
108
void
setFont
(
const
QFont &font);
109
110
QQuickLabsPlatformIcon
icon
()
const
;
111
void
setIcon
(
const
QQuickLabsPlatformIcon
&icon);
112
113
Q_INVOKABLE
void
addItem
(
QQuickLabsPlatformMenuItem
*item);
114
Q_INVOKABLE
void
insertItem
(
int
index,
QQuickLabsPlatformMenuItem
*item);
115
Q_INVOKABLE
void
removeItem
(
QQuickLabsPlatformMenuItem
*item);
116
117
Q_INVOKABLE
void
addMenu
(
QQuickLabsPlatformMenu
*menu);
118
Q_INVOKABLE
void
insertMenu
(
int
index,
QQuickLabsPlatformMenu
*menu);
119
Q_INVOKABLE
void
removeMenu
(
QQuickLabsPlatformMenu
*menu);
120
121
Q_INVOKABLE
void
clear
();
122
123
public
Q_SLOTS
:
124
void
open
(
QQmlV4FunctionPtr
args
);
125
void
close
();
126
127
Q_SIGNALS
:
128
void
aboutToShow
();
129
void
aboutToHide
();
130
131
void
itemsChanged
();
132
void
menuBarChanged
();
133
void
parentMenuChanged
();
134
void
systemTrayIconChanged
();
135
void
titleChanged
();
136
void
enabledChanged
();
137
void
visibleChanged
();
138
void
minimumWidthChanged
();
139
void
fontChanged
();
140
void
typeChanged
();
141
Q_REVISION
(1, 1)
void
iconChanged
();
142
143
protected
:
144
void
classBegin
()
override
;
145
void
componentComplete
()
override
;
146
147
QQuickLabsPlatformIconLoader
*
iconLoader
()
const
;
148
149
QWindow *
findWindow
(QQuickItem *target, QPoint *offset)
const
;
150
151
static
void
data_append
(QQmlListProperty<QObject> *property, QObject *object);
152
static
qsizetype
data_count
(QQmlListProperty<QObject> *property);
153
static
QObject *
data_at
(QQmlListProperty<QObject> *property, qsizetype index);
154
static
void
data_clear
(QQmlListProperty<QObject> *property);
155
156
static
void
items_append
(QQmlListProperty<QQuickLabsPlatformMenuItem> *property,
QQuickLabsPlatformMenuItem
*item);
157
static
qsizetype
items_count
(QQmlListProperty<QQuickLabsPlatformMenuItem> *property);
158
static
QQuickLabsPlatformMenuItem
*
items_at
(QQmlListProperty<QQuickLabsPlatformMenuItem> *property, qsizetype index);
159
static
void
items_clear
(QQmlListProperty<QQuickLabsPlatformMenuItem> *property);
160
161
private
Q_SLOTS
:
162
void
updateIcon
();
163
164
private
:
165
void
unparentSubmenus();
166
167
bool
m_complete;
168
bool
m_enabled;
169
bool
m_visible;
170
int
m_minimumWidth;
171
QPlatformMenu::MenuType m_type;
172
QString m_title;
173
QFont m_font;
174
QList<QObject *> m_data;
175
QList<QQuickLabsPlatformMenuItem *> m_items;
176
QQuickLabsPlatformMenuBar
*m_menuBar;
177
QQuickLabsPlatformMenu
*m_parentMenu;
178
QQuickLabsPlatformSystemTrayIcon
*m_systemTrayIcon;
179
mutable
QQuickLabsPlatformMenuItem
*m_menuItem;
180
mutable
QQuickLabsPlatformIconLoader
*m_iconLoader;
181
QPlatformMenu *m_handle;
182
};
183
184
QT_END_NAMESPACE
185
186
#
endif
// QQUICKLABSPLATFORMMENU_P_H
QQuickLabsPlatformIconLoader
Definition
qquicklabsplatformiconloader_p.h:31
QQuickLabsPlatformIconLoader::setIcon
void setIcon(const QQuickLabsPlatformIcon &icon)
Definition
qquicklabsplatformiconloader.cpp:46
QQuickLabsPlatformIconLoader::icon
QQuickLabsPlatformIcon icon() const
Definition
qquicklabsplatformiconloader.cpp:41
QQuickLabsPlatformIconLoader::setEnabled
void setEnabled(bool enabled)
Definition
qquicklabsplatformiconloader.cpp:26
QQuickLabsPlatformIcon
Definition
qquicklabsplatformicon_p.h:30
QQuickLabsPlatformIcon::operator==
bool operator==(const QQuickLabsPlatformIcon &other) const
Definition
qquicklabsplatformicon.cpp:39
QQuickLabsPlatformMenuBar
Definition
qquicklabsplatformmenubar_p.h:32
QQuickLabsPlatformMenuBar::handle
QPlatformMenuBar * handle() const
Definition
qquicklabsplatformmenubar.cpp:93
QQuickLabsPlatformMenuItem
Definition
qquicklabsplatformmenuitem_p.h:36
QQuickLabsPlatformMenuItem::setVisible
void setVisible(bool visible)
Definition
qquicklabsplatformmenuitem.cpp:288
QQuickLabsPlatformMenuItem::setIcon
void setIcon(const QQuickLabsPlatformIcon &icon)
Definition
qquicklabsplatformmenuitem.cpp:533
QQuickLabsPlatformMenuItem::setMenu
void setMenu(QQuickLabsPlatformMenu *menu)
Definition
qquicklabsplatformmenuitem.cpp:180
QQuickLabsPlatformMenuItem::setEnabled
void setEnabled(bool enabled)
Definition
qquicklabsplatformmenuitem.cpp:259
QQuickLabsPlatformMenuItem::setSubMenu
void setSubMenu(QQuickLabsPlatformMenu *menu)
Definition
qquicklabsplatformmenuitem.cpp:201
QQuickLabsPlatformMenuItem::componentComplete
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
Definition
qquicklabsplatformmenuitem.cpp:557
QQuickLabsPlatformMenuItem::create
QPlatformMenuItem * create()
Definition
qquicklabsplatformmenuitem.cpp:107
QQuickLabsPlatformMenuItem::handle
QPlatformMenuItem * handle() const
Definition
qquicklabsplatformmenuitem.cpp:102
QQuickLabsPlatformMenu
Definition
qquicklabsplatformmenu_p.h:44
QQuickLabsPlatformMenu::items_at
static QQuickLabsPlatformMenuItem * items_at(QQmlListProperty< QQuickLabsPlatformMenuItem > *property, qsizetype index)
Definition
qquicklabsplatformmenu.cpp:812
QQuickLabsPlatformMenu::sync
void sync()
Definition
qquicklabsplatformmenu.cpp:233
QQuickLabsPlatformMenu::data_at
static QObject * data_at(QQmlListProperty< QObject > *property, qsizetype index)
Definition
qquicklabsplatformmenu.cpp:788
QQuickLabsPlatformMenu::items_append
static void items_append(QQmlListProperty< QQuickLabsPlatformMenuItem > *property, QQuickLabsPlatformMenuItem *item)
Definition
qquicklabsplatformmenu.cpp:800
QQuickLabsPlatformMenu::Q_REVISION
Q_REVISION(1, 1) void iconChanged()
QQuickLabsPlatformMenu::menuBar
QQuickLabsPlatformMenuBar * menuBar() const
\readonly \qmlproperty MenuBar Qt.labs.platform::Menu::menuBar
Definition
qquicklabsplatformmenu.cpp:288
QQuickLabsPlatformMenu::isVisible
bool isVisible() const
\qmlproperty bool Qt.labs.platform::Menu::visible
Definition
qquicklabsplatformmenu.cpp:398
QQuickLabsPlatformMenu::insertItem
Q_INVOKABLE void insertItem(int index, QQuickLabsPlatformMenuItem *item)
\qmlmethod void Qt.labs.platform::Menu::insertItem(int index, MenuItem item)
Definition
qquicklabsplatformmenu.cpp:548
QQuickLabsPlatformMenu::minimumWidthChanged
void minimumWidthChanged()
QQuickLabsPlatformMenu::font
QFont font() const
\qmlproperty font Qt.labs.platform::Menu::font
Definition
qquicklabsplatformmenu.cpp:490
QQuickLabsPlatformMenu::items_clear
static void items_clear(QQmlListProperty< QQuickLabsPlatformMenuItem > *property)
Definition
qquicklabsplatformmenu.cpp:818
QQuickLabsPlatformMenu::title
QString title() const
\qmlproperty string Qt.labs.platform::Menu::title
Definition
qquicklabsplatformmenu.cpp:465
QQuickLabsPlatformMenu::setMinimumWidth
void setMinimumWidth(int width)
Definition
qquicklabsplatformmenu.cpp:426
QQuickLabsPlatformMenu::removeMenu
Q_INVOKABLE void removeMenu(QQuickLabsPlatformMenu *menu)
\qmlmethod void Qt.labs.platform::Menu::removeMenu(Menu submenu)
Definition
qquicklabsplatformmenu.cpp:611
QQuickLabsPlatformMenu::fontChanged
void fontChanged()
QQuickLabsPlatformMenu::create
QPlatformMenu * create()
Definition
qquicklabsplatformmenu.cpp:180
QQuickLabsPlatformMenu::data_count
static qsizetype data_count(QQmlListProperty< QObject > *property)
Definition
qquicklabsplatformmenu.cpp:782
QQuickLabsPlatformMenu::icon
QQuickLabsPlatformIcon icon() const
Definition
qquicklabsplatformmenu.cpp:513
QQuickLabsPlatformMenu::iconLoader
QQuickLabsPlatformIconLoader * iconLoader() const
Definition
qquicklabsplatformmenu.cpp:726
QQuickLabsPlatformMenu::setVisible
void setVisible(bool visible)
Definition
qquicklabsplatformmenu.cpp:403
QQuickLabsPlatformMenu::parentMenu
QQuickLabsPlatformMenu * parentMenu() const
\readonly \qmlproperty Menu Qt.labs.platform::Menu::parentMenu
Definition
qquicklabsplatformmenu.cpp:310
QQuickLabsPlatformMenu::typeChanged
void typeChanged()
QQuickLabsPlatformMenu::addMenu
Q_INVOKABLE void addMenu(QQuickLabsPlatformMenu *menu)
\qmlmethod void Qt.labs.platform::Menu::addMenu(Menu submenu)
Definition
qquicklabsplatformmenu.cpp:587
QQuickLabsPlatformMenu::removeItem
Q_INVOKABLE void removeItem(QQuickLabsPlatformMenuItem *item)
\qmlmethod void Qt.labs.platform::Menu::removeItem(MenuItem item)
Definition
qquicklabsplatformmenu.cpp:569
QQuickLabsPlatformMenu::setIcon
void setIcon(const QQuickLabsPlatformIcon &icon)
Definition
qquicklabsplatformmenu.cpp:521
QQuickLabsPlatformMenu::items_count
static qsizetype items_count(QQmlListProperty< QQuickLabsPlatformMenuItem > *property)
Definition
qquicklabsplatformmenu.cpp:806
QQuickLabsPlatformMenu::setEnabled
void setEnabled(bool enabled)
Definition
qquicklabsplatformmenu.cpp:380
QQuickLabsPlatformMenu::clear
Q_INVOKABLE void clear()
\qmlmethod void Qt.labs.platform::Menu::clear()
Definition
qquicklabsplatformmenu.cpp:625
QQuickLabsPlatformMenu::setFont
void setFont(const QFont &font)
Definition
qquicklabsplatformmenu.cpp:495
QQuickLabsPlatformMenu::componentComplete
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
Definition
qquicklabsplatformmenu.cpp:718
QQuickLabsPlatformMenu::addItem
Q_INVOKABLE void addItem(QQuickLabsPlatformMenuItem *item)
\qmlmethod void Qt.labs.platform::Menu::addItem(MenuItem item)
Definition
qquicklabsplatformmenu.cpp:538
QQuickLabsPlatformMenu::setType
void setType(QPlatformMenu::MenuType type)
Definition
qquicklabsplatformmenu.cpp:450
QQuickLabsPlatformMenu::data_append
static void data_append(QQmlListProperty< QObject > *property, QObject *object)
Definition
qquicklabsplatformmenu.cpp:771
QQuickLabsPlatformMenu::visibleChanged
void visibleChanged()
QQuickLabsPlatformMenu::data
QQmlListProperty< QObject > data()
QQuickLabsPlatformMenu::insertMenu
Q_INVOKABLE void insertMenu(int index, QQuickLabsPlatformMenu *menu)
\qmlmethod void Qt.labs.platform::Menu::insertMenu(int index, Menu submenu)
Definition
qquicklabsplatformmenu.cpp:597
QQuickLabsPlatformMenu::enabledChanged
void enabledChanged()
QQuickLabsPlatformMenu::~QQuickLabsPlatformMenu
~QQuickLabsPlatformMenu()
Definition
qquicklabsplatformmenu.cpp:151
QQuickLabsPlatformMenu::minimumWidth
int minimumWidth() const
\qmlproperty int Qt.labs.platform::Menu::minimumWidth
Definition
qquicklabsplatformmenu.cpp:421
QQuickLabsPlatformMenu::type
QPlatformMenu::MenuType type() const
\qmlproperty enumeration Qt.labs.platform::Menu::type
Definition
qquicklabsplatformmenu.cpp:445
QQuickLabsPlatformMenu::menuItem
QQuickLabsPlatformMenuItem * menuItem() const
\readonly \qmlproperty MenuItem Qt.labs.platform::Menu::menuItem
Definition
qquicklabsplatformmenu.cpp:355
QQuickLabsPlatformMenu::titleChanged
void titleChanged()
QQuickLabsPlatformMenu::items
QQmlListProperty< QQuickLabsPlatformMenuItem > items()
QQuickLabsPlatformMenu::data_clear
static void data_clear(QQmlListProperty< QObject > *property)
Definition
qquicklabsplatformmenu.cpp:794
QQuickLabsPlatformMenu::handle
QPlatformMenu * handle() const
Definition
qquicklabsplatformmenu.cpp:175
QQuickLabsPlatformMenu::close
void close()
\qmlmethod void Qt.labs.platform::Menu::close()
Definition
qquicklabsplatformmenu.cpp:708
QQuickLabsPlatformMenu::isEnabled
bool isEnabled() const
\qmlproperty bool Qt.labs.platform::Menu::enabled
Definition
qquicklabsplatformmenu.cpp:375
QQuickLabsPlatformMenu::aboutToHide
void aboutToHide()
QQuickLabsPlatformMenu::itemsChanged
void itemsChanged()
QQuickLabsPlatformMenu::classBegin
void classBegin() override
Invoked after class creation, but before any properties have been set.
Definition
qquicklabsplatformmenu.cpp:714
QQuickLabsPlatformMenu::setMenuBar
void setMenuBar(QQuickLabsPlatformMenuBar *menuBar)
Definition
qquicklabsplatformmenu.cpp:293
QQuickLabsPlatformMenu::parentMenuChanged
void parentMenuChanged()
QQuickLabsPlatformMenu::menuBarChanged
void menuBarChanged()
QQuickLabsPlatformMenu::setTitle
void setTitle(const QString &title)
Definition
qquicklabsplatformmenu.cpp:470
QQuickLabsPlatformMenu::setParentMenu
void setParentMenu(QQuickLabsPlatformMenu *menu)
Definition
qquicklabsplatformmenu.cpp:315
QQuickLabsPlatformMenu::findWindow
QWindow * findWindow(QQuickItem *target, QPoint *offset) const
Definition
qquicklabsplatformmenu.cpp:748
QQuickLabsPlatformMenu::systemTrayIconChanged
void systemTrayIconChanged()
QQuickLabsPlatformMenu::destroy
void destroy()
Definition
qquicklabsplatformmenu.cpp:220
QQuickLabsPlatformSystemTrayIcon
Definition
qquicklabsplatformsystemtrayicon_p.h:35
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QWidgetPlatform
Definition
qwidgetplatform_p.h:61
effectiveWindow
static QWindow * effectiveWindow(QWindow *window, QPoint *offset)
Definition
qquicklabsplatformmenu.cpp:737
qtdeclarative
src
labs
platform
qquicklabsplatformmenu_p.h
Generated on
for Qt by
1.18.0