Mercurial > octave
annotate libgui/src/workspace-model.cc @ 16477:64727ed135cb
use QTableView instead of QTreeView to display workspace
* libgui/src/workspace-model.cc, libgui/src/workspace-model.h
(workspace_model::workspace_model): Change to subclass QTreeView,
using _columnNames for columns.
(workspace_model::~workspace_model): Don't delete rootItem.
(workspace_model::index): Delete.
(workspace_model::parent): Delete.
(workspace_model::rowCount): Return _symbols.size
(workspace_model::columnCount): Return _columnNames.size.
(workspace_model::insert_top_level_item): Delete.
(workspace_model::top_level_item): Delete.
(workspace_model::headerData): Return _columnNames.
(workspace_model::data): Return data from string lists values.
(workspace_model::set_workspace): Call update_table.
(workspace_model::clear_workspace): Call update_table.
(workspace_model::update_table): Rename from
workspace_model::update_tree.
(workspace_model::append_tree): Delete.
* libgui/src/workspace-model.h (tree_item): Delete class decl.
* libgui/src/workspace-view.h, libgui/src/workspace-view.cc
(workspace_view::workspace_view): Use QTableView instead of
QTreeView.
(workspace_view::_explicit_collapse): Delete.
(workspace_view::~workspace_view): Don't save _explicit_collapse
settings.
(workspace_view::model_changed): Delete.
(workspace_view::collapse_requested): Delete.
(workspace_view::expand_requested): Delete.
(workspace_view::relay_contextmenu_command): Get cell 0 of the row.
(workspace_view::contextmenu_requested): Get cell 0 of the row.
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Tue, 09 Apr 2013 03:26:11 -0400 |
parents | 0f143f68078d |
children | 079ec7ce60e0 |
rev | line source |
---|---|
16069
0486a29d780f
gui: fix updating history and workspace widget for mxe-octave
Torsten <ttl@justmail.de>
parents:
15402
diff
changeset
|
1 |
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
2 /* |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
3 |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
4 Copyright (C) 2013 John W. Eaton |
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
5 Copyright (C) 2011-2012 Jacob Dawid |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
6 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
7 This file is part of Octave. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
8 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
9 Octave is free software; you can redistribute it and/or modify it |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
10 under the terms of the GNU General Public License as published by the |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
11 Free Software Foundation; either version 3 of the License, or (at your |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
12 option) any later version. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
13 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
14 Octave is distributed in the hope that it will be useful, but WITHOUT |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
17 for more details. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
18 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
19 You should have received a copy of the GNU General Public License |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
20 along with Octave; see the file COPYING. If not, see |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
21 <http://www.gnu.org/licenses/>. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
22 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
23 */ |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
24 |
15155
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
14879
diff
changeset
|
25 #ifdef HAVE_CONFIG_H |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
14879
diff
changeset
|
26 #include <config.h> |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
14879
diff
changeset
|
27 #endif |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
14879
diff
changeset
|
28 |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
29 #include <QTreeWidget> |
14669
7605e7136b50
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.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14668
diff
changeset
|
30 #include <QTime> |
15155
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
14879
diff
changeset
|
31 |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
32 #include "symtab.h" |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
33 #include "variables.h" |
15155
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
14879
diff
changeset
|
34 |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
14879
diff
changeset
|
35 #include "workspace-model.h" |
14707
674740c44c09
Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14703
diff
changeset
|
36 #include "octave-link.h" |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
37 |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
38 workspace_model::workspace_model(QObject *p) |
16477
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
39 : QAbstractTableModel (p) |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
40 { |
16477
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
41 _columnNames.append(tr("Name")); |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
42 _columnNames.append(tr("Class")); |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
43 _columnNames.append(tr("Dimension")); |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
44 _columnNames.append(tr("Value")); |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
45 } |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
46 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
47 workspace_model::~workspace_model() |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
48 { |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
49 } |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
50 |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
51 int |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
52 workspace_model::rowCount(const QModelIndex &p) const |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
53 { |
16477
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
54 return _symbols.size(); |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
55 } |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
56 |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
57 int |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
58 workspace_model::columnCount(const QModelIndex &p) const |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
59 { |
16477
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
60 return _columnNames.size(); |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
61 } |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
62 |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
63 Qt::ItemFlags |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
64 workspace_model::flags(const QModelIndex &idx) const |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
65 { |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
66 if (!idx.isValid()) |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
67 return 0; |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
68 |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
69 return Qt::ItemIsEnabled | Qt::ItemIsSelectable; |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
70 } |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
71 |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
72 QVariant |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
73 workspace_model::headerData(int section, Qt::Orientation orientation, int role) const |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
74 { |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
75 if (orientation == Qt::Horizontal && role == Qt::DisplayRole) |
16477
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
76 { |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
77 return _columnNames[section]; |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
78 } |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
79 |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
80 return QVariant(); |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
81 } |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
82 |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
83 QVariant |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
84 workspace_model::data(const QModelIndex &idx, int role) const |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
85 { |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15367
diff
changeset
|
86 if (!idx.isValid()) |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
87 return QVariant(); |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
88 if (role != Qt::DisplayRole) |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
89 return QVariant(); |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
90 |
16477
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
91 switch(idx.column()) |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
92 { |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
93 case 0: |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
94 return QVariant(_symbols[idx.row()]); |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
95 case 1: |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
96 return QVariant(_class_names[idx.row()]); |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
97 case 2: |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
98 return QVariant(_dimensions[idx.row()]); |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
99 case 3: |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
100 return QVariant(_values[idx.row()]); |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
101 } |
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
102 return QVariant(); |
14664
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
103 } |
664f54233c98
Extracted model code from the WorkspaceView and rearranged it in a new model class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
104 |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
105 void |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
106 workspace_model::set_workspace (const QString& scopes, |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
107 const QStringList& symbols, |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
108 const QStringList& class_names, |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
109 const QStringList& dimensions, |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
110 const QStringList& values) |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
111 { |
16477
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
112 |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
113 _scopes = scopes; |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
114 _symbols = symbols; |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
115 _class_names = class_names; |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
116 _dimensions = dimensions; |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
117 _values = values; |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
118 |
16477
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
119 update_table (); |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
120 |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
121 emit model_changed (); |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
122 } |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
123 |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
124 void |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
125 workspace_model::clear_workspace (void) |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
126 { |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
127 clear_data (); |
16477
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
128 update_table (); |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
129 |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
130 emit model_changed (); |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
131 } |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
132 |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
133 void |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
134 workspace_model::clear_data (void) |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
135 { |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
136 _scopes = QString (); |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
137 _symbols = QStringList (); |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
138 _class_names = QStringList (); |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
139 _dimensions = QStringList (); |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
140 _values = QStringList (); |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
141 } |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
142 |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
143 void |
16477
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
144 workspace_model::update_table (void) |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
145 { |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
146 beginResetModel(); |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
147 |
16477
64727ed135cb
use QTableView instead of QTreeView to display workspace
John Donoghue <john.donoghue@ieee.org>
parents:
16468
diff
changeset
|
148 // nothing to do except tell the world to recalc |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
149 |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
150 endResetModel (); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
151 |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
152 emit model_changed (); |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16444
diff
changeset
|
153 } |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
154 |