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

@@ -207,7 +207,7 @@ Modules ModulesHandler::modules() const
void ModulesHandler::removeModule(const QString &modulePath)
{
if (ModuleItem *item = moduleFromPath(m_model->rootItem(), modulePath))
delete m_model->takeItem(item);
m_model->destroyItem(item);
}
void ModulesHandler::updateModule(const Module &module)
@@ -249,7 +249,7 @@ void ModulesHandler::endUpdateAll()
for (int i = root->rowCount(); --i >= 0; ) {
auto item = static_cast<ModuleItem *>(root->child(i));
if (!item->updated)
delete m_model->takeItem(item);
m_model->destroyItem(item);
}
}