changeset 26819:92ecc4a97b5c

Properly redraw uixx objects after Qt figure is (un)maximized (bug #53709) * BaseControl.[f,cc] (BaseControl::BaseControl): Set QObject name for further triage. (BaseControl::redraw): New method that forces an update of the position * Panel.cc (Panel::redraw): Force an update of the position. * ButtonGroup.cc (ButtonGroup::redraw): Ditto.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Thu, 28 Feb 2019 23:06:25 +0100
parents 45270d3aa861
children 880466837c06
files libgui/graphics/BaseControl.cc libgui/graphics/BaseControl.h libgui/graphics/ButtonGroup.cc libgui/graphics/Figure.cc libgui/graphics/Panel.cc
diffstat 5 files changed, 19 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/BaseControl.cc	Sat Mar 02 11:08:53 2019 -0800
+++ b/libgui/graphics/BaseControl.cc	Thu Feb 28 23:06:25 2019 +0100
@@ -93,6 +93,7 @@
   BaseControl::BaseControl (const graphics_object& go, QWidget *w)
     : Object (go, w), m_normalizedFont (false), m_keyPressHandlerDefined (false)
   {
+    qObject ()->setObjectName ("UIControl");
     init (w);
   }
 
@@ -123,6 +124,12 @@
   { }
 
   void
+  BaseControl::redraw (void)
+  {
+    update (uicontrol::properties::ID_POSITION);
+  }
+
+  void
   BaseControl::update (int pId)
   {
     uicontrol::properties& up = properties<uicontrol> ();
--- a/libgui/graphics/BaseControl.h	Sat Mar 02 11:08:53 2019 -0800
+++ b/libgui/graphics/BaseControl.h	Thu Feb 28 23:06:25 2019 +0100
@@ -43,6 +43,7 @@
 
   protected:
     void init (QWidget *w, bool callBase = false);
+    void redraw (void);
     void update (int pId);
 
   private:
--- a/libgui/graphics/ButtonGroup.cc	Sat Mar 02 11:08:53 2019 -0800
+++ b/libgui/graphics/ButtonGroup.cc	Thu Feb 28 23:06:25 2019 +0100
@@ -378,6 +378,9 @@
   void
   ButtonGroup::redraw (void)
   {
+    update (uibuttongroup::properties::ID_POSITION);
+
+    // FIXME: is it really necessary to update the opengl canvas here?
     Canvas *canvas = m_container->canvas (m_handle);
 
     if (canvas)
--- a/libgui/graphics/Figure.cc	Sat Mar 02 11:08:53 2019 -0800
+++ b/libgui/graphics/Figure.cc	Thu Feb 28 23:06:25 2019 +0100
@@ -330,13 +330,14 @@
     if (canvas)
       canvas->redraw ();
 
-    foreach (QFrame *frame,
-             qWidget<QWidget> ()->findChildren<QFrame*> ())
+    foreach (QObject *qobj,
+             qWidget<QWidget> ()->findChildren<QObject*> ())
       {
-        if (frame->objectName () == "UIPanel"
-            || frame->objectName () == "UIButtonGroup")
+        if (qobj->objectName () == "UIPanel"
+            || qobj->objectName () == "UIButtonGroup"
+            || qobj->objectName () == "UIControl")
           {
-            Object *obj = Object::fromQObject (frame);
+            Object *obj = Object::fromQObject (qobj);
 
             if (obj)
               obj->slotRedraw ();
--- a/libgui/graphics/Panel.cc	Sat Mar 02 11:08:53 2019 -0800
+++ b/libgui/graphics/Panel.cc	Thu Feb 28 23:06:25 2019 +0100
@@ -337,6 +337,8 @@
   void
   Panel::redraw (void)
   {
+    update (uipanel::properties::ID_POSITION);
+
     Canvas *canvas = m_container->canvas (m_handle);
 
     if (canvas)