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
qandroidplatformmenuitem.cpp
Go to the documentation of this file.
1// Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
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
7
9
10QAndroidPlatformMenuItem::QAndroidPlatformMenuItem()
11{
12 m_menu = 0;
13 m_isVisible = true;
14 m_isSeparator = false;
15 m_role = NoRole;
16 m_isCheckable = false;
17 m_isChecked = false;
18 m_isEnabled = true;
19}
20
21void QAndroidPlatformMenuItem::setText(const QString &text)
22{
23 m_text = text;
24 if (m_menu)
25 m_menu->setText(m_text);
26}
27
29{
30 return m_text;
31}
32
33void QAndroidPlatformMenuItem::setIcon(const QIcon &icon)
34{
35 m_icon = icon;
36 if (m_menu)
37 m_menu->setIcon(m_icon);
38}
39
41{
42 return m_icon;
43}
44
45void QAndroidPlatformMenuItem::setMenu(QPlatformMenu *menu)
46{
47 m_menu = static_cast<QAndroidPlatformMenu *>(menu);
48 if (!m_menu)
49 return;
50
51 m_menu->setText(m_text);
52 m_menu->setIcon(m_icon);
53 m_menu->setVisible(m_isVisible);
54 m_menu->setEnabled(m_isEnabled);
55}
56
58{
59 return m_menu;
60}
61
63{
64 m_isVisible = isVisible;
65 if (m_menu)
66 m_menu->setVisible(m_isVisible);
67}
68
70{
71 return m_isVisible;
72}
73
75{
76 m_isSeparator = isSeparator;
77}
78
80{
81 return m_isSeparator;
82}
83
84void QAndroidPlatformMenuItem::setFont(const QFont &font)
85{
86 Q_UNUSED(font);
87}
88
89void QAndroidPlatformMenuItem::setRole(QPlatformMenuItem::MenuRole role)
90{
91 m_role = role;
92}
93
95{
96 return m_role;
97}
98
100{
101 m_isCheckable = checkable;
102}
103
105{
106 return m_isCheckable;
107}
108
110{
111 m_isChecked = isChecked;
112}
113
115{
116 return m_isChecked;
117}
118
119void QAndroidPlatformMenuItem::setShortcut(const QKeySequence &shortcut)
120{
121 Q_UNUSED(shortcut);
122}
123
125{
126 m_isEnabled = enabled;
127 if (m_menu)
128 m_menu->setEnabled(m_isEnabled);
129}
130
132{
133 return m_isEnabled;
134}
135
137{
138 Q_UNUSED(size);
139}
140
141QT_END_NAMESPACE
void setIsSeparator(bool isSeparator) override
void setShortcut(const QKeySequence &shortcut) override
void setIcon(const QIcon &icon) override
void setEnabled(bool enabled) override
void setFont(const QFont &font) override
QAndroidPlatformMenu * menu() const
void setCheckable(bool checkable) override
void setMenu(QPlatformMenu *menu) override
void setChecked(bool isChecked) override
void setIconSize(int size) override
void setVisible(bool isVisible) override
void setEnabled(bool enabled) override
void setVisible(bool visible) override
Combined button and popup list for selecting options.