diff options
| author | Vladimir Belyavsky <belyavskyv@gmail.com> | 2022-04-30 13:40:09 +0300 |
|---|---|---|
| committer | Vladimir Belyavsky <belyavskyv@gmail.com> | 2022-05-02 19:58:59 +0000 |
| commit | fce525fc789d4835476be6f42df16edfa7aec270 (patch) | |
| tree | 7f03a58e1560539db901dba8a8486c48438b2310 /src/labs/platform/qquicklabsplatformmenuitem.cpp | |
| parent | 089c3b15b95fc0ddbf2385378f96702a999771c8 (diff) | |
labs.platform: fix displaying of icons in platform Menu
Looks like it didn't work from the start:
platform backend (m_handle) has not yet been created by the time
creating a MenuItem component, so m_handle->setIcon() was never called.
To make it work and also to make it consistent with syncing of
all other properties, let's move m_handle->setIcon() into sync() method.
Fixes: QTBUG-103017
Pick-to: 6.2 6.3
Change-Id: Ib457735c840a8621a16ec6363a0c19f0c21fae3b
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/labs/platform/qquicklabsplatformmenuitem.cpp')
| -rw-r--r-- | src/labs/platform/qquicklabsplatformmenuitem.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/labs/platform/qquicklabsplatformmenuitem.cpp b/src/labs/platform/qquicklabsplatformmenuitem.cpp index dc5e180f94..ece434455a 100644 --- a/src/labs/platform/qquicklabsplatformmenuitem.cpp +++ b/src/labs/platform/qquicklabsplatformmenuitem.cpp @@ -181,6 +181,10 @@ void QQuickLabsPlatformMenuItem::sync() m_handle->setText(m_text); m_handle->setFont(m_font); m_handle->setHasExclusiveGroup(m_group && m_group->isExclusive()); + + if (m_iconLoader) + m_handle->setIcon(m_iconLoader->toQIcon()); + if (m_subMenu) { // Sync first as dynamically created menus may need to get the // handle recreated @@ -607,7 +611,7 @@ void QQuickLabsPlatformMenuItem::classBegin() void QQuickLabsPlatformMenuItem::componentComplete() { - if (m_handle && m_iconLoader) + if (m_iconLoader) m_iconLoader->setEnabled(true); m_complete = true; sync(); @@ -632,10 +636,6 @@ void QQuickLabsPlatformMenuItem::activate() void QQuickLabsPlatformMenuItem::updateIcon() { - if (!m_handle || !m_iconLoader) - return; - - m_handle->setIcon(m_iconLoader->toQIcon()); sync(); } |
