diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-11-03 00:19:07 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-11-03 00:21:23 (GMT) |
commit | 6d7888aa59f08a0f91aaf844f27dc0c9462707f6 (patch) | |
tree | 881656b338fb548457e5c751c8f7ce1c5991e1b0 | |
parent | 1e8034a10d2496d7fb7aa987357333c6e2c3258d (diff) | |
download | Qt-6d7888aa59f08a0f91aaf844f27dc0c9462707f6.zip Qt-6d7888aa59f08a0f91aaf844f27dc0c9462707f6.tar.gz Qt-6d7888aa59f08a0f91aaf844f27dc0c9462707f6.tar.bz2 |
Fix repeater + positioners.
Don't leave empty space (or an empty cell) where the repeater would be.
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicspositioners.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp index ba696e7..35b0833 100644 --- a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp +++ b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp @@ -481,6 +481,11 @@ QmlGraphicsColumn::QmlGraphicsColumn(QmlGraphicsItem *parent) { } +inline bool isInvisible(QmlGraphicsItem *child) +{ + return child->opacity() == 0.0 || !child->isVisible() || !child->width() || !child->height(); +} + void QmlGraphicsColumn::doPositioning() { int voffset = 0; @@ -495,7 +500,7 @@ void QmlGraphicsColumn::doPositioning() QList<QGraphicsItem *> children = childItems(); for (int ii = 0; ii < children.count(); ++ii) { QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(children.at(ii)); - if (!child || child->opacity() == 0.0) + if (!child || isInvisible(child)) continue; bool needMove = (child->y() != voffset || child->x()); @@ -651,7 +656,7 @@ void QmlGraphicsRow::doPositioning() QList<QGraphicsItem *> children = childItems(); for (int ii = 0; ii < children.count(); ++ii) { QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(children.at(ii)); - if (!child || child->opacity() == 0.0) + if (!child || isInvisible(child)) continue; bool needMove = (child->x() != hoffset || child->y()); @@ -668,10 +673,8 @@ void QmlGraphicsRow::doPositioning() child->setX(hoffset); setMovingItem(0); } - if(child->width() && child->height()){//don't advance for invisible children - hoffset += child->width(); - hoffset += spacing(); - } + hoffset += child->width(); + hoffset += spacing(); } } @@ -867,7 +870,7 @@ void QmlGraphicsGrid::doPositioning() if (childIndex == children.count()) continue; QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(children.at(childIndex++)); - if (!child || child->opacity() == 0.0) + if (!child || isInvisible(child)) continue; if (child->width() > maxColWidth[j]) maxColWidth[j] = child->width(); @@ -888,7 +891,7 @@ void QmlGraphicsGrid::doPositioning() } foreach(QGraphicsItem* schild, children){ QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(schild); - if (!child || child->opacity() == 0.0) + if (!child || isInvisible(child)) continue; bool needMove = (child->x()!=xoffset)||(child->y()!=yoffset); QList<QPair<QString, QVariant> > changes; |