changeset 24465:1b4c4d6ead56

Make mouse clicks update currentfigure (bug #52698). * Figure.cc (Figure::eventNotifyBefore): Update the CurrentFigure after MouseButtonPress events. Only works for menu and toolbar areas.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Thu, 21 Dec 2017 14:03:42 +0100
parents 359596cc55dd
children 2dc926274bce
files libgui/graphics/Figure.cc
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/Figure.cc	Tue Dec 26 09:51:54 2017 -0800
+++ b/libgui/graphics/Figure.cc	Thu Dec 21 14:03:42 2017 +0100
@@ -710,6 +710,16 @@
   {
     if (! m_blockUpdates)
       {
+        // Clicking the toolbar or the menubar makes this figure current
+        if (xevent->type () == QEvent::MouseButtonPress)
+          {
+            figure::properties& fp = properties<figure> ();
+            graphics_object root = gh_manager::get_object (0);
+            if (fp.get_handlevisibility () == "on")
+              root.set ("currentfigure",
+                        fp.get___myhandle__ ().as_octave_value ());
+          }
+
         if (obj == m_container)
           {
             // Do nothing...