From: Rene Gassmoeller Date: Fri, 7 Apr 2017 21:55:28 +0000 (-0600) Subject: Address comments X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c52189cf72bfe6e74c5607f30df6f16d3e49dd09;p=parameter_gui.git Address comments --- diff --git a/mainwindow.cpp b/mainwindow.cpp index 3e26747..b129089 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -119,8 +119,8 @@ namespace dealii font.setWeight(QFont::Normal); item->setFont(1,font); - const bool hide_default_items = gui_settings->value("Settings/hideDefault", false).toBool(); - if (hide_default_items) + const bool hide_items_with_default_value = gui_settings->value("Settings/hideDefault", false).toBool(); + if (hide_items_with_default_value) item->setHidden(true); } else @@ -311,7 +311,7 @@ namespace dealii if (hide_default_values) { for (int i = 0; i < tree_widget->topLevelItemCount(); ++i) - hide_default_item(tree_widget->topLevelItem(i)); + hide_item_with_default_value(tree_widget->topLevelItem(i)); hide_default->setChecked(true); } else @@ -328,7 +328,7 @@ namespace dealii - bool MainWindow::hide_default_item(QTreeWidgetItem *item) + bool MainWindow::hide_item_with_default_value(QTreeWidgetItem *item) { bool has_default_value = true; @@ -341,9 +341,10 @@ namespace dealii } else { + // If this element has children recurse into them and check for default values for (int i = 0; i < item->childCount(); ++i) { - const bool child_has_default_value = hide_default_item(item->child(i)); + const bool child_has_default_value = hide_item_with_default_value(item->child(i)); has_default_value = has_default_value & child_has_default_value; } } diff --git a/mainwindow.h b/mainwindow.h index 1f48daf..7008af3 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -193,7 +193,7 @@ namespace dealii * and hide all default items. Returns true if the item and all of its * children have default values. */ - bool hide_default_item(QTreeWidgetItem *item); + bool hide_item_with_default_value(QTreeWidgetItem *item); /** * This is the tree structure in which we store all parameters.