Hiding qml Window



  • Hello,

    I was wondering if somebody could help me solve this problem... I have a QApplication (because I have both QWidgets and QML). I am looking for a way to hide a window when user clicks outside the window. The window I would like to hide is QApplicationWindow. Here is what my main.qml looks like:

    Item {
    //window I would like to hide
    QApplicationWindow {
    id: root 
    flags:  Qt.WindowStaysOnTopHint | Qt.Desktop
    ...
    }
    //window I show sometimes.
    Window {
    }
    }
    

    I also have SystemTrayIcon class that shows/hides QApplicationWindow window by emitting signal from cpp and toggling the window in qml.
    Here is what I have in qml

         Connections {
                id: systemTrayIcon
                target: iconController
                onShowMainWindow: {
                    if (loginController.isWebviewVisible() === false) {
                        if (root.visible === true) {
                            root.hide()
                        } else {
                            root.raise()
                            root.show()
                            root.requestActivate()
                        }
                    } else {
                        //For now there is only one other screen
                    }
                }
            }
    

    Any help is greatly appreciated


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.