GUI: Enable sorting in results view.

This commit is contained in:
Kimmo Varis 2009-06-04 17:46:19 +03:00
parent 0fe601a1c9
commit 9b5350e369
1 changed files with 1 additions and 15 deletions

View File

@ -35,10 +35,10 @@ ResultsTree::ResultsTree(QSettings &settings, ApplicationList &list) :
labels << tr("File") << tr("Severity") << tr("Line") << tr("Message"); labels << tr("File") << tr("Severity") << tr("Line") << tr("Message");
mModel.setHorizontalHeaderLabels(labels); mModel.setHorizontalHeaderLabels(labels);
setExpandsOnDoubleClick(false); setExpandsOnDoubleClick(false);
setSortingEnabled(true);
LoadSettings(); LoadSettings();
connect(this, SIGNAL(doubleClicked(const QModelIndex &)), connect(this, SIGNAL(doubleClicked(const QModelIndex &)),
this, SLOT(QuickStartApplication(const QModelIndex &))); this, SLOT(QuickStartApplication(const QModelIndex &)));
} }
ResultsTree::~ResultsTree() ResultsTree::~ResultsTree()
@ -46,8 +46,6 @@ ResultsTree::~ResultsTree()
SaveSettings(); SaveSettings();
} }
QStandardItem *ResultsTree::CreateItem(const QString &name) QStandardItem *ResultsTree::CreateItem(const QString &name)
{ {
QStandardItem *item = new QStandardItem(name); QStandardItem *item = new QStandardItem(name);
@ -55,7 +53,6 @@ QStandardItem *ResultsTree::CreateItem(const QString &name)
return item; return item;
} }
void ResultsTree::AddErrorItem(const QString &file, void ResultsTree::AddErrorItem(const QString &file,
const QString &severity, const QString &severity,
const QString &message, const QString &message,
@ -65,7 +62,6 @@ void ResultsTree::AddErrorItem(const QString &file,
{ {
Q_UNUSED(file); Q_UNUSED(file);
if (files.isEmpty()) if (files.isEmpty())
{ {
return; return;
@ -99,7 +95,6 @@ void ResultsTree::AddErrorItem(const QString &file,
data["id"] = id; data["id"] = id;
item->setData(QVariant(data)); item->setData(QVariant(data));
//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++)
{ {
@ -140,14 +135,12 @@ QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent,
list << CreateItem(QString("%1").arg(line)); list << CreateItem(QString("%1").arg(line));
list << CreateItem(message); list << CreateItem(message);
QModelIndex index = QModelIndex(); QModelIndex index = QModelIndex();
parent->appendRow(list); parent->appendRow(list);
setRowHidden(parent->rowCount() - 1, parent->index(), hide); setRowHidden(parent->rowCount() - 1, parent->index(), hide);
if (!icon.isEmpty()) if (!icon.isEmpty())
{ {
list[0]->setIcon(QIcon(icon)); list[0]->setIcon(QIcon(icon));
@ -532,7 +525,6 @@ void ResultsTree::SaveErrors(QTextStream &out, QStandardItem *item, bool xml)
} }
out << line << endl; out << line << endl;
} }
} }
@ -611,7 +603,6 @@ void ResultsTree::RefreshFilePaths(QStandardItem *item)
//Loop through all errors within this file //Loop through all errors within this file
for (int i = 0;i < item->rowCount();i++) for (int i = 0;i < item->rowCount();i++)
{ {
//Get error i //Get error i
QStandardItem *error = item->child(i, 0); QStandardItem *error = item->child(i, 0);
@ -620,7 +611,6 @@ void ResultsTree::RefreshFilePaths(QStandardItem *item)
continue; continue;
} }
//Get error's user data //Get error's user data
QVariant userdata = error->data(); QVariant userdata = error->data();
//Convert it to QVariantMap //Convert it to QVariantMap
@ -638,7 +628,6 @@ void ResultsTree::RefreshFilePaths(QStandardItem *item)
//Update this error's text //Update this error's text
error->setText(StripPath(files[0], false)); error->setText(StripPath(files[0], false));
//If this error has backtraces make sure the files list has enough filenames //If this error has backtraces make sure the files list has enough filenames
if (error->rowCount() <= files.size() - 1) if (error->rowCount() <= files.size() - 1)
{ {
@ -666,7 +655,6 @@ void ResultsTree::RefreshFilePaths(QStandardItem *item)
} }
} }
void ResultsTree::RefreshFilePaths() void ResultsTree::RefreshFilePaths()
{ {
qDebug("Refreshing file paths"); qDebug("Refreshing file paths");
@ -676,6 +664,4 @@ void ResultsTree::RefreshFilePaths()
{ {
RefreshFilePaths(mModel.item(i, 0)); RefreshFilePaths(mModel.item(i, 0));
} }
} }