Reputation: 5277
I am new to QML, and I would like to position one (and only one) item center in a Row
(or RowLayout
). As the code shown below, I want the "Hello" to be place on center(of a row) of my window.
Row {
id : titleRow
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.bottom
topPadding: 50
bottomPadding: 50
Text {
text: "Hello"
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
}
}
I use Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
, but apparently it's not working. I also try anchors.centerIn: parent
, which also failed.
Any help would be greatly appreciated, thank you !
Upvotes: 0
Views: 967
Reputation: 6584
Row
is not a layout. It's a Positioner. So, you cannot use Layout.*
properties with it.
Use RowLayout
instead.
Upvotes: 2