Exact width of an ApplicationWindow



  • I have an application with "Maximized" ApplicationWindow with width and height defined. How can I get the current size of the window?

    @
    ApplicationWindow {
    id: mainAppWindow
    title: "App Window"
    flags: Qt.FramelessWindowHint | Qt.TransparentMode
    color: "#ebeef0"
    visibility: "Maximized"
    width: 800
    height: 600

    Rectangle {
        anchors.fill: parent
    }
    

    }
    @

    When I try to access mainAppWindow.height, it always returns 600 irrespective of the window visibility state. Is it an expected behaviour? How to get the current size of the window?



  • Try using the dimensions of mainAppWindow.contentItem as a proxy for the window size itself. It's more likely to update.



  • @setWindowState(Qt::WindowFullScreen);@


Log in to reply
 

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