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. Exact width of an ApplicationWindow
Qt 6.11 is out! See what's new in the release blog

Exact width of an ApplicationWindow

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.7k Views 1 Watching
  • 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.
  • R Offline
    R Offline
    redmars
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • 4 Offline
      4 Offline
      416365416c
      wrote on last edited by
      #2

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

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

        @setWindowState(Qt::WindowFullScreen);@

        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