Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Size of ApplicationWindow
Qt 6.11 is out! See what's new in the release blog

Size of ApplicationWindow

Scheduled Pinned Locked Moved Solved QML and Qt Quick
12 Posts 2 Posters 7.0k 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.
  • dheerendraD Offline
    dheerendraD Offline
    dheerendra
    Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
    wrote on last edited by
    #2

    sample code please ?

    Dheerendra
    @Community Service
    Certified Qt Specialist
    https://www.pthinks.com

    A 1 Reply Last reply
    1
    • dheerendraD dheerendra

      sample code please ?

      A Offline
      A Offline
      Arkning
      wrote on last edited by
      #3

      @dheerendra ApplicationWindow {
      id: mainWindow
      visible: true
      width: maximumWidth
      height: maximumHeight
      minimumWidth: 1500
      minimumHeight: 1000
      }

      1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
        wrote on last edited by
        #4

        Can you try creating new QML UI application and set some width/height like this see ? E.g I tried something like on the mac. I did not see any problem. Since you are facing the problem you can some new program like the follows. It may be crashing for something else.

        ApplicationWindow {
        visible: true
        width: 640
        height: 480
        minimumHeight: 800
        minimumWidth: 800
        title: qsTr("Hello World")

        }

        Which platform you are trying ?

        Dheerendra
        @Community Service
        Certified Qt Specialist
        https://www.pthinks.com

        A 1 Reply Last reply
        2
        • dheerendraD dheerendra

          Can you try creating new QML UI application and set some width/height like this see ? E.g I tried something like on the mac. I did not see any problem. Since you are facing the problem you can some new program like the follows. It may be crashing for something else.

          ApplicationWindow {
          visible: true
          width: 640
          height: 480
          minimumHeight: 800
          minimumWidth: 800
          title: qsTr("Hello World")

          }

          Which platform you are trying ?

          A Offline
          A Offline
          Arkning
          wrote on last edited by
          #5

          @dheerendra The problem I guess it's not the platform but i'm on CentOs 7, and the code that I send above work it doesn't work when I do :
          ApplicationWindow {
          id: mainWindow
          visible: true
          width: maximumWidth
          height: maximumHeight
          minimumWidth: maximumWidth - 200
          minimumHeight: maximumHeight - 200
          }

          The value 200 is just an example whatever the value is, it doesn't work so the question was why maximum Width and Height can't be use in minimum Width and Height ?

          1 Reply Last reply
          0
          • dheerendraD Offline
            dheerendraD Offline
            dheerendra
            Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
            wrote on last edited by
            #6

            what is the value assigned for maximumWidth and maximumHeight ? U need to explicitly assign the value for it. Try assigning the
            maximumWidth = 1000;
            maximumHeight = 1000;

            After this it should work. Once U confirm I will tell you why it crashes.

            Dheerendra
            @Community Service
            Certified Qt Specialist
            https://www.pthinks.com

            A 1 Reply Last reply
            1
            • dheerendraD dheerendra

              what is the value assigned for maximumWidth and maximumHeight ? U need to explicitly assign the value for it. Try assigning the
              maximumWidth = 1000;
              maximumHeight = 1000;

              After this it should work. Once U confirm I will tell you why it crashes.

              A Offline
              A Offline
              Arkning
              wrote on last edited by
              #7

              @dheerendra I don't know the value depends on the size of your screen (those value aren't value that I have created but they are macro, I guess, that have the size of your screen)

              1 Reply Last reply
              0
              • dheerendraD Offline
                dheerendraD Offline
                dheerendra
                Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
                wrote on last edited by dheerendra
                #8

                Can you confirm what is the values of maximumWidth and maximumHeight ? Just print them & check ? Which macro is calculating these values ? Are you assigning Screen.Width and Screen.Height to maximumWidth and maximumHeight ?

                ApplicationWindow {
                id : top
                visible: true
                // width: maximumWidth
                // height: maximumHeight
                width: 300
                height: 400
                minimumHeight: maximumHeight-200
                minimumWidth: maximumWidth-200
                title: qsTr("Hello World")

                MouseArea {
                    anchors.fill: parent
                    onClicked: {
                        console.log(top.maximumWidth)
                        console.log(top.maximumHeight)
                    }
                }
                

                }

                Dheerendra
                @Community Service
                Certified Qt Specialist
                https://www.pthinks.com

                A 1 Reply Last reply
                1
                • dheerendraD dheerendra

                  Can you confirm what is the values of maximumWidth and maximumHeight ? Just print them & check ? Which macro is calculating these values ? Are you assigning Screen.Width and Screen.Height to maximumWidth and maximumHeight ?

                  ApplicationWindow {
                  id : top
                  visible: true
                  // width: maximumWidth
                  // height: maximumHeight
                  width: 300
                  height: 400
                  minimumHeight: maximumHeight-200
                  minimumWidth: maximumWidth-200
                  title: qsTr("Hello World")

                  MouseArea {
                      anchors.fill: parent
                      onClicked: {
                          console.log(top.maximumWidth)
                          console.log(top.maximumHeight)
                      }
                  }
                  

                  }

                  A Offline
                  A Offline
                  Arkning
                  wrote on last edited by
                  #9

                  @dheerendra The value is 16777215 for both so I guess it's not the right macro to know the size of a screen. So do you know what is the right one ?

                  1 Reply Last reply
                  0
                  • dheerendraD Offline
                    dheerendraD Offline
                    dheerendra
                    Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
                    wrote on last edited by
                    #10

                    So this value is causing the issue. No macro decides this size. You need to set the max size which you prefer. Becz of this huge value, it is crashing. Set the max size appropriately based on the Screen Size. Everything should work fine.

                    Dheerendra
                    @Community Service
                    Certified Qt Specialist
                    https://www.pthinks.com

                    A 1 Reply Last reply
                    1
                    • dheerendraD dheerendra

                      So this value is causing the issue. No macro decides this size. You need to set the max size which you prefer. Becz of this huge value, it is crashing. Set the max size appropriately based on the Screen Size. Everything should work fine.

                      A Offline
                      A Offline
                      Arkning
                      wrote on last edited by
                      #11

                      @dheerendra I solved the problem, the macro that have the size of the actual screen is Screen.width and Screen.height with the import Qt.Quick.Window 2.0.

                      Thanks for your help !

                      1 Reply Last reply
                      1
                      • dheerendraD Offline
                        dheerendraD Offline
                        dheerendra
                        Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
                        wrote on last edited by
                        #12

                        Cool. Yes, Screen.Width and Screen.Height are the right properties to get the screen size.

                        Dheerendra
                        @Community Service
                        Certified Qt Specialist
                        https://www.pthinks.com

                        1 Reply Last reply
                        1

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved