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. QtQuick Layouts columnSpan
Qt 6.11 is out! See what's new in the release blog

QtQuick Layouts columnSpan

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 226 Views
  • 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.
  • U Offline
    U Offline
    Uniformed6525
    wrote on last edited by
    #1

    Hello,

    I'm trying to use a GridLayout. The latter has 3 columns and 1 row. I added two Rectangles, of respective columnSpans 2 and 1. Here's my code:

    import QtQuick
    import QtQuick.Layouts 1.3
    
    GridLayout {
        id: gridLayout
        columns: 3
        rows: 1
        anchors.fill: parent
        anchors.margins: 16
        rowSpacing: 4
    
        Rectangle {
            Layout.columnSpan: 2
            height: 280
            color: "#111"
            Layout.fillWidth: true
        }
        Rectangle {
            Layout.columnSpan: 1
            height: 280
            color: "#111"
            Layout.fillWidth: true
        }
    }
    

    What I expected was that the first Rectangle would take up 66.6% of the available space, and the remainder would be left to the second Rectangle to use. However, instead, I get this:
    7845a99b-31bb-426c-a6b3-f54d963b32d9-image.png

    If anyone can enlighten me as to why they are the same size, it would be much appreciated. Thanks in advance.

    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