aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/imports/platform/qquickplatformmenuitem.cpp17
-rw-r--r--src/imports/platform/qquickplatformmenuitem_p.h1
2 files changed, 8 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)
diff --git a/src/imports/platform/qquickplatformmenuitem_p.h b/src/imports/platform/qquickplatformmenuitem_p.h
index 0c1a7c6d..6ff3ad81 100644
--- a/src/imports/platform/qquickplatformmenuitem_p.h
+++ b/src/imports/platform/qquickplatformmenuitem_p.h
@@ -161,6 +161,7 @@ protected:
QQuickPlatformIconLoader *iconLoader() const;
private Q_SLOTS:
+ void activate();
void updateIcon();
private: