aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/items/qsgpositioners.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-08-31 08:55:16 +0200
committerGunnar Sletta <gunnar.sletta@nokia.com>2011-08-31 08:55:16 +0200
commit71478352376022faa9be6d79f2a760c289945ff5 (patch)
tree0f8ff4a88c1b033367337a93d23a329d145ee903 /src/declarative/items/qsgpositioners.cpp
parentc38efcb67cf93ba3e91e184c3b891efef4ef75a3 (diff)
parent05daa9bfe1a03ffe1cc580b6cfd88e093e2493c0 (diff)
Merge branch 'master' into refactor
Conflicts: src/3rdparty/v8 src/declarative/declarative.pro src/declarative/items/qsgcanvas.cpp src/declarative/items/qsgshadereffectsource_p.h src/declarative/items/qsgview.cpp src/declarative/particles/qsgcustomparticle.cpp src/imports/gestures/gestures.pro src/imports/particles/particles.pro src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro src/qtquick1/qtquick1.pro tests/auto/declarative/examples/examples.pro tests/auto/declarative/qsglistview/qsglistview.pro tests/auto/qtquick1/qdeclarativeviewer/qdeclarativeviewer.pro Change-Id: I423344f83e1835116cad531b877fde6e68a8849a
Diffstat (limited to 'src/declarative/items/qsgpositioners.cpp')
-rw-r--r--src/declarative/items/qsgpositioners.cpp34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/declarative/items/qsgpositioners.cpp b/src/declarative/items/qsgpositioners.cpp
index fca0aa1877..0401494d3b 100644
--- a/src/declarative/items/qsgpositioners.cpp
+++ b/src/declarative/items/qsgpositioners.cpp
@@ -93,6 +93,9 @@ QSGBasePositioner::QSGBasePositioner(PositionerType at, QSGItem *parent)
for the child items. Depending on the chosen type, only x or y changes will be applied.
Note that the subclass is responsible for adding the spacing in between items.
+
+ Positioning is usually delayed until before a frame is rendered, to batch multiple repositioning
+ changes into one calculation.
*/
QSGBasePositioner::QSGBasePositioner(QSGBasePositionerPrivate &dd, PositionerType at, QSGItem *parent)
@@ -110,6 +113,13 @@ QSGBasePositioner::~QSGBasePositioner()
positionedItems.clear();
}
+void QSGBasePositioner::updatePolish()
+{
+ Q_D(QSGBasePositioner);
+ if (d->positioningDirty)
+ prePositioning();
+}
+
int QSGBasePositioner::spacing() const
{
Q_D(const QSGBasePositioner);
@@ -122,7 +132,7 @@ void QSGBasePositioner::setSpacing(int s)
if (s==d->spacing)
return;
d->spacing = s;
- prePositioning();
+ d->setPositioningDirty();
emit spacingChanged();
}
@@ -169,7 +179,7 @@ void QSGBasePositioner::itemChange(ItemChange change, const ItemChangeData &valu
{
Q_D(QSGBasePositioner);
if (change == ItemChildAddedChange){
- prePositioning();
+ d->setPositioningDirty();
} else if (change == ItemChildRemovedChange) {
QSGItem *child = value.item;
QSGBasePositioner::PositionedItem posItem(child);
@@ -178,7 +188,7 @@ void QSGBasePositioner::itemChange(ItemChange change, const ItemChangeData &valu
d->unwatchChanges(child);
positionedItems.remove(idx);
}
- prePositioning();
+ d->setPositioningDirty();
}
QSGItem::itemChange(change, value);
@@ -193,7 +203,7 @@ void QSGBasePositioner::prePositioning()
if (d->doingPositioning)
return;
- d->queuedPositioning = false;
+ d->positioningDirty = false;
d->doingPositioning = true;
//Need to order children by creation order modified by stacking order
QList<QSGItem *> children = childItems();
@@ -463,6 +473,10 @@ void QSGPositionerAttached::setIsLastItem(bool isLastItem)
Items with a width or height of 0 will not be positioned.
+ Positioning is batched and syncronized with painting to reduce the number of
+ calculations needed. This means that positioners may not reposition items immediately
+ when changes occur, but it will have moved by the next frame.
+
\sa Row, Grid, Flow, Positioner, {declarative/positioners}{Positioners example}
*/
/*!
@@ -607,6 +621,10 @@ void QSGColumn::reportConflictingAnchors()
Items with a width or height of 0 will not be positioned.
+ Positioning is batched and syncronized with painting to reduce the number of
+ calculations needed. This means that positioners may not reposition items immediately
+ when changes occur, but it will have moved by the next frame.
+
\sa Column, Grid, Flow, Positioner, {declarative/positioners}{Positioners example}
*/
/*!
@@ -838,6 +856,10 @@ void QSGRow::reportConflictingAnchors()
Items with a width or height of 0 will not be positioned.
+ Positioning is batched and syncronized with painting to reduce the number of
+ calculations needed. This means that positioners may not reposition items immediately
+ when changes occur, but it will have moved by the next frame.
+
\sa Flow, Row, Column, Positioner, {declarative/positioners}{Positioners example}
*/
/*!
@@ -1265,6 +1287,10 @@ void QSGGrid::reportConflictingAnchors()
Items with a width or height of 0 will not be positioned.
+ Positioning is batched and syncronized with painting to reduce the number of
+ calculations needed. This means that positioners may not reposition items immediately
+ when changes occur, but it will have moved by the next frame.
+
\sa Column, Row, Grid, Positioner, {declarative/positioners}{Positioners example}
*/
/*!