From 3d5ffa7102e3373942a6b889386bc77a9c957be0 Mon Sep 17 00:00:00 2001 From: Filip Piechocki Date: Tue, 2 Apr 2013 12:48:22 +0200 Subject: Fix for Positioner attached property Modified Positioner attached properties update - original code was trying to update visible and not visible items by looking only at the positionedItems array, which was wrong as that array contains only visible items. Hidden ones are stored in unpositionedItems array so second loop was added to affect these items also. Task-number: QTBUG-30477 Change-Id: If03abb76f4da708884a7e2cf6ade83c09eca45bf Reviewed-by: Alan Alpert --- src/quick/items/qquickpositioners.cpp | 44 ++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 13 deletions(-) (limited to 'src/quick/items/qquickpositioners.cpp') diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index 4a74c0bfba..d8dc0f1856 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -452,7 +452,6 @@ void QQuickBasePositioner::updateAttachedProperties(QQuickPositionerAttached *sp QQuickPositionerAttached *prevLastProperty = 0; QQuickPositionerAttached *lastProperty = 0; - int visibleItemIndex = 0; for (int ii = 0; ii < positionedItems.count(); ++ii) { const PositionedItem &child = positionedItems.at(ii); if (!child.item) @@ -468,28 +467,47 @@ void QQuickBasePositioner::updateAttachedProperties(QQuickPositionerAttached *sp property = static_cast(qmlAttachedPropertiesObject(child.item, false)); } - if (child.isVisible) { - if (property) { - property->setIndex(visibleItemIndex); - property->setIsFirstItem(visibleItemIndex == 0); + if (property) { + property->setIndex(ii); + property->setIsFirstItem(ii == 0); - if (property->isLastItem()) + if (property->isLastItem()) { + if (prevLastProperty) + prevLastProperty->setIsLastItem(false); // there can be only one last property prevLastProperty = property; } - - lastProperty = property; - ++visibleItemIndex; - } else if (property) { - property->setIndex(-1); - property->setIsFirstItem(false); - property->setIsLastItem(false); } + + lastProperty = property; } if (prevLastProperty && prevLastProperty != lastProperty) prevLastProperty->setIsLastItem(false); if (lastProperty) lastProperty->setIsLastItem(true); + + // clear attached properties for unpositioned items + for (int ii = 0; ii < unpositionedItems.count(); ++ii) { + const PositionedItem &child = unpositionedItems.at(ii); + if (!child.item) + continue; + + QQuickPositionerAttached *property = 0; + + if (specificProperty) { + if (specificPropertyOwner == child.item) { + property = specificProperty; + } + } else { + property = static_cast(qmlAttachedPropertiesObject(child.item, false)); + } + + if (property) { + property->setIndex(-1); + property->setIsFirstItem(false); + property->setIsLastItem(false); + } + } } /*! -- cgit v1.2.3 From 59f075df52f5e78b95b360fb0533c2249924e7a7 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Wed, 17 Apr 2013 23:03:16 +0800 Subject: Doc: Qt Quick: Fix module name format (Pt 1/2) Follow the conventions at http://qt-project.org/wiki/Spelling_Module_Names_in_Qt_Documentation Attempt to differentiate between the whole module ("Qt Quick") and the QML import ("QtQuick") by encoding the latter with monospace font. There are places in the text where both representations are valid. Change-Id: Id6e157a4191aaa4e23a9cd5c76abfe902fe43d33 Reviewed-by: Jerome Pasion --- src/quick/items/qquickpositioners.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/quick/items/qquickpositioners.cpp') diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index d8dc0f1856..f2c0b94f11 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -700,8 +700,8 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) cases, these lists will be empty. See the \l ViewTransition documentation for more details and examples on using these transitions. - \note In QtQuick 1, this transition was applied to all items that were part of the - positioner at the time of its creation. From QtQuick 2 onwards, positioners apply the + \note In Qt Quick 1, this transition was applied to all items that were part of the + positioner at the time of its creation. From \l {Qt Quick}{Qt Quick 2} onwards, positioners apply the \l populate transition to these items instead. \sa add, ViewTransition, {qml/positioners}{Positioners example} @@ -854,8 +854,8 @@ void QQuickColumn::reportConflictingAnchors() cases, these lists will be empty. See the \l ViewTransition documentation for more details and examples on using these transitions. - \note In QtQuick 1, this transition was applied to all items that were part of the - positioner at the time of its creation. From QtQuick 2 onwards, positioners apply the + \note In Qt Quick 1, this transition was applied to all items that were part of the + positioner at the time of its creation. From \l {Qt Quick}{QtQuick 2} onwards, positioners apply the \l populate transition to these items instead. \sa add, ViewTransition, {qml/positioners}{Positioners example} @@ -1087,8 +1087,8 @@ void QQuickRow::reportConflictingAnchors() cases, these lists will be empty. See the \l ViewTransition documentation for more details and examples on using these transitions. - \note In QtQuick 1, this transition was applied to all items that were part of the - positioner at the time of its creation. From QtQuick 2 onwards, positioners apply the + \note In Qt Quick 1, this transition was applied to all items that were part of the + positioner at the time of its creation. From \l {Qt Quick}{QtQuick 2} onwards, positioners apply the \l populate transition to these items instead. \sa add, ViewTransition, {qml/positioners}{Positioners example} @@ -1628,8 +1628,8 @@ void QQuickGrid::reportConflictingAnchors() cases, these lists will be empty. See the \l ViewTransition documentation for more details and examples on using these transitions. - \note In QtQuick 1, this transition was applied to all items that were part of the - positioner at the time of its creation. From QtQuick 2 onwards, positioners apply the + \note In Qt Quick 1, this transition was applied to all items that were part of the + positioner at the time of its creation. From \l {Qt Quick}{QtQuick 2} onwards, positioners apply the \l populate transition to these items instead. \sa add, ViewTransition, {qml/positioners}{Positioners example} -- cgit v1.2.3 From b1a321a1d7762e8c20e244164bd42822c3bd0310 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Sat, 20 Apr 2013 01:14:53 +0800 Subject: Doc: Create links to Qt Quick 1 Point to the porting guide, so that users who search for the old names will be directed to an explanation of the name change. Also made some new links to Qt Quick 2, and changed "favour" -> "favor" (Sanity Bot complained) Change-Id: If30c8d619d8fdb9df72b7b5f3efd356f1e07b23a Reviewed-by: Jerome Pasion --- src/quick/items/qquickpositioners.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/quick/items/qquickpositioners.cpp') diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index f2c0b94f11..66f4b44857 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -700,7 +700,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) cases, these lists will be empty. See the \l ViewTransition documentation for more details and examples on using these transitions. - \note In Qt Quick 1, this transition was applied to all items that were part of the + \note In \l {Qt Quick 1}, this transition was applied to all items that were part of the positioner at the time of its creation. From \l {Qt Quick}{Qt Quick 2} onwards, positioners apply the \l populate transition to these items instead. @@ -854,7 +854,7 @@ void QQuickColumn::reportConflictingAnchors() cases, these lists will be empty. See the \l ViewTransition documentation for more details and examples on using these transitions. - \note In Qt Quick 1, this transition was applied to all items that were part of the + \note In \l {Qt Quick 1}, this transition was applied to all items that were part of the positioner at the time of its creation. From \l {Qt Quick}{QtQuick 2} onwards, positioners apply the \l populate transition to these items instead. @@ -1087,7 +1087,7 @@ void QQuickRow::reportConflictingAnchors() cases, these lists will be empty. See the \l ViewTransition documentation for more details and examples on using these transitions. - \note In Qt Quick 1, this transition was applied to all items that were part of the + \note In \l {Qt Quick 1}, this transition was applied to all items that were part of the positioner at the time of its creation. From \l {Qt Quick}{QtQuick 2} onwards, positioners apply the \l populate transition to these items instead. @@ -1628,7 +1628,7 @@ void QQuickGrid::reportConflictingAnchors() cases, these lists will be empty. See the \l ViewTransition documentation for more details and examples on using these transitions. - \note In Qt Quick 1, this transition was applied to all items that were part of the + \note In \l {Qt Quick 1}, this transition was applied to all items that were part of the positioner at the time of its creation. From \l {Qt Quick}{QtQuick 2} onwards, positioners apply the \l populate transition to these items instead. -- cgit v1.2.3 From 3c9dd93a036ddb719726333e617eb3d8ab5c2be5 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Thu, 16 May 2013 23:53:02 +0800 Subject: Doc: Fix some broken links Change-Id: I1385a8947107a7c80b32306fc587aff45536a4ec Reviewed-by: Alan Alpert --- src/quick/items/qquickpositioners.cpp | 38 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/quick/items/qquickpositioners.cpp') diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index 66f4b44857..789d2e62aa 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -644,7 +644,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) \image verticalpositioner_transition.gif - \sa Row, Grid, Flow, Positioner, {qml/positioners}{Positioners example} + \sa Row, Grid, Flow, Positioner, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Column::populate @@ -657,7 +657,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) the item that is being added. See the \l ViewTransition documentation for more details and examples on using these transitions. - \sa add, ViewTransition, {declarative/positioners}{Positioners example} + \sa add, ViewTransition, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Column::add @@ -679,7 +679,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) \note This transition is not applied to the items that already part of the positioner at the time of its creation. In this case, the \l populate transition is applied instead. - \sa populate, ViewTransition, {declarative/positioners}{Positioners example} + \sa populate, ViewTransition, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Column::move @@ -704,7 +704,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) positioner at the time of its creation. From \l {Qt Quick}{Qt Quick 2} onwards, positioners apply the \l populate transition to these items instead. - \sa add, ViewTransition, {qml/positioners}{Positioners example} + \sa add, ViewTransition, {Qt Quick Examples - Positioners} */ /*! \qmlproperty real QtQuick2::Column::spacing @@ -798,7 +798,7 @@ void QQuickColumn::reportConflictingAnchors() \l{Item Layouts}. - \sa Column, Grid, Flow, Positioner, {qml/positioners}{Positioners example} + \sa Column, Grid, Flow, Positioner, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Row::populate @@ -811,7 +811,7 @@ void QQuickColumn::reportConflictingAnchors() the item that is being added. See the \l ViewTransition documentation for more details and examples on using these transitions. - \sa add, ViewTransition, {declarative/positioners}{Positioners example} + \sa add, ViewTransition, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Row::add @@ -833,7 +833,7 @@ void QQuickColumn::reportConflictingAnchors() \note This transition is not applied to the items that already part of the positioner at the time of its creation. In this case, the \l populate transition is applied instead. - \sa populate, ViewTransition, {declarative/positioners}{Positioners example} + \sa populate, ViewTransition, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Row::move @@ -858,7 +858,7 @@ void QQuickColumn::reportConflictingAnchors() positioner at the time of its creation. From \l {Qt Quick}{QtQuick 2} onwards, positioners apply the \l populate transition to these items instead. - \sa add, ViewTransition, {qml/positioners}{Positioners example} + \sa add, ViewTransition, {Qt Quick Examples - Positioners} */ /*! \qmlproperty real QtQuick2::Row::spacing @@ -887,7 +887,7 @@ QQuickRow::QQuickRow(QQuickItem *parent) the right anchor remains to the right of the row. \endlist - \sa Grid::layoutDirection, Flow::layoutDirection, {qml/righttoleft/layoutdirection}{Layout directions example} + \sa Grid::layoutDirection, Flow::layoutDirection, {Qt Quick Examples - Right to Left} */ Qt::LayoutDirection QQuickRow::layoutDirection() const @@ -1031,7 +1031,7 @@ void QQuickRow::reportConflictingAnchors() \l{Item Layouts}. - \sa Flow, Row, Column, Positioner, {qml/positioners}{Positioners example} + \sa Flow, Row, Column, Positioner, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Grid::populate @@ -1044,7 +1044,7 @@ void QQuickRow::reportConflictingAnchors() the item that is being added. See the \l ViewTransition documentation for more details and examples on using these transitions. - \sa add, ViewTransition, {declarative/positioners}{Positioners example} + \sa add, ViewTransition, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Grid::add @@ -1066,7 +1066,7 @@ void QQuickRow::reportConflictingAnchors() \note This transition is not applied to the items that already part of the positioner at the time of its creation. In this case, the \l populate transition is applied instead. - \sa populate, ViewTransition, {declarative/positioners}{Positioners example} + \sa populate, ViewTransition, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Grid::move @@ -1091,7 +1091,7 @@ void QQuickRow::reportConflictingAnchors() positioner at the time of its creation. From \l {Qt Quick}{QtQuick 2} onwards, positioners apply the \l populate transition to these items instead. - \sa add, ViewTransition, {qml/positioners}{Positioners example} + \sa add, ViewTransition, {Qt Quick Examples - Positioners} */ /*! \qmlproperty qreal QtQuick2::Grid::spacing @@ -1248,7 +1248,7 @@ void QQuickGrid::setColumnSpacing(const qreal columnSpacing) \l Grid::flow property. \endlist - \sa Flow::layoutDirection, Row::layoutDirection, {qml/righttoleft/layoutdirection}{Layout directions example} + \sa Flow::layoutDirection, Row::layoutDirection, {Qt Quick Examples - Right to Left} */ Qt::LayoutDirection QQuickGrid::layoutDirection() const { @@ -1572,7 +1572,7 @@ void QQuickGrid::reportConflictingAnchors() For more information on using Flow and other related positioner-types, see \l{Item Layouts}. - \sa Column, Row, Grid, Positioner, {qml/positioners}{Positioners example} + \sa Column, Row, Grid, Positioner, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Flow::populate @@ -1585,7 +1585,7 @@ void QQuickGrid::reportConflictingAnchors() the item that is being added. See the \l ViewTransition documentation for more details and examples on using these transitions. - \sa add, ViewTransition, {declarative/positioners}{Positioners example} + \sa add, ViewTransition, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Flow::add @@ -1607,7 +1607,7 @@ void QQuickGrid::reportConflictingAnchors() \note This transition is not applied to the items that already part of the positioner at the time of its creation. In this case, the \l populate transition is applied instead. - \sa populate, ViewTransition, {declarative/positioners}{Positioners example} + \sa populate, ViewTransition, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Flow::move @@ -1632,7 +1632,7 @@ void QQuickGrid::reportConflictingAnchors() positioner at the time of its creation. From \l {Qt Quick}{QtQuick 2} onwards, positioners apply the \l populate transition to these items instead. - \sa add, ViewTransition, {qml/positioners}{Positioners example} + \sa add, ViewTransition, {Qt Quick Examples - Positioners} */ /*! \qmlproperty real QtQuick2::Flow::spacing @@ -1710,7 +1710,7 @@ void QQuickFlow::setFlow(Flow flow) \l Flow::flow property. \endlist - \sa Grid::layoutDirection, Row::layoutDirection, {qml/righttoleft/layoutdirection}{Layout directions example} + \sa Grid::layoutDirection, Row::layoutDirection, {Qt Quick Examples - Right to Left} */ Qt::LayoutDirection QQuickFlow::layoutDirection() const -- cgit v1.2.3 From 124473935a99598bfe63538c5a388590cc1cc229 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Fri, 24 May 2013 16:56:26 +0200 Subject: Doc fixes to the Positioners/Layouts documentation * Add references to Qt Quick Layouts * Don't lie about that Positioners can resize the items * Rename title from "Item Layouts" to "Item Positioners" to avoid confusion with Qt Quick Layouts Change-Id: I43e3ad6e6d9e4b08a1233868c75f0efcab43f8c3 Reviewed-by: Caroline Chao Reviewed-by: Jerome Pasion --- src/quick/items/qquickpositioners.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/quick/items/qquickpositioners.cpp') diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index 789d2e62aa..b07a38cdaf 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -626,7 +626,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) more information about its position within the Column. For more information on using Column and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. \section1 Using Transitions @@ -644,7 +644,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) \image verticalpositioner_transition.gif - \sa Row, Grid, Flow, Positioner, {Qt Quick Examples - Positioners} + \sa Row, Grid, Flow, Positioner, ColumnLayout, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Column::populate @@ -795,10 +795,10 @@ void QQuickColumn::reportConflictingAnchors() more information about its position within the Row. For more information on using Row and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. - \sa Column, Grid, Flow, Positioner, {Qt Quick Examples - Positioners} + \sa Column, Grid, Flow, Positioner, RowLayout, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Row::populate @@ -1028,10 +1028,10 @@ void QQuickRow::reportConflictingAnchors() or anchor itself with any of the \l {Item::anchors}{anchor} properties. For more information on using Grid and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. - \sa Flow, Row, Column, Positioner, {Qt Quick Examples - Positioners} + \sa Flow, Row, Column, Positioner, GridLayout, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Grid::populate @@ -1570,7 +1570,7 @@ void QQuickGrid::reportConflictingAnchors() or anchor itself with any of the \l {Item::anchors}{anchor} properties. For more information on using Flow and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. \sa Column, Row, Grid, Positioner, {Qt Quick Examples - Positioners} */ -- cgit v1.2.3