[Qt-qml] anchors.horizontalCenter bug ?

Eduardo Fleury eduardo.fleury at openbossa.org
Tue Jul 27 18:49:04 CEST 2010


Yep, good thing it works now.

Just a word of advice on my own way of debugging declarative interfaces that
might be handy in the future.

In situations like this one what I do is to create a semi-transparent
rectangle and anchors.fill it to the "bad-behaving" item.
In this case, I would do, inside the Text item:

Rectangle {
    anchors.fill: parent
    color: "tomato"
    opacity: 0.33
}

This would clearly show that the Text item was indeed centered but being too
big the result was not satisfactory.

BR,
Eduardo

On Tue, Jul 27, 2010 at 8:07 AM, Stephen Collyer
<scollyer at netspinner.co.uk>wrote:

> On 27 July 2010 00:23, <warwick.allison at nokia.com> wrote:
>
>>
>>   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).
>>
>>
> Yes, you're right. The parent.width in the Text element was
> breaking the alignment - it works fine without that.
>
> --
> Stephen Collyer
>
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml
>
>


-- 
Eduardo M. Fleury
OpenBossa - INdT
http://eduardofleury.com/
http://www.openbossa.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100727/1851c09e/attachment.html 


More information about the Qt-qml mailing list