changeset 24435:e7624c23b101

Make use of "close" function to close Qt figures (bug #52698). * Figure.h/cc (Figure::close_figure_callback): new callback method that calls "close" interpreted function. (Figure::eventNotifyBefore): make use of close_figure_callback to handle QEvent::Close.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Wed, 20 Dec 2017 10:09:28 +0100
parents 436deae9f9ab
children 9c684d270c79
files libgui/graphics/Figure.cc libgui/graphics/Figure.h
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/Figure.cc	Wed Dec 20 16:40:15 2017 -0800
+++ b/libgui/graphics/Figure.cc	Wed Dec 20 10:09:28 2017 +0100
@@ -696,6 +696,15 @@
     gh_manager::post_function (Figure::updateBoundingBoxHelper, d);
   }
 
+  void
+  Figure::close_figure_callback (void)
+  {
+    figure::properties& fp = properties<figure> ();
+    octave_value fnum = fp.get___myhandle__ ().as_octave_value ();
+    
+    Ffeval (ovl ("close", fnum));
+  }
+
   bool
   Figure::eventNotifyBefore (QObject *obj, QEvent *xevent)
   {
@@ -732,7 +741,7 @@
               {
               case QEvent::Close:
                 xevent->ignore ();
-                gh_manager::post_callback (m_handle, "closerequestfcn");
+                octave_link::post_event (this, &Figure::close_figure_callback);
                 return true;
 
               default:
--- a/libgui/graphics/Figure.h	Wed Dec 20 16:40:15 2017 -0800
+++ b/libgui/graphics/Figure.h	Wed Dec 20 10:09:28 2017 +0100
@@ -110,8 +110,9 @@
 
     static void updateBoundingBoxHelper (void*);
 
+    void close_figure_callback (void);
+    void copy_figure_callback (const std::string& format);
     void save_figure_callback (const std::string& file);
-    void copy_figure_callback (const std::string& format);
 
     void enableMouseTracking (void);