Hacker version with spacer elements.
Sometimes I prefer this over ColumnLayout, as in some situations I just can’t use ColumnLayout (I can’t explain exactly why, although at the moment). I work as follows
Column {
Rectangle {
// ...
}
Item {
width: 1 // dummy value != 0
height: 10
}
Rectangle {
// ...
}
Item {
width: 1 // dummy value != 0
height: 20
}
Rectangle {
// ...
}
}
0 . Spacer_Col.qml( Spacer_Row ) , -
import QtQuick 2.8
Item {
id: root
property alias spacing: root.height
width: 1 // dummy value different from 0
}
ColumnLayout
ColumnLayout {
Rectangle{
}
Rectangle{
Layout.topMargin: 10
}
Rectangle{
Layout.topMargin: 20
}
}