diff options
| author | Vladimir Belyavsky <belyavskyv@gmail.com> | 2023-11-11 22:34:10 +0300 |
|---|---|---|
| committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-11-13 09:13:18 +0000 |
| commit | 3ad1980ef5d07c23a00cb678ceab54a1d8ca1279 (patch) | |
| tree | 2cb72b236d5fd2f60cc2d44f889736eff98f6199 /src/labs/platform/qquicklabsplatformsystemtrayicon.cpp | |
| parent | 7a38cc04ffa8f3b8e4d65094c86085b271d43ac9 (diff) | |
QML SystemTrayIcon: Allow resetting tray icon menu
Fix QQuickLabsPlatformSystemTrayIcon::setMenu() logic to allow resetting
the tray icon menu. Now we correctly handle `nullptr` menu passed to the
function, and update underlying QPlatformSystemTrayIcon instance
accordingly.
Fixes: QTBUG-119065
Pick-to: 6.6 6.5
Change-Id: Ief6445f4854ff2f59809be315f373e0c1755652b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/labs/platform/qquicklabsplatformsystemtrayicon.cpp')
| -rw-r--r-- | src/labs/platform/qquicklabsplatformsystemtrayicon.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/labs/platform/qquicklabsplatformsystemtrayicon.cpp b/src/labs/platform/qquicklabsplatformsystemtrayicon.cpp index fa430a69e6..dee37a50f7 100644 --- a/src/labs/platform/qquicklabsplatformsystemtrayicon.cpp +++ b/src/labs/platform/qquicklabsplatformsystemtrayicon.cpp @@ -258,10 +258,15 @@ void QQuickLabsPlatformSystemTrayIcon::setMenu(QQuickLabsPlatformMenu *menu) if (m_menu) m_menu->setSystemTrayIcon(nullptr); - if (menu) { + + if (menu) menu->setSystemTrayIcon(this); - if (m_handle && m_complete && menu->create()) + + if (m_handle && m_complete) { + if (menu && menu->create()) m_handle->updateMenu(menu->handle()); + else + m_handle->updateMenu(nullptr); } m_menu = menu; |
