Mercurial > hg > octave-lyh
view libgui/src/workspace-model.h @ 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 |
line wrap: on
line source
/* Copyright (C) 2013 John W. Eaton Copyright (C) 2011-2012 Jacob Dawid This file is part of Octave. Octave is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Octave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Octave; see the file COPYING. If not, see <http://www.gnu.org/licenses/>. */ #if !defined (workspace_model_h) #define workspace_model_h 1 #include <QAbstractTableModel> #include <QVector> #include <QSemaphore> #include <QStringList> class workspace_model : public QAbstractTableModel { Q_OBJECT public: workspace_model (QObject *parent = 0); ~workspace_model (void); QVariant data (const QModelIndex &index, int role) const; Qt::ItemFlags flags (const QModelIndex &index) const; QVariant headerData (int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; int rowCount (const QModelIndex &parent = QModelIndex ()) const; int columnCount (const QModelIndex &parent = QModelIndex ()) const; public slots: void set_workspace (const QString& scopes, const QStringList& symbols, const QStringList& class_names, const QStringList& dimensions, const QStringList& values); void clear_workspace (void); signals: void model_changed (void); private: void clear_data (void); void update_table (void); QString _scopes; QStringList _symbols; QStringList _class_names; QStringList _dimensions; QStringList _values; QStringList _columnNames; }; #endif // WORKSPACEMODEL_H