# HG changeset patch # User Jacob Dawid # Date 1302728939 -7200 # Node ID 3c5d9483dbe5b65f13743768117363c6451f587b # Parent c14c80c8c29d711b38dcc00c52b399b1754faccd Update variable tree. diff -r c14c80c8c29d -r 3c5d9483dbe5 gui//src/VariablesDockWidget.cpp --- a/gui//src/VariablesDockWidget.cpp Wed Apr 13 22:57:47 2011 +0200 +++ b/gui//src/VariablesDockWidget.cpp Wed Apr 13 23:08:59 2011 +0200 @@ -63,5 +63,20 @@ } } - // TODO: Check the tree against the list for deleted variables. + // Check the tree against the list for deleted variables. + for(int i = 0; i < topLevelItem->childCount(); i++) { + bool existsInVariableList = false; + QTreeWidgetItem *child = topLevelItem->child(i); + foreach(OctaveLink::VariableMetaData variable, variablesList) { + if(variable.variableName == child->data(0, 0).toString()) { + existsInVariableList = true; + } + } + + if(!existsInVariableList) { + topLevelItem->removeChild(child); + delete child; + i--; + } + } }