TreeModel: Introduce a destroyItem() convenience function

Shorthand for delete takeItem(...).

Change-Id: Icb7b60e5c19aa0d21650eefff65f7eb55e9f90b0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2016-07-04 15:53:53 +02:00
committed by hjk
parent 4c5ee0c02b
commit 7b4c7d49a9
15 changed files with 30 additions and 29 deletions

View File

@@ -1289,7 +1289,7 @@ bool WatchHandler::insertItem(WatchItem *item)
const QVector<TreeItem *> siblings = parent->children();
for (int row = 0, n = siblings.size(); row < n; ++row) {
if (static_cast<WatchItem *>(siblings.at(row))->iname == item->iname) {
delete m_model->takeItem(parent->children().at(row));
m_model->destroyItem(parent->children().at(row));
parent->insertChild(row, item);
found = true;
break;
@@ -1377,7 +1377,7 @@ void WatchHandler::notifyUpdateFinished()
});
foreach (auto item, toRemove)
delete m_model->takeItem(item);
m_model->destroyItem(item);
m_model->m_contentsValid = true;
updateWatchersWindow();
@@ -1400,7 +1400,7 @@ void WatchHandler::removeItemByIName(const QString &iname)
theWatcherNames.remove(item->exp);
saveWatchers();
}
delete m_model->takeItem(item);
m_model->destroyItem(item);
updateWatchersWindow();
}