Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Align horizontalcenter in Column

Column documentation explains how to achieve this:

enter image description here

However, I would like to achieve this:

enter image description here

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?

like image 547
avb Avatar asked Jun 17 '15 09:06

avb


People also ask

How do I center text horizontally in bootstrap?

Center text Just add the class . text-center to the parent element of the text to center content horizontally.

What is the basic layout element that centers the 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.


3 Answers

Try to put this line to every child:

anchors.horizontalCenter: parent.horizontalCenter
like image 131
fat Avatar answered Oct 16 '22 14:10

fat


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.

like image 29
Rudolfs Bundulis Avatar answered Oct 16 '22 16:10

Rudolfs Bundulis


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.

like image 4
skypjack Avatar answered Oct 16 '22 16:10

skypjack