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?
Center text Just add the class . text-center to the parent element of the text to center content horizontally.
The <center> HTML element is a block-level element that displays its block-level or inline contents centered horizontally within its containing element.
Try to put this line to every child:
anchors.horizontalCenter: parent.horizontalCenter
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With