Hi,

I’m toying with QtQuick and QML for a few days and found that the reason is 
always 3 no matter how I click the icon in the following code;

import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Window 2.2
import Qt.labs.platform 1.0

Window {
    id: root
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
    SystemTrayIcon {
        id: trayIcon
        visible: true
        iconSource: "qrc:/icon.png"

        onActivated: {
            console.log("reason: " + reason)
            if(reason === 1){
                trayMenu.open()
            } else {
                if(root.visibility === Window.Hidden){
                    root.show()
                    root.raise()
                    root.requestActivate()
                } else {
                    root.hide()
                }
            }
        }
    }

    Menu {
        id:trayMenu
        enabled: true
        MenuItem {
            text: qsTr("Quit")
            onTriggered: Qt.quit()
        }
    }
}

is there a way to fix this? (trying on macos but want it to work cross platform 
eventually)

Regards,

Emre Besirik
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to