From 46a43f3041e8c7b9fa91232b99af1bdf253565d0 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Wed, 14 Oct 2015 17:44:52 +0200 Subject: [PATCH] GUI: Properly refresh result tree if new rows are added (#4727) --- gui/resultstree.cpp | 18 +++++------------- gui/resultstree.h | 7 ------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index cf78ca080..dfead6bc3 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -105,7 +105,6 @@ bool ResultsTree::AddErrorItem(const ErrorItem &item) } bool hide = !mShowSeverities.isShown(item.severity); - //bool hide = !mShowTypes[SeverityToShowType(item.severity)]; //If specified, filter on summary, message, filename, and id if (!hide && !mFilter.isEmpty()) { @@ -132,7 +131,8 @@ bool ResultsTree::AddErrorItem(const ErrorItem &item) line.severity = item.severity; //Create the base item for the error and ensure it has a proper //file item as a parent - QStandardItem *stditem = AddBacktraceFiles(EnsureFileItem(item.files[0], item.file0, hide), + QStandardItem* fileItem = EnsureFileItem(item.files[0], item.file0, hide); + QStandardItem* stditem = AddBacktraceFiles(fileItem, line, hide, SeverityToIcon(line.severity)); @@ -175,10 +175,10 @@ bool ResultsTree::AddErrorItem(const ErrorItem &item) child_item->setData(QVariant(child_data)); } - //TODO just hide/show current error and it's file - //since this does a lot of unnecessary work + // Partially refresh the tree: Unhide error item and file item if necessary if (!hide) { - ShowFileItem(realfile); + setRowHidden(stditem->row(), stditem->index(), false); + setRowHidden(fileItem->row(), QModelIndex(), false); } return true; } @@ -470,14 +470,6 @@ QStandardItem *ResultsTree::EnsureFileItem(const QString &fullpath, const QStrin return item; } -void ResultsTree::ShowFileItem(const QString &name) -{ - QStandardItem *item = FindFileItem(name); - if (item) { - setRowHidden(0, mModel.indexFromItem(item), false); - } -} - void ResultsTree::contextMenuEvent(QContextMenuEvent * e) { QModelIndex index = indexAt(e->pos()); diff --git a/gui/resultstree.h b/gui/resultstree.h index 935356310..8069e686d 100644 --- a/gui/resultstree.h +++ b/gui/resultstree.h @@ -386,13 +386,6 @@ protected: */ QStandardItem *EnsureFileItem(const QString &fullpath, const QString &file0, bool hide); - /** - * @brief Show a file item - * - * @param name Filename of the fileitem - */ - void ShowFileItem(const QString &name); - /** * @brief Item model for tree *