GNU Octave  6.2.0
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) 2011-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_workspace_model_h)
27 #define octave_workspace_model_h 1
28 
29 #include <QAbstractTableModel>
30 #include <QChar>
31 #include <QColor>
32 #include <QList>
33 #include <QSemaphore>
34 #include <QStringList>
35 #include <QVector>
36 
37 #include "gui-settings.h"
38 
39 #include "syminfo.h"
40 
41 // Defined for purposes of sending QList<int> as part of signal.
43 
44 namespace octave
45 {
46  class base_qobject;
47 
49  {
50  Q_OBJECT
51 
52  public:
53 
54  workspace_model (base_qobject& oct_qobj, QObject *parent = nullptr);
55 
56  ~workspace_model (void) = default;
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 is_top_level (void) const { return m_top_level; }
70 
71  QColor storage_class_color (int s_class)
72  {
73  return m_storage_class_colors.at (s_class);
74  }
75 
77 
78  signals:
79 
80  void model_changed (void);
82 
83  public slots:
84 
85  void set_workspace (bool top_level, bool debug,
86  const symbol_info_list& syminfo);
87 
88  void clear_workspace (void);
89 
90  void notice_settings (const gui_settings *);
91 
92  private:
93 
94  void clear_data (void);
95  void update_table (void);
96 
98 
101  QString m_scopes;
102  QStringList m_symbols;
103  QStringList m_class_names;
104  QStringList m_dimensions;
105  QStringList m_values;
107 
108  QStringList m_columnNames;
109 
112 
113  };
114 }
115 
116 #endif
Base class for Octave interfaces that use Qt.
bool is_top_level(void) const
QList< QColor > m_storage_class_colors
int rowCount(const QModelIndex &parent=QModelIndex()) const
QColor storage_class_color(int s_class)
Qt::ItemFlags flags(const QModelIndex &index) const
void prompt_variable_editor(void)
~workspace_model(void)=default
void notice_settings(const gui_settings *)
void set_workspace(bool top_level, bool debug, const symbol_info_list &syminfo)
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
int columnCount(const QModelIndex &parent=QModelIndex()) const
workspace_model(base_qobject &oct_qobj, QObject *parent=nullptr)
QVariant data(const QModelIndex &index, int role) const
symbol_info_list m_syminfo_list
base_qobject & m_octave_qobj
symbol_info_list get_symbol_info(void) const
QList< int > QIntList
Definition: dialog.h:40
static bool debug
QList< int > QIntList