Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. On ubuntu,QML SystemTrayIcon set visible value false, icon no hidden

On ubuntu,QML SystemTrayIcon set visible value false, icon no hidden

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 167 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gerry724
    wrote on last edited by
    #1

    According to the code written in the official documentation, it works normally on other Macs. If Ubuntu displays it, it cannot be hidden. Solve the problem

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gerry724
        wrote on last edited by gerry724
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved