From dbba440da0677b8174d087d498d3d0dbd465548a Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 28 Oct 2009 15:44:26 +1000 Subject: Fix dynamic example Includes adding a comment to the positioners to alert others that you shouldn't use anchors as well. --- examples/declarative/dynamic/dynamic.qml | 2 -- src/declarative/fx/qfxpositioners.cpp | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/examples/declarative/dynamic/dynamic.qml b/examples/declarative/dynamic/dynamic.qml index e083a5b..885e037 100644 --- a/examples/declarative/dynamic/dynamic.qml +++ b/examples/declarative/dynamic/dynamic.qml @@ -68,14 +68,12 @@ Item { Text{ text: "Drag an item into the scene." } Row{ id: toolRow spacing: 8; - height: childrenRect.height//TODO: Put bug in JIRA when it comes back up PaletteItem{ anchors.verticalCenter: parent.verticalCenter file: "Sun.qml"; image: "images/sun.png" } PaletteItem{ - anchors.verticalCenter: parent.verticalCenter file: "GenericItem.qml" image: "images/moon.png" } diff --git a/src/declarative/fx/qfxpositioners.cpp b/src/declarative/fx/qfxpositioners.cpp index cc385e0..86a069d 100644 --- a/src/declarative/fx/qfxpositioners.cpp +++ b/src/declarative/fx/qfxpositioners.cpp @@ -375,6 +375,10 @@ Column { \endqml \endtable + Note that the positioner assumes that the x and y positions of its children + will not change. If you manually change the x or y properties in script, bind + the x or y properties, or use anchors on a child of a positioner, then the + positioner may exhibit strange behaviour. */ /*! @@ -539,6 +543,11 @@ Row { \endqml \image horizontalpositioner_example.png + Note that the positioner assumes that the x and y positions of its children + will not change. If you manually change the x or y properties in script, bind + the x or y properties, or use anchors on a child of a positioner, then the + positioner may exhibit strange behaviour. + */ /*! \qmlproperty Transition Row::remove @@ -659,7 +668,7 @@ void QFxRow::doPositioning() child->setX(hoffset); setMovingItem(0); } - if(!child->width() || !child->height()){//don't advance for invisible children + if(child->width() && child->height()){//don't advance for invisible children hoffset += child->width(); hoffset += spacing(); } @@ -707,6 +716,11 @@ Grid { } \endqml \endtable + + Note that the positioner assumes that the x and y positions of its children + will not change. If you manually change the x or y properties in script, bind + the x or y properties, or use anchors on a child of a positioner, then the + positioner may exhibit strange behaviour. */ /*! \qmlproperty Transition Grid::remove -- cgit v0.12