Mercurial > octave
diff libgui/src/main-window.cc @ 16445:3f8d3fc907af
store workspace model in main_window, not in workspace view
* main-window.h, main-window.cc (main_window::_workspace_model):
New data member.
(main_window::construct): Create _workspace_model and make it the
model for _workspace_view. connect _workspace_model::model_changed
to _workspace_view::model_changed.
(main_window::~main_window): Delete _workspace_model.
* workspace-view.h, workspace-view.cc
(workspace_view::_workspace_model): Delete. Use model() method to get
model where needed.
(workspace_view::setModel): New function.
(workspace_view::view): Rename from _workspace_tree_view. Change all
uses.
(workspace_view::workspace_view): Don't connect
_workspace_model::model_changed signal to
workspace_view::model_changed here.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 06 Apr 2013 14:23:52 -0400 |
parents | 7a2ee6ea7800 |
children | 4b3a4bf8569b |
line wrap: on
line diff
--- a/libgui/src/main-window.cc Sat Apr 06 14:01:58 2013 -0400 +++ b/libgui/src/main-window.cc Sat Apr 06 14:23:52 2013 -0400 @@ -93,8 +93,8 @@ if (_history_dock_widget) delete _history_dock_widget; - if (_workspace_view) - delete _workspace_view; + delete _workspace_model; + delete _workspace_view; } void @@ -661,9 +661,18 @@ _closing = false; // flag for editor files when closed setWindowIcon (QIcon(":/actions/icons/logo.png")); + // Create a new workspace model. + _workspace_model = new workspace_model (); + // Setup dockable widgets and the status bar. _workspace_view = new workspace_view (this); + + _workspace_view->setModel (_workspace_model); _workspace_view->setStatusTip (tr ("View the variables in the active workspace.")); + + connect (_workspace_model, SIGNAL (model_changed ()), + _workspace_view, SLOT (model_changed ())); + _history_dock_widget = new history_dock_widget (this); _history_dock_widget->setStatusTip (tr ("Browse and search the command history.")); _files_dock_widget = new files_dock_widget (this);