diff libgui/graphics/Figure.cc @ 21996:d6370831d37f

Set Qt Figure window modal/normal state based on WindowStyle (Bug #48160) * libgui/graphics/Figure.cc (Figure::Figure): call update for ID_WINDOWSTYLE property (Figure::update): process ID_WINDOWSTYLE to set figure window modal, normal modality * doc/interpreter/genpropdoc.m: update doc text for windowstyle property
author John Donoghue <john.donoghue@ieee.org>
date Fri, 17 Jun 2016 08:06:19 -0400
parents 3a0c90b59584
children 278fc29b69ca
line wrap: on
line diff
--- a/libgui/graphics/Figure.cc	Mon Jun 27 19:50:30 2016 +1000
+++ b/libgui/graphics/Figure.cc	Fri Jun 17 08:06:19 2016 -0400
@@ -176,6 +176,9 @@
   update (figure::properties::ID_KEYPRESSFCN);
   update (figure::properties::ID_KEYRELEASEFCN);
 
+  // modal style
+  update (figure::properties::ID_WINDOWSTYLE);
+
   // Visibility
   update (figure::properties::ID_VISIBLE);
 
@@ -479,6 +482,24 @@
         m_container->canvas (m_handle)->addEventMask (Canvas::KeyRelease);
       break;
 
+    case figure::properties::ID_WINDOWSTYLE:
+      if (fp.windowstyle_is ("modal"))
+        {
+          bool is_visible = win->isVisible ();
+
+          // if window is already visible, need to hide and reshow it in order to
+          // make it use the modal settings
+          if (is_visible)
+            win->setVisible (false);
+
+          win->setWindowModality (Qt::ApplicationModal);
+          win->setVisible (is_visible);
+        }
+      else
+        win->setWindowModality (Qt::NonModal);
+
+      break;
+
     default:
       break;
     }