GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
workspace-view.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_view_h)
25 #define octave_workspace_view_h 1
26 
27 #include <QItemDelegate>
28 #include <QTableView>
29 #include <QSemaphore>
30 #include <QComboBox>
31 #include <QSortFilterProxyModel>
32 #include <QCheckBox>
33 #include <QSignalMapper>
34 
35 #include "ov.h"
36 
37 #include "octave-dock-widget.h"
38 #include "workspace-model.h"
39 
40 namespace octave
41 {
43  {
44  Q_OBJECT
45 
46  public:
47 
48  workspace_view (QWidget *parent = nullptr);
49 
50  ~workspace_view (void) = default;
51 
52  public slots:
53 
54  void setModel (workspace_model *model);
55 
56  void notice_settings (const QSettings *);
57 
58  void save_settings (void);
59 
60  signals:
61 
62  //! Signal that user had requested a command on a variable.
63 
64  void command_requested (const QString& cmd);
65 
66  //! Signal that user wants to edit a variable.
67 
68  void edit_variable_signal (const QString&, const octave_value&);
69 
70  protected:
71 
72  void closeEvent (QCloseEvent *event);
73 
74  protected slots:
75 
76  void filter_update (const QString& expression);
77  void filter_activate (bool enable);
78  void update_filter_history (void);
79 
80  void header_contextmenu_requested (const QPoint& mpos);
81 
82  void toggle_header (int column);
83 
84  void contextmenu_requested (const QPoint& pos);
85 
86  void handle_contextmenu_copy (void);
88  void handle_contextmenu_rename (void);
89  void handle_contextmenu_edit (void);
90  void handle_contextmenu_clear (void);
91  void handle_contextmenu_disp (void);
92  void handle_contextmenu_plot (void);
93  void handle_contextmenu_stem (void);
94  void handle_contextmenu_filter (void);
95 
96  void handle_model_changed (void);
97 
98  void copyClipboard (void);
99  void selectAll (void);
100 
101  private:
102 
103  void relay_contextmenu_command (const QString& cmdname, bool str = false);
104 
105  QString get_var_name (const QModelIndex& index);
106 
109 
110  // We are using a sort model proxy so m_model won't provide the
111  // correct ordering. It is still OK to use this pointer to access
112  // other info attached to the model, for example the scope or colors.
114 
115  QSortFilterProxyModel m_filter_model;
116  QCheckBox *m_filter_checkbox;
117  QComboBox *m_filter;
120 
121  enum { MaxFilterHistory = 10 };
122 
123  QStringList m_columns_shown;
124  QStringList m_columns_shown_keys;
125  QSignalMapper *m_sig_mapper;
126  };
127 }
128 
129 #endif
void relay_contextmenu_command(const QString &cmdname, bool str=false)
void toggle_header(int column)
OCTAVE_EXPORT octave_value_list column
Definition: sparse.cc:123
workspace_model * m_model
void closeEvent(QCloseEvent *event)
~workspace_view(void)=default
void header_contextmenu_requested(const QPoint &mpos)
QSortFilterProxyModel m_filter_model
QStringList m_columns_shown_keys
void handle_contextmenu_disp(void)
void handle_contextmenu_copy_value(void)
workspace_view(QWidget *parent=nullptr)
void command_requested(const QString &cmd)
Signal that user had requested a command on a variable.
void handle_contextmenu_rename(void)
std::string str
Definition: hash.cc:118
QString get_var_name(const QModelIndex &index)
void handle_contextmenu_edit(void)
void update_filter_history(void)
void handle_contextmenu_plot(void)
void filter_update(const QString &expression)
void handle_contextmenu_stem(void)
void handle_contextmenu_filter(void)
void handle_contextmenu_copy(void)
void filter_activate(bool enable)
QSignalMapper * m_sig_mapper
void setModel(workspace_model *model)
void handle_contextmenu_clear(void)
void contextmenu_requested(const QPoint &pos)
void edit_variable_signal(const QString &, const octave_value &)
Signal that user wants to edit a variable.
void notice_settings(const QSettings *)
QCheckBox * m_filter_checkbox