forked from qt-creator/qt-creator
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user