changeset 13427:3c5d9483dbe5

Update variable tree.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Wed, 13 Apr 2011 23:08:59 +0200
parents c14c80c8c29d
children 5f16b194d138
files gui//src/VariablesDockWidget.cpp
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gui//src/VariablesDockWidget.cpp
+++ b/gui//src/VariablesDockWidget.cpp
@@ -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--;
+        }
+    }
 }