summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@digia.com>2013-11-29 07:59:43 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-21 13:28:28 +0100
commit28b85835bb83b6edc4a976384ed90e2898e40a60 (patch)
treee33f6a42d4cfbe6c67f16088e06dd6e976bd69de /src/gui
parent14170bbf09d2f1fee3cf2fd8a8087f7e913839b4 (diff)
Add deleteItems(), needed by QtQuick.Layouts
(Picked from QGridLayoutEngine in qtquickcontrols) Change-Id: Ieb00f7fb0166669e6831f3d3dbe3a9ef78b57453 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/util/qgridlayoutengine_p.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/util/qgridlayoutengine_p.h b/src/gui/util/qgridlayoutengine_p.h
index 7f5bfcfaee..f85513285a 100644
--- a/src/gui/util/qgridlayoutengine_p.h
+++ b/src/gui/util/qgridlayoutengine_p.h
@@ -375,6 +375,18 @@ public:
void insertItem(QGridLayoutItem *item, int index);
void addItem(QGridLayoutItem *item);
void removeItem(QGridLayoutItem *item);
+ void deleteItems()
+ {
+ const QList<QGridLayoutItem *> oldItems = q_items;
+ q_items.clear(); // q_items are used as input when the grid is regenerated in removeRows
+ // The following calls to removeRows are suboptimal
+ int rows = rowCount(Qt::Vertical);
+ removeRows(0, rows, Qt::Vertical);
+ rows = rowCount(Qt::Horizontal);
+ removeRows(0, rows, Qt::Horizontal);
+ qDeleteAll(oldItems);
+ }
+
QGridLayoutItem *itemAt(int row, int column, Qt::Orientation orientation = Qt::Vertical) const;
inline void insertRow(int row, Qt::Orientation orientation = Qt::Vertical)
{ insertOrRemoveRows(row, +1, orientation); }