From a626641fafcf5f3a2e904cd0679f62ee70e19f4e Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 9 Sep 2009 11:37:49 +1000 Subject: Positioners now implictly have the height and width of the childrenRect Also removed the now uneccesary height and width bindings from the twitter demo login screen. --- demos/declarative/twitter/content/AuthView.qml | 8 +++----- src/declarative/fx/qfxpositioners.cpp | 12 ++++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/demos/declarative/twitter/content/AuthView.qml b/demos/declarative/twitter/content/AuthView.qml index 7d0d865..febee94 100644 --- a/demos/declarative/twitter/content/AuthView.qml +++ b/demos/declarative/twitter/content/AuthView.qml @@ -5,10 +5,9 @@ import "../../flickr/mobile" Item { id: wrapper Column { - width: childrenRect.width; height:childrenRect.height; anchors.centerIn: parent + anchors.centerIn: parent spacing: 20 Row{ - width: childrenRect.width; height:childrenRect.height; spacing: 4 Text { width: 100 @@ -39,7 +38,6 @@ Item { } } Row{ - width: childrenRect.width; height:childrenRect.height; spacing: 4 Text { width: 100 @@ -65,8 +63,8 @@ Item { } } Item{ - width: childrenRect.width; anchors.horizontalCenter: parent.horizontalCenter - height: childrenRect.height + width: childrenRect.width; height:childrenRect.height; + anchors.horizontalCenter: parent.horizontalCenter Button { x: 10 width: 100 diff --git a/src/declarative/fx/qfxpositioners.cpp b/src/declarative/fx/qfxpositioners.cpp index bad4944..e4500aa 100644 --- a/src/declarative/fx/qfxpositioners.cpp +++ b/src/declarative/fx/qfxpositioners.cpp @@ -251,6 +251,18 @@ void QFxBasePositioner::prePositioning() d->_animated.clear(); doPositioning(); finishApplyTransitions(); + //Set implicit size to the size of its children + //###To keep this valid, do we need to update on pos change as well? + qreal h = 0.0f; + qreal w = 0.0f; + foreach(QFxItem *child, d->_items){ + if(!child->isVisible() || child->opacity() <= 0) + continue; + h = qMax(h, child->y() + child->height()); + w = qMax(w, child->x() + child->width()); + } + setImplicitHeight(h); + setImplicitWidth(w); } void QFxBasePositioner::applyTransition(const QList >& changes, QFxItem* target, QmlStateOperation::ActionList &actions) -- cgit v0.12