1
votes

I am trying to use topMargin in ColumnLayout. but i am facing some issues. Could some one help me out of this.

Here is my code

import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QtQuick.Layouts 1.1

ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    Rectangle{
        anchors.fill: parent
        ColumnLayout{
            id: columlayout
            Rectangle{
                width: 100
                height: 100
                color: "red"
            }
            Rectangle{
                Layout.topMargin: 50
                width: 100
                height: 100
                color: "green"
            }
            Rectangle{
                width: 100
                height: 100
                color: "blue"
            }
        }
    }
}

Issue:

Cannot assign to non-existent property "topMargin"

1

1 Answers

2
votes

The margin properties were introduced in QtQuick.Layouts 1.2, so you must import that version, not 1.1.