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. using scaling within ColumnLayouts
Forum Updated to NodeBB v4.3 + New Features

using scaling within ColumnLayouts

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 211 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.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #1

    Hi all -

    I have a QML screen that uses a column layout:

        ColumnLayout {
            spacing: root.gridSpacing
            
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.top: contentBg.top
            
            Label { ... }
            
            Rectangle {
                height: 197
                width: 326
                transform: Scale {xScale: 2.0; yScale: 2.0}
                Layout.alignment: Qt.AlignHCenter }
               
            ConsumableCancelDoneRow { ... }
        }
    

    If I omit the scaling, my display looks like this:

    unscaled.PNG
    ...which is essentially correct, except I want the rectangle to be larger. But...I don't want to just make it larger; its size is given to me, along with 16 other rectangles that will fit into this one, and I'd rather not re-calculate all of them manually.

    When I use the transform: Scale directive above, my display looks like this:

    scaled.PNG
    Is there a better way to resize this rectangle without undoing my other settings?

    Thanks...

    1 Reply Last reply
    0
    • mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote on last edited by
      #2

      I've worked around this issue with this hack:

      Rectangle {
        property var scaleFactor: 1.5
        id: rack
        height: 197 * scaleFactor
        width: 495 * scaleFactor
      
        Bottle {
          id: bottle1
          cellX: 25
          cellY: 105
          cellHeight: 75
          cellWidth: 75
          bottleScaleFactor: scaleFactor
        }
      

      The Bottle.qml does the same thing with its factor as does the rack.

      This fixes the problem, but I'd still be interested in hearing about more elegant solutions.

      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