[Qt-qml] anchors.horizontalCenter bug ?
warwick.allison at nokia.com
warwick.allison at nokia.com
Tue Jul 27 01:23:38 CEST 2010
It's doing exactly as documented.
>
> Note that for a single line of text, the size of the text is the area
> of the text. In this common case, all alignments are equivalent. If you
> want the text to be, say, centered in it parent, then you will need to
> either modify the Item::anchors, or set horizontalAlignment to
> Text.AlignHCenter and bind the width to that of the parent.
i.e. do EITHER:
anchors.horizontalCenter: parent.horizontalCenter
OR
width: parent.width
horizontalAlignment: Text.AlignHCenter
whereas you are doing:
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
Which means to force the text to be as wide as the parent, then center that in the parent (which does nothing since they're the same size).
--
Warwick
More information about the Qt-qml
mailing list