Reputation: 1751
Column
documentation explains how to achieve this:
However, I would like to achieve this:
That is, all items inside the Column
should be horizontally aligned to the center. anchors.horizontalCenter: parent.Center
does not work. How can I obtain the desired result?
Upvotes: 16
Views: 27634
Reputation: 7133
Try to put this line to every child:
anchors.horizontalCenter: parent.horizontalCenter
Upvotes: 22
Reputation: 50568
If it's a matter of laying out your items, also take a look at the ColumnLayout
component and the attached property Layout.alignment
(you can set it as Qt.AlignHCenter
).
I find layouts far easier to use.
Upvotes: 5
Reputation: 11954
I suppose you can use anchors.horizontalCenter
for all the child items to align them with the horizontalCenter
of the column given that the column has an id you can refer to.
Upvotes: 11