When adding a new error, only hides it and doesn't check all errors.

This commit is contained in:
Vesa Pikki 2009-05-23 11:33:38 +03:00
parent f0a26b3ffe
commit ae7fc7fe3e
2 changed files with 17 additions and 14 deletions

View File

@ -68,14 +68,15 @@ void ResultsTree::AddErrorItem(const QString &file,
realfile = "Undefined file"; realfile = "Undefined file";
} }
bool hide = !mShowTypes[SeverityToShowType(severity)];
//Create the base item for the error and ensure it has a proper //Create the base item for the error and ensure it has a proper
//file item as a parent //file item as a parent
QStandardItem *item = AddBacktraceFiles(EnsureFileItem(realfile), QStandardItem *item = AddBacktraceFiles(EnsureFileItem(realfile),
realfile, realfile,
lines[0].toInt(), lines[0].toInt(),
severity, severity,
message); message,
hide);
//Add user data to that item //Add user data to that item
@ -89,21 +90,27 @@ void ResultsTree::AddErrorItem(const QString &file,
//Add backtrace files as children //Add backtrace files as children
for (int i=1;i<files.size() && i < lines.size();i++) for (int i=1;i<files.size() && i < lines.size();i++)
{ {
AddBacktraceFiles(item,files[i],lines[i].toInt(),severity,message); AddBacktraceFiles(item,files[i],lines[i].toInt(),severity,message,hide);
} }
//TODO just hide/show current error and it's file //TODO just hide/show current error and it's file
//since this does a lot of unnecessary work //since this does a lot of unnecessary work
RefreshTree(); if (!hide) {
ShowFileItem(realfile);
}
} }
QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent, QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent,
const QString &file, const QString &file,
const int line, const int line,
const QString &severity, const QString &severity,
const QString &message) const QString &message,
const bool hide)
{ {
if (!parent) {
return 0;
}
QList<QStandardItem*> list; QList<QStandardItem*> list;
list << CreateItem(file); list << CreateItem(file);
@ -112,16 +119,11 @@ QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent,
list << CreateItem(message); list << CreateItem(message);
QModelIndex index = QModelIndex();
if (parent)
{
parent->appendRow(list); parent->appendRow(list);
} setRowHidden(parent->rowCount()-1,parent->index(),hide);
else
{
mModel.appendRow(list);
}
//TODO Does this leak memory? Should items from list be deleted? //TODO Does this leak memory? Should items from list be deleted?

View File

@ -63,7 +63,8 @@ protected:
const QString &file, const QString &file,
const int line, const int line,
const QString &severity, const QString &severity,
const QString &message); const QString &message,
const bool hide);
void AddItem(int index); void AddItem(int index);
void RefreshTree(); void RefreshTree();