9#include <QtGui/qicon.h>
10#if QT_CONFIG(shortcut)
11#include <QtGui/qkeysequence.h>
13#include <QtGui/qpa/qplatformtheme.h>
14#include <QtGui/private/qguiapplication_p.h>
15#include <QtQuickTemplates2/private/qquickshortcutcontext_p_p.h>
95 m_iconLoader =
nullptr;
107 if (!m_handle && m_menu && m_menu->
handle()) {
127 if (!m_complete || !
create())
151#if QT_CONFIG(shortcut)
153 if (m_shortcut.
metaType().
id() == QMetaType::Int)
155 else if (m_shortcut.
metaType().
id() == QMetaType::QKeySequence)
159 m_handle->setShortcut(sequence.
toString());
162 if (m_menu && m_menu->
handle())
201 if (m_subMenu ==
menu)
222 if (m_group ==
group)
229 group->addItem(
this);
254 return m_enabled && (!m_group || m_group->
isEnabled());
283 return m_visible && (!m_group || m_group->
isVisible());
459#if QT_CONFIG(shortcut)
462 if (se->shortcutId() == m_shortcutId) {
528 return m_iconLoader->
icon();
567 static int slot = staticMetaObject.indexOfSlot(
"updateIcon()");
574void QQuickLabsPlatformMenuItem::activate()
580void QQuickLabsPlatformMenuItem::updateIcon()
585void QQuickLabsPlatformMenuItem::addShortcut()
587#if QT_CONFIG(shortcut)
589 if (m_shortcut.
metaType().
id() == QMetaType::Int)
591 else if (m_shortcut.
metaType().
id() == QMetaType::QKeySequence)
595 if (!sequence.
isEmpty() && m_enabled) {
604void QQuickLabsPlatformMenuItem::removeShortcut()
606#if QT_CONFIG(shortcut)
607 if (m_shortcutId == -1)
611 if (m_shortcut.
metaType().
id() == QMetaType::Int)
613 else if (m_shortcut.
metaType().
id() == QMetaType::QKeySequence)
623#include "moc_qquicklabsplatformmenuitem_p.cpp"
static QGuiApplicationPrivate * instance()
static QPlatformTheme * platformTheme()
The QKeySequence class encapsulates a key sequence as used by shortcuts.
static QKeySequence fromString(const QString &str, SequenceFormat format=PortableText)
bool isEmpty() const
Returns true if the key sequence is empty; otherwise returns false.
QString toString(SequenceFormat format=PortableText) const
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
virtual bool event(QEvent *event)
This virtual function receives events to an object and should return true if the event e was recogniz...
The QShortcutEvent class provides an event which is generated when the user presses a key combination...
\macro QT_RESTRICTED_CAST_FROM_ASCII
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
QMetaType metaType() const
Combined button and popup list for selecting options.
GLenum GLenum GLsizei const GLuint GLboolean enabled
static bool matcher(QObject *object, Qt::ShortcutContext context)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent