diff libgui/graphics/EditControl.cc @ 27319:6b2d20317b26

use Qt signals to manage calls to gh_manager functions in Qt graphics toolkit Limit access to the gh_manager object to the qt_graphics_toolkit class by using Qt signals to pass gh_manager events from individual graphics objects up to the qt_graphics_toolkit object. From there, we can make calls to the gh_manager object. * qt-graphics-toolkit.h, qt-graphics-toolkit.cc (qt_graphics_toolkit::gh_callback_event, qt_graphics_toolkit::gh_set_event): New slots. (qt_graphics_toolkit::create_object): Connect Object::gh_callback_event and Object::gh_set_event signals to qt_graphics_toolkit::gh_callback_event and qt_graphics_toolkit::gh_set_event slots. * BaseControl.cc, ButtonControl.cc, ButtonGroup.cc, Canvas.cc, ContextMenu.cc, EditControl.cc, Figure.cc, ListBoxControl.cc, Menu.cc, PopupMenuControl.cc, PushTool.cc, SliderControl.cc, Table.cc, ToggleTool.cc: Emit gh_callback_event and gh_set_event signals instead of calling gh_manager functions directly. * Object.h (Object::gh_callback_event, Object::gh_set_event): New signals. * Canvas.h (Canvas::gh_callback_event, Canvas::gh_set_event): New signals. * Container.h (Container::gh_callback_event, Container::gh_set_event): New signals.
author John W. Eaton <jwe@octave.org>
date Fri, 02 Aug 2019 15:19:43 -0500
parents 7455523fdf01
children 028205a91a07
line wrap: on
line diff
--- a/libgui/graphics/EditControl.cc	Fri Aug 02 14:28:48 2019 -0500
+++ b/libgui/graphics/EditControl.cc	Fri Aug 02 15:19:43 2019 -0500
@@ -228,17 +228,17 @@
     if (m_textChanged)
       {
         if (m_multiLine)
-          gh_manager::post_set (m_handle, "string",
-                                Utils::toCellString (txt.split ("\n")), false);
+          emit gh_set_event (m_handle, "string",
+                             Utils::toCellString (txt.split ("\n")), false);
         else
-          gh_manager::post_set (m_handle, "string",
-                                Utils::toStdString (txt), false);
+          emit gh_set_event (m_handle, "string",
+                             Utils::toStdString (txt), false);
 
         m_textChanged = false;
       }
 
     if (txt.length () > 0)
-      gh_manager::post_callback (m_handle, "callback");
+      emit gh_callback_event (m_handle, "callback");
   }
 
   void
@@ -250,12 +250,12 @@
                        ? qWidget<TextEdit> ()->toPlainText ()
                        : qWidget<QLineEdit> ()->text ());
         if (m_multiLine)
-          gh_manager::post_set (m_handle, "string",
-                                Utils::toCellString (txt.split ("\n")), false);
+          emit gh_set_event (m_handle, "string",
+                             Utils::toCellString (txt.split ("\n")), false);
         else
-          gh_manager::post_set (m_handle, "string",
-                                Utils::toStdString (txt), false);
-        gh_manager::post_callback (m_handle, "callback");
+          emit gh_set_event (m_handle, "string", Utils::toStdString (txt),
+                             false);
+        emit gh_callback_event (m_handle, "callback");
 
         m_textChanged = false;
       }