changeset 27220:9a4a9fcc186b

connect workspace view rename variable signal to main window slot * workspace-view.h (workspace_view::rename_variable_signal): New signal. * workspace-view.cc (workspace_view::handle_contextmenu_rename): Emit new rename_variable_signal instead of calling setData. * main-window.cc (main_window::construct): Connect handle_rename_variable_request slot to new workspace view rename_variable_signal instead of workspace model rename_variable signal.
author John W. Eaton <jwe@octave.org>
date Mon, 01 Jul 2019 18:00:04 -0400
parents b88d66c631c8
children 0fe52ad36b24
files libgui/src/main-window.cc libgui/src/workspace-view.cc libgui/src/workspace-view.h
diffstat 3 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Fri Jun 28 17:03:28 2019 -0400
+++ b/libgui/src/main-window.cc	Mon Jul 01 18:00:04 2019 -0400
@@ -1669,8 +1669,8 @@
     connect (qt_link, SIGNAL (refresh_variable_editor_signal (void)),
              this, SLOT (refresh_variable_editor (void)));
 
-    connect (m_workspace_model,
-             SIGNAL (rename_variable (const QString&, const QString&)),
+    connect (m_workspace_window,
+             SIGNAL (rename_variable_signal (const QString&, const QString&)),
              this,
              SLOT (handle_rename_variable_request (const QString&,
                                                    const QString&)));
--- a/libgui/src/workspace-view.cc	Fri Jun 28 17:03:28 2019 -0400
+++ b/libgui/src/workspace-view.cc	Mon Jul 01 18:00:04 2019 -0400
@@ -452,10 +452,7 @@
                                   QLineEdit::Normal, var_name, &ok);
 
         if (ok && ! new_name.isEmpty ())
-          {
-            QAbstractItemModel *m = m_view->model ();
-            m->setData (index, new_name, Qt::EditRole);
-          }
+          emit rename_variable_signal (var_name, new_name);
       }
   }
 
--- a/libgui/src/workspace-view.h	Fri Jun 28 17:03:28 2019 -0400
+++ b/libgui/src/workspace-view.h	Mon Jul 01 18:00:04 2019 -0400
@@ -63,6 +63,10 @@
 
     void command_requested (const QString& cmd);
 
+    //! Signal that user wants to rename a variable.
+
+    void rename_variable_signal (const QString&, const QString&);
+
     //! Signal that user wants to edit a variable.
 
     void edit_variable_signal (const QString&, const octave_value&);