GUI: Early return

This commit is contained in:
Daniel Marjamäki 2018-02-15 21:29:18 +01:00
parent cc2eb14130
commit f8c74032a7
1 changed files with 31 additions and 30 deletions

View File

@ -921,44 +921,45 @@ void ResultsTree::recheckSelectedFiles()
void ResultsTree::hideAllIdResult() void ResultsTree::hideAllIdResult()
{ {
if (mContextItem && mContextItem->parent()) { if (!mContextItem || !mContextItem->parent())
// Make sure we are working with the first column return;
if (mContextItem->column() != 0)
mContextItem = mContextItem->parent()->child(mContextItem->row(), 0);
QVariantMap data = mContextItem->data().toMap();
QString messageId = data["id"].toString(); // Make sure we are working with the first column
if (mContextItem->column() != 0)
mContextItem = mContextItem->parent()->child(mContextItem->row(), 0);
QVariantMap data = mContextItem->data().toMap();
// hide all errors with that message Id QString messageId = data["id"].toString();
int filecount = mModel.rowCount();
for (int i = 0; i < filecount; i++) { // hide all errors with that message Id
//Get file i int filecount = mModel.rowCount();
QStandardItem *file = mModel.item(i, 0); for (int i = 0; i < filecount; i++) {
if (!file) { //Get file i
QStandardItem *file = mModel.item(i, 0);
if (!file) {
continue;
}
//Get the amount of errors this file contains
int errorcount = file->rowCount();
for (int j = 0; j < errorcount; j++) {
//Get the error itself
QStandardItem *child = file->child(j, 0);
if (!child) {
continue; continue;
} }
//Get the amount of errors this file contains QVariantMap userdata = child->data().toMap();
int errorcount = file->rowCount(); if (userdata["id"].toString() == messageId) {
userdata["hide"] = true;
for (int j = 0; j < errorcount; j++) { child->setData(QVariant(userdata));
//Get the error itself
QStandardItem *child = file->child(j, 0);
if (!child) {
continue;
}
QVariantMap userdata = child->data().toMap();
if (userdata["id"].toString() == messageId) {
userdata["hide"] = true;
child->setData(QVariant(userdata));
}
} }
} }
refreshTree();
emit resultsHidden(true);
} }
refreshTree();
emit resultsHidden(true);
} }
void ResultsTree::suppressSelectedIds() void ResultsTree::suppressSelectedIds()