MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / toggleAdvancedMode

Method toggleAdvancedMode

src/openms_gui/source/VISUAL/ParamEditor.cpp:958–1027  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

956 }
957
958 void ParamEditor::toggleAdvancedMode(bool advanced)
959 {
960 advanced_mode_ = advanced;
961
962 stack<QTreeWidgetItem *> stack, node_stack;
963
964 //show/hide items
965 stack.push(tree_->invisibleRootItem());
966 while (!stack.empty())
967 {
968 QTreeWidgetItem * current = stack.top();
969 stack.pop();
970
971 Int type = current->data(0, Qt::UserRole).toInt();
972 if (type != NODE) //ITEM
973 {
974 if (advanced_mode_ && type == ADVANCED_ITEM) //advanced mode
975 {
976 current->setHidden(false);
977 }
978 else if (!advanced_mode_ && type == ADVANCED_ITEM) //Normal mode
979 {
980 current->setHidden(true);
981 }
982 }
983 else //NODE
984 {
985 for (Int i = 0; i < current->childCount(); ++i)
986 {
987 stack.push(current->child(i));
988 }
989
990 if (advanced_mode_)
991 {
992 current->setHidden(false); //show all nodes in advanced mode
993 }
994 else
995 {
996 node_stack.push(current); //store node pointers in normal mode
997 }
998 }
999 }
1000
1001 //hide sections that have no visible items in normal mode
1002 while (!node_stack.empty())
1003 {
1004 QTreeWidgetItem * current = node_stack.top();
1005 node_stack.pop();
1006
1007 bool has_visible_children = false;
1008 for (Int i = 0; i < current->childCount(); ++i)
1009 {
1010 if (!current->child(i)->isHidden())
1011 {
1012 has_visible_children = true;
1013 break;
1014 }
1015 }

Callers

nothing calls this directly

Calls 4

toIntMethod · 0.80
setHiddenMethod · 0.80
isHiddenMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected