aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/platform/qquickplatformmenuitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/platform/qquickplatformmenuitem.cpp')
-rw-r--r--src/imports/platform/qquickplatformmenuitem.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/imports/platform/qquickplatformmenuitem.cpp b/src/imports/platform/qquickplatformmenuitem.cpp
index 61a4daab..bc6d97e1 100644
--- a/src/imports/platform/qquickplatformmenuitem.cpp
+++ b/src/imports/platform/qquickplatformmenuitem.cpp
@@ -144,10 +144,8 @@ QPlatformMenuItem *QQuickPlatformMenuItem::create()
m_handle = QWidgetPlatform::createMenuItem();
if (m_handle) {
- connect(m_handle, &QPlatformMenuItem::activated, this, &QQuickPlatformMenuItem::triggered);
+ connect(m_handle, &QPlatformMenuItem::activated, this, &QQuickPlatformMenuItem::activate);
connect(m_handle, &QPlatformMenuItem::hovered, this, &QQuickPlatformMenuItem::hovered);
- if (m_checkable)
- connect(m_handle, &QPlatformMenuItem::activated, this, &QQuickPlatformMenuItem::toggle);
}
}
return m_handle;
@@ -354,13 +352,6 @@ void QQuickPlatformMenuItem::setCheckable(bool checkable)
if (m_checkable == checkable)
return;
- if (m_handle) {
- if (checkable)
- connect(m_handle, &QPlatformMenuItem::activated, this, &QQuickPlatformMenuItem::toggle);
- else
- disconnect(m_handle, &QPlatformMenuItem::activated, this, &QQuickPlatformMenuItem::toggle);
- }
-
m_checkable = checkable;
sync();
emit checkableChanged();
@@ -602,6 +593,12 @@ QQuickPlatformIconLoader *QQuickPlatformMenuItem::iconLoader() const
return m_iconLoader;
}
+void QQuickPlatformMenuItem::activate()
+{
+ toggle();
+ emit triggered();
+}
+
void QQuickPlatformMenuItem::updateIcon()
{
if (!m_handle || !m_iconLoader)