diff libgui/graphics/Figure.cc @ 24687:8b935067a257

Allow printing without updating qt visible or invisible figures (bug #52940). * graphics.in.h (figure::properties::__gl_window__, __printing__): Add hidden properties. * Figure.cc (Figure::update): Return if __printing__ is "on". Set __gl_window__ "on" if the figure has been shown at least once. * Backend.cc (Backend::print_figure): Allow invisible figures to be printed. * print.m: Set and restore "__printing__" property to prevent figure window updates. * __opengl_print__.m: Allow qt invisible figures to be printed without osmesa if they have been visible at least once.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Wed, 31 Jan 2018 23:22:51 +0100
parents 194eb4bd202b
children b658e0fa0cb3
line wrap: on
line diff
--- a/libgui/graphics/Figure.cc	Sun Feb 04 23:58:29 2018 +0100
+++ b/libgui/graphics/Figure.cc	Wed Jan 31 23:22:51 2018 +0100
@@ -432,10 +432,14 @@
       return;
 
     figure::properties& fp = properties<figure> ();
+
+    if (fp.is___printing__ ())
+      return;
+    
     QMainWindow *win = qWidget<QMainWindow> ();
 
     m_blockUpdates = true;
-
+    
     switch (pId)
       {
       case figure::properties::ID_POSITION:
@@ -465,7 +469,14 @@
 
       case figure::properties::ID_VISIBLE:
         if (fp.is_visible ())
-          QTimer::singleShot (0, win, SLOT (show ()));
+          {
+            QTimer::singleShot (0, win, SLOT (show ()));
+            if (! fp.is___gl_window__ ())
+              {
+                gh_manager::auto_lock lock;
+                fp.set ("__gl_window__", "on");
+              }
+          }                
         else
           win->hide ();
         break;