forked from qt-creator/qt-creator
TreeModel: Add model pointer to TreeItem
... and use the items themselves as main entry point for item related operations. With non-uniform tree items it's easier to have item specific functionality directly in the item implementation instead of the model. Change-Id: I4e9b7db98d16b91ddef81917417691129bb83621 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -198,7 +198,7 @@ QAbstractItemModel *ModulesHandler::model() const
|
||||
|
||||
void ModulesHandler::removeAll()
|
||||
{
|
||||
m_model->removeAllSubItems(m_model->rootItem());
|
||||
m_model->removeItems();
|
||||
}
|
||||
|
||||
Modules ModulesHandler::modules() const
|
||||
@@ -228,13 +228,13 @@ void ModulesHandler::updateModule(const Module &module)
|
||||
} else {
|
||||
item = new ModuleItem;
|
||||
item->module = module;
|
||||
m_model->appendItem(m_model->rootItem(), item);
|
||||
m_model->rootItem()->appendChild(item);
|
||||
}
|
||||
|
||||
try { // MinGW occasionallly throws std::bad_alloc.
|
||||
ElfReader reader(path);
|
||||
item->module.elfData = reader.readHeaders();
|
||||
m_model->updateItem(item);
|
||||
item->update();
|
||||
} catch(...) {
|
||||
qWarning("%s: An exception occurred while reading module '%s'",
|
||||
Q_FUNC_INFO, qPrintable(module.modulePath));
|
||||
|
||||
Reference in New Issue
Block a user