Mercurial > hg > octave-lyh
view libgui/src/workspace-view.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 | 8e2a853cdd7d |
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_view_h) #define workspace_view_h 1 #include <QTableView> #include <QSemaphore> #include "octave-dock-widget.h" #include "workspace-model.h" class workspace_view : public octave_dock_widget { Q_OBJECT public: workspace_view (QWidget * parent = 0); ~workspace_view (void); public: void setModel (workspace_model *model) { view->setModel (model); } signals: /** signal that user had requested a command on a variable */ void command_requested (const QString& cmd); protected: void closeEvent (QCloseEvent *event); protected slots: void item_double_clicked (QModelIndex index); void contextmenu_requested (const QPoint& pos); // context menu slots void handle_contextmenu_disp (void); void handle_contextmenu_plot (void); void handle_contextmenu_stem (void); private: void relay_contextmenu_command (const QString& cmdname); QTableView * view; }; #endif