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. Building QML Applications resolution independent

Building QML Applications resolution independent

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 4 Posters 13.1k 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.
  • 2 Offline
    2 Offline
    2beers
    wrote on last edited by
    #1

    Hi everyone. can someone point me to some examples of building an QML application resolution independent. can you provide the size(width,height) in percentage?

    Thanks

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mario
      wrote on last edited by
      #2

      You can always calculate the width and hight for each item, for example:
      @
      Rectangle {
      width: parent.width * 0.7
      height: parent.height * 0.4
      }
      @

      Is this what you mean?

      1 Reply Last reply
      1
      • 2 Offline
        2 Offline
        2beers
        wrote on last edited by
        #3

        I'm looking for something like a space separator, because I'm also interested in elements location. I need to maintain some elements with original sizes , but I want some elements to be enlarged only on horizontal or vertical. something similar to qt native widgets, but in QML.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DenisKormalev
          wrote on last edited by
          #4

          Maybe extensive use of anchoring will help you? It will be easier to say if you will provide some mockup of what you need.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gustavo
            wrote on last edited by
            #5

            Indeed, probably anchor layouts is what you want. If you want, as you said, components to be enlarged only on vertical, you can write, for instance:

            @
            Item {
            id: rootItem

            Rectangle {
                 id: anchoredRectangle
            
                anchors.top: parent.top
                anchors.topMargin: 17
                anchors.bottom: parent.bottom
                anchors.bottomMargin: 10
                anchors.horizontalCenter: parent.horizontalCenter // or, for example: anchors.right: parent.right
            }
            

            }
            @

            This way the Rectangle will be enlarged only on vertical axis when Item is enlarged.

            Is something like this what you want?

            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