On ubuntu,QML SystemTrayIcon set visible value false, icon no hidden
Unsolved
QML and Qt Quick
-
Hi and welcome to devnet,
There's not enough details to get started.
Which version of Qt ?
On which version of Ubuntu ?
Using which desktop manager ?
Etc. -
Hi, On Qt 5.15.9 version,Ubuntu 22.04 , GNOME Desktop Manager.
SystemTrayIcon{ id: sysTray visible: systemTrayMode iconSource: "../image/logo.png" menu: Menu { MenuItem { text: qsTr("Show Application") onTriggered: { mainwindow.show() mainwindow.raise() mainwindow.requestActivate() } } MenuSeparator{ } MenuItem { text: qsTr("Quit") onTriggered: Qt.quit() } } onActivated: { if(Qt.platform.os !== "osx"){ mainwindow.show() mainwindow.raise() mainwindow.requestActivate() } } onMessageClicked: { mainwindow.show() mainwindow.raise() mainwindow.requestActivate() } Component.onCompleted: { } } Connections{ target: AppSettings function onHasSystemTrayIconChanged() { if (systemTrayMode) { sysTray.show() } else { sysTray.hide() } } }
After sysTray is displayed, no matter how the systemTrayMode changes, sysTray will not hide.