diff options
author | Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> | 2009-08-13 23:53:48 (GMT) |
---|---|---|
committer | Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> | 2009-08-13 23:53:48 (GMT) |
commit | fcd2540c1e5190b9edaebc6842263630a5d2da2b (patch) | |
tree | fe21b0ab31d46a2878b84091498b3ee74d01d410 /src/gui/graphicsview/qgraphicsanchorlayout.cpp | |
parent | 23441f49a23cbf936b60140c5c8a6d5cb3ca00a7 (diff) | |
download | Qt-fcd2540c1e5190b9edaebc6842263630a5d2da2b.zip Qt-fcd2540c1e5190b9edaebc6842263630a5d2da2b.tar.gz Qt-fcd2540c1e5190b9edaebc6842263630a5d2da2b.tar.bz2 |
QGraphicsAnchorLayout: prepare ground for doing less simplifications
Add variables to track whether the graph is simplified or not, as well
as make the functions that need it simplified/restored call the
corresponding functions. The functions look at the state variables, so
it's safe to just call them.
Also added Q_ASSERT() through the code paths that SHOULD have the full
graph (not simplified), for making easy to track bugs in future
refactorings.
Ironically this commit cause more calls to simplify/restore right now,
but the state will be better when we fix some functions to be
simplification compatible ;-)
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
Diffstat (limited to 'src/gui/graphicsview/qgraphicsanchorlayout.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsanchorlayout.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index 902f0b2..9846988 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -221,6 +221,12 @@ qreal QGraphicsAnchorLayout::spacing(Qt::Orientation orientation) const void QGraphicsAnchorLayout::setGeometry(const QRectF &geom) { Q_D(QGraphicsAnchorLayout); + + // ### REMOVE IT WHEN calculateVertexPositions and setItemsGeometries are + // simplification compatible! + d->restoreSimplifiedGraph(QGraphicsAnchorLayoutPrivate::Horizontal); + d->restoreSimplifiedGraph(QGraphicsAnchorLayoutPrivate::Vertical); + QGraphicsLayout::setGeometry(geom); d->calculateVertexPositions(QGraphicsAnchorLayoutPrivate::Horizontal); d->calculateVertexPositions(QGraphicsAnchorLayoutPrivate::Vertical); @@ -235,6 +241,10 @@ void QGraphicsAnchorLayout::removeAt(int index) if (!item) return; + // Removing an item affects both horizontal and vertical graphs + d->restoreSimplifiedGraph(QGraphicsAnchorLayoutPrivate::Horizontal); + d->restoreSimplifiedGraph(QGraphicsAnchorLayoutPrivate::Vertical); + d->removeCenterConstraints(item, QGraphicsAnchorLayoutPrivate::Horizontal); d->removeCenterConstraints(item, QGraphicsAnchorLayoutPrivate::Vertical); d->removeAnchors(item); |