GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
workspace-model.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2013-2018 John W. Eaton
4 Copyright (C) 2011-2018 Jacob Dawid
5 
6 This file is part of Octave.
7 
8 Octave is free software: you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <https://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if ! defined (octave_workspace_model_h)
25 #define octave_workspace_model_h 1
26 
27 #include <QAbstractTableModel>
28 #include <QVector>
29 #include <QSemaphore>
30 #include <QStringList>
31 #include <QChar>
32 #include <QList>
33 #include <QColor>
34 #include <QSettings>
35 
36 #include "symscope.h"
37 
38 // Defined for purposes of sending QList<int> as part of signal.
40 
41 namespace octave
42 {
44  : public QAbstractTableModel
45  {
46  Q_OBJECT
47 
48  public:
49 
50  workspace_model (QObject *parent = nullptr);
51 
52  ~workspace_model (void) = default;
53 
55 
56  static QStringList storage_class_names (void);
57 
58  int rowCount (const QModelIndex& parent = QModelIndex ()) const;
59 
60  int columnCount (const QModelIndex& parent = QModelIndex ()) const;
61 
62  Qt::ItemFlags flags (const QModelIndex& index) const;
63 
64  QVariant headerData (int section, Qt::Orientation orientation,
65  int role = Qt::DisplayRole) const;
66 
67  QVariant data (const QModelIndex& index, int role) const;
68 
69  bool setData (const QModelIndex& index, const QVariant& value,
70  int role = Qt::EditRole);
71 
72  bool is_top_level (void) const { return m_top_level; }
73 
74  QColor storage_class_color (int s_class)
75  {
76  return m_storage_class_colors.at (s_class);
77  }
78 
79  symbol_scope scope (void) const { return m_scope; }
80 
81  public slots:
82 
83  void set_workspace (bool top_level, bool debug,
84  const symbol_scope& scope);
85 
86  void clear_workspace (void);
87 
88  void notice_settings (const QSettings *);
89 
90  signals:
91 
92  void model_changed (void);
93  void prompt_variable_editor(void);
94 
95  void rename_variable (const QString& old_name, const QString& new_name);
96 
97  private:
98 
99  void clear_data (void);
100  void update_table (void);
101 
104  QString m_scopes;
105  QStringList m_symbols;
106  QStringList m_class_names;
107  QStringList m_dimensions;
108  QStringList m_values;
110 
111  QStringList m_columnNames;
112 
114 
115  };
116 }
117 
118 #endif
QList< int > QIntList
symbol_scope scope(void) const
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
QList< QColor > m_storage_class_colors
static bool debug
workspace_model(QObject *parent=nullptr)
void prompt_variable_editor(void)
QColor storage_class_color(int s_class)
int columnCount(const QModelIndex &parent=QModelIndex()) const
void set_workspace(bool top_level, bool debug, const symbol_scope &scope)
Qt::ItemFlags flags(const QModelIndex &index) const
void rename_variable(const QString &old_name, const QString &new_name)
bool is_top_level(void) const
QVariant data(const QModelIndex &index, int role) const
static QList< QColor > storage_class_default_colors(void)
~workspace_model(void)=default
static QStringList storage_class_names(void)
QList< int > QIntList
Definition: dialog.h:38
nd group nd example For each display the value
Definition: sysdep.cc:866
int rowCount(const QModelIndex &parent=QModelIndex()) const
void notice_settings(const QSettings *)