diff libgui/src/octave-qt-link.cc @ 24641:7d177be54c37

pass variable value to variable editor in addition to variable name * main-window.h, main-window.cc (main_window::edit_variable): Also pass value. Change all uses. * octave-qt-link.h, octave-qt-link.cc (octave_qt_link::octave_qt_link): Call qRegisterMetaType for octave_value. (octave_qt_link::do_edit_variable): Rename from octave_qt_link::do_openvar. Change all uses. (edit_variable_signal): Rename from open_variable_signal. * variable-editor-model.h, variable-editor-model.cc (variable_editor_model::variable_editor_model): Also pass value. Change all uses. * variable-editor.h, variable-editor.cc (variable_editor::edit_variable): Also pass value. Change all uses. Align label at top of vbox layout. * octave-link.h, octave-link.cc (Fopenvar): Use DEFMETHOD. Get value from current scope and pass to octave_link::edit_variable. (octave_link::edit_variable): Rename from octave_link::openvar. Change all uses. (octave_link::do_edit_variable): Rename from octave_link::do_openvar. Change all uses.
author John W. Eaton <jwe@octave.org>
date Thu, 25 Jan 2018 23:59:57 -0500
parents e9f7cfd40f85
children f61502510d08
line wrap: on
line diff
--- a/libgui/src/octave-qt-link.cc	Tue Jan 23 14:36:00 2018 -0500
+++ b/libgui/src/octave-qt-link.cc	Thu Jan 25 23:59:57 2018 -0500
@@ -26,10 +26,11 @@
 #  include "config.h"
 #endif
 
-#include <QStringList>
 #include <QDialog>
 #include <QDir>
+#include <QMetaType>
 #include <QPushButton>
+#include <QStringList>
 
 #include "oct-env.h"
 #include "str-vec.h"
@@ -39,6 +40,7 @@
 #include "error.h"
 #include "interpreter-private.h"
 #include "load-path.h"
+#include "ov.h"
 #include "utils.h"
 
 #include "octave-gui.h"
@@ -49,7 +51,9 @@
 octave_qt_link::octave_qt_link (QWidget *,
                                 octave::gui_application *app_context)
   : octave_link (), m_app_context (app_context)
-{ }
+{
+  qRegisterMetaType<octave_value> ("octave_value");
+}
 
 bool
 octave_qt_link::do_confirm_shutdown (void)
@@ -616,9 +620,9 @@
 }
 
 void
-octave_qt_link::do_openvar (const std::string &expr)
+octave_qt_link::do_edit_variable (const std::string& expr, const octave_value& val)
 {
-  emit open_variable_signal (QString::fromStdString (expr));
+  emit edit_variable_signal (QString::fromStdString (expr), val);
 }
 
 void