Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Hiding qml Window
Forum Updated to NodeBB v4.3 + New Features

Hiding qml Window

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 498 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.
  • V Offline
    V Offline
    valeryz
    wrote on last edited by p3c0
    #1

    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

    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