From 7e522c8a3719b8f65f8f45ff46635011714fad09 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 14 Jan 2015 09:09:15 +0100 Subject: 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 --- src/plugins/debugger/moduleshandler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/plugins/debugger/moduleshandler.cpp') diff --git a/src/plugins/debugger/moduleshandler.cpp b/src/plugins/debugger/moduleshandler.cpp index f1df561f71..8efb7b63b5 100644 --- a/src/plugins/debugger/moduleshandler.cpp +++ b/src/plugins/debugger/moduleshandler.cpp @@ -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)); -- cgit v1.2.1