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

GridLayout in another GridLayout

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 804 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.
  • K Offline
    K Offline
    Kiichiro
    wrote on last edited by
    #1

    I have this code:
    @
    import QtQuick 2.1
    import QtQuick.Controls 1.0
    import QtQuick.Window 2.0
    import QtQuick.Layouts 1.0

    Window {
    title: qsTr("СЦМ Концепт")
    color: "blue"
    width: 1920
    height: 1080

    GridLayout {
        id: grid_layout1
        anchors.fill: parent
    
            GridLayout {
                id: grid1
                Layout.fillHeight: true
                Layout.fillWidth: true
                width: 2
    
                Rectangle {
                    Layout.fillHeight: true
                    Layout.fillWidth: true
                    color: "red"
                }
    
                Rectangle {
                    Layout.fillHeight: true
                    Layout.fillWidth: true
                    color: "green"
                }
            }
    
            GridLayout {
                id: grid2
                Layout.fillHeight: true
                Layout.fillWidth: true
                width: 1
    
                Rectangle {
                    Layout.fillHeight: true
                    Layout.fillWidth: true
                    color: "red"
                }
    
                Rectangle {
                    Layout.fillHeight: true
                    Layout.fillWidth: true
                    color: "green"
                }
            }
    }
    

    }
    @

    And I get this picture:
    http://imgur.com/nq6jbH6

    But if I write this:
    @
    import QtQuick 2.0
    import QtQuick.Controls 1.0
    import QtQuick.Window 2.0
    import QtQuick.Layouts 1.0

    Window {
    title: qsTr("СЦМ Концепт")
    color: "blue"
    width: 1920
    height: 1080

    GridLayout {
        id: grid_layout1
        anchors.fill: parent
    
        Item {
            Layout.fillHeight: true
            Layout.fillWidth: true
            width: 2
    
            GridLayout {
                id: grid1
                anchors.fill: parent
    
                Rectangle {
                    Layout.fillHeight: true
                    Layout.fillWidth: true
                    color: "red"
                }
    
                Rectangle {
                    Layout.fillHeight: true
                    Layout.fillWidth: true
                    color: "green"
                }
            }
        }
    
        Item {
            Layout.fillHeight: true
            Layout.fillWidth: true
            width: 1
    
            GridLayout {
                id: grid2
                anchors.fill: parent
    
                Rectangle {
                    Layout.fillHeight: true
                    Layout.fillWidth: true
                    color: "red"
                }
    
                Rectangle {
                    Layout.fillHeight: true
                    Layout.fillWidth: true
                    color: "green"
                }
            }
        }
    }
    

    }
    @

    I get right resulte:
    http://imgur.com/lWNNOtx

    Is this a bug or maybe I do something wrong? Why I should place second GridLayout inside a Item?

    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