[Qt-qml] anchors.horizontalCenter bug ?

Stephen Collyer scollyer at netspinner.co.uk
Mon Jul 26 19:39:03 CEST 2010


On 26 July 2010 17:23, <alan.westbrook at nokia.com> wrote:

> I think what you might want to be setting is the Text's horizontalAlignment
> instead of it's bounding rect's anchors:
>
> Text
> {
>    horizontalAlignment: Text.AlignHCenter
> }
>
> Alan
>
>
Well, the docs for the Text element say:

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.

which explicitly mentions anchors for alignment with the parent,
so I guess this is a bug either in the code or in the docs ?

-- 
Stephen Collyer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100726/1e942081/attachment.html 


More information about the Qt-qml mailing list