diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-12 04:25:36 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-12 04:25:36 (GMT) |
commit | 55e47566dd1ac83ff674401dfd6284f07490cd8b (patch) | |
tree | 78bd95dd0514f2538526baff5277c63087bb835b /src/gui | |
parent | ef0d191e3d138f695a39128b6040d0884821f5b5 (diff) | |
parent | 93f11099cd87dd7a2c623a36f8f0a704fbe4e038 (diff) | |
download | Qt-55e47566dd1ac83ff674401dfd6284f07490cd8b.zip Qt-55e47566dd1ac83ff674401dfd6284f07490cd8b.tar.gz Qt-55e47566dd1ac83ff674401dfd6284f07490cd8b.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Some polishing to merge request 723
Patch to QTBUG-3078
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/graphicsview/qgraphicsgridlayout.cpp | 12 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsgridlayout.h | 1 | ||||
-rw-r--r-- | src/gui/graphicsview/qgridlayoutengine.cpp | 9 | ||||
-rw-r--r-- | src/gui/graphicsview/qgridlayoutengine_p.h | 1 |
4 files changed, 23 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsgridlayout.cpp b/src/gui/graphicsview/qgraphicsgridlayout.cpp index 062b5ac..8a3f17a 100644 --- a/src/gui/graphicsview/qgraphicsgridlayout.cpp +++ b/src/gui/graphicsview/qgraphicsgridlayout.cpp @@ -589,6 +589,18 @@ void QGraphicsGridLayout::removeAt(int index) } /*! + Removes the layout item \a item without destroying it. + Ownership of the item is transferred to the caller. + + \sa addItem() +*/ +void QGraphicsGridLayout::removeItem(QGraphicsLayoutItem *item) +{ + Q_D(QGraphicsGridLayout); + int index = d->engine.indexOf(item); + removeAt(index); +} +/*! \reimp */ void QGraphicsGridLayout::invalidate() diff --git a/src/gui/graphicsview/qgraphicsgridlayout.h b/src/gui/graphicsview/qgraphicsgridlayout.h index ddfb447..d10235c 100644 --- a/src/gui/graphicsview/qgraphicsgridlayout.h +++ b/src/gui/graphicsview/qgraphicsgridlayout.h @@ -114,6 +114,7 @@ public: int count() const; QGraphicsLayoutItem *itemAt(int index) const; void removeAt(int index); + void removeItem(QGraphicsLayoutItem *item); void invalidate(); diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index a084647..8b65282 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -775,6 +775,15 @@ QGridLayoutItem *QGridLayoutEngine::itemAt(int index) const return q_items.at(index); } +int QGridLayoutEngine::indexOf(QGraphicsLayoutItem *item) const +{ + for (int i = 0; i < q_items.size(); ++i) { + if (item == q_items.at(i)->layoutItem()) + return i; + } + return -1; +} + int QGridLayoutEngine::effectiveFirstRow(Qt::Orientation orientation) const { ensureEffectiveFirstAndLastRows(); diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/gui/graphicsview/qgridlayoutengine_p.h index 9ac9a8e..a4ef21d 100644 --- a/src/gui/graphicsview/qgridlayoutengine_p.h +++ b/src/gui/graphicsview/qgridlayoutengine_p.h @@ -326,6 +326,7 @@ public: // returns the number of items inserted, which may be less than (rowCount * columnCount) int itemCount() const; QGridLayoutItem *itemAt(int index) const; + int indexOf(QGraphicsLayoutItem *item) const; int effectiveFirstRow(Qt::Orientation orientation = Qt::Vertical) const; int effectiveLastRow(Qt::Orientation orientation = Qt::Vertical) const; |