Putting Repeater and standalone item in GridLayout leads to weird behavior

  • My code:

    import QtQuick 2.6
    import QtQuick.Window 2.2
    import QtQuick.Layouts 1.3
    Window {
        visible: true
        width: 640
        height: 480
        GridLayout {
            id: grid
            anchors.fill: parent
            columns: 6
            Repeater {
                model: 7
                Rectangle {
                    color: "blue"
                    Layout.fillWidth: true
                    Layout.fillHeight: true
            //Rectangle {color: "red"; width: 20; height: 20}

    It shows this:


    Which is fine.

    But when you uncomment the line containing color: "red", the layout breaks:


    Any idea why that is and how to fix it?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.