diff gui/src/WorkspaceModel.h @ 14669:7605e7136b50 gui

Discarded initFileEditor, instead put that in the constructor. Speedup for updating the symbol table by lowering complexity from n² to n. Fixed problem with hangup on quit. * FileEditor: Removed initFileEditor, put that code into the constructor. * WorkspaceModel: Simplified updating the symbol table. * OctaveLink: Add quit_allowed = true to prevent hangup on quit.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Tue, 22 May 2012 11:00:24 +0200
parents 6a6733a55982
children f346343654a4
line wrap: on
line diff
--- a/gui/src/WorkspaceModel.h
+++ b/gui/src/WorkspaceModel.h
@@ -56,6 +56,7 @@
 
 // Qt includes
 #include <QAbstractItemModel>
+#include <QVector>
 
 class TreeItem
 {
@@ -73,7 +74,7 @@
   }
 
   ~TreeItem() {
-    qDeleteAll(_childItems);
+     qDeleteAll(_childItems);
   }
 
   void insertChildItem(int at, TreeItem *item) {
@@ -86,6 +87,11 @@
     _childItems.append(item);
   }
 
+  void deleteChildItems() {
+      qDeleteAll(_childItems);
+      _childItems.clear();
+  }
+
   void removeChild(TreeItem *item) {
     _childItems.removeAll(item);
   }
@@ -154,7 +160,7 @@
 
   void updateFromSymbolTable ();
   void updateTreeEntry (TreeItem * treeItem, symbol_table::symbol_record *symbolRecord);
-  void updateCategory (int topLevelItemIndex, QList < symbol_table::symbol_record *> symbolTable);
+  void updateCategory (int topLevelItemIndex, const QList < symbol_table::symbol_record *> &symbolTable);
   QString octaveValueAsQString (const octave_value &octaveValue);
 
 signals: