diff options
author | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-05-28 20:26:21 (GMT) |
---|---|---|
committer | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-07-22 18:04:08 (GMT) |
commit | 12913735db966558ac255780aaee0ec0d1096a8c (patch) | |
tree | c586f0b80f36f97bdf2df2dbcea60f235714bd91 /src | |
parent | 4bd165d6849311b948ed87b9a51c7318ae6bd748 (diff) | |
download | Qt-12913735db966558ac255780aaee0ec0d1096a8c.zip Qt-12913735db966558ac255780aaee0ec0d1096a8c.tar.gz Qt-12913735db966558ac255780aaee0ec0d1096a8c.tar.bz2 |
QGraphicsAnchorLayout: Delete internal layout edges in destructor
The internal layout anchors were leaking, now we delete them when
destroying the layout.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/graphicsview/qgraphicsanchorlayout.cpp | 2 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 10 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsanchorlayout_p.h | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index d91b4ab..b3dcdd0 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -60,6 +60,8 @@ QGraphicsAnchorLayout::~QGraphicsAnchorLayout() delete item; } } + + d->deleteLayoutEdges(); } void QGraphicsAnchorLayout::anchor(QGraphicsLayoutItem *firstItem, diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index d3d0072..6bcc1f4 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -173,6 +173,16 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges() graph[Vertical].setRootVertex(v); } +void QGraphicsAnchorLayoutPrivate::deleteLayoutEdges() +{ + Q_Q(QGraphicsAnchorLayout); + + removeAnchor(q, QGraphicsAnchorLayout::Left, q, QGraphicsAnchorLayout::HCenter); + removeAnchor(q, QGraphicsAnchorLayout::HCenter, q, QGraphicsAnchorLayout::Right); + removeAnchor(q, QGraphicsAnchorLayout::Top, q, QGraphicsAnchorLayout::VCenter); + removeAnchor(q, QGraphicsAnchorLayout::VCenter, q, QGraphicsAnchorLayout::Bottom); +} + void QGraphicsAnchorLayoutPrivate::createItemEdges(QGraphicsLayoutItem *item) { items.append(item); diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 65315fb..89d3bfc 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -230,6 +230,7 @@ public: // Init methods void createLayoutEdges(); + void deleteLayoutEdges(); void createItemEdges(QGraphicsLayoutItem *item); // Anchor Manipulation methods |