changeset 29150:1153f47f29a7 stable

improve default sizes of gui dock widgets * octave-dock-widget.cc (handle_settings): use separate default floating and dock sizes from the current screen and main window size
author Torsten Lilge <ttl-octave@mailbox.org>
date Fri, 04 Dec 2020 22:50:37 +0100
parents 7220b59c490b
children 5d7a651bf0bb
files libgui/src/octave-dock-widget.cc
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/octave-dock-widget.cc	Fri Dec 04 22:42:38 2020 +0100
+++ b/libgui/src/octave-dock-widget.cc	Fri Dec 04 22:50:37 2020 +0100
@@ -484,26 +484,28 @@
       m_icon_color_active = "";
 
     QRect available_size = QApplication::desktop ()->availableGeometry (m_parent);
-    int x1, y1, x2, y2;
-    available_size.getCoords (&x1, &y1, &x2, &y2);
-    QRect default_size = QRect (x1+16, y1+32, x2/3, 2*y2/3);
+    int x, y, w, h;
+    available_size.getRect (&x, &y, &w, &h);
+    QRect default_floating_size = QRect (x+16, y+32, w/3, h/2);
+    m_parent->geometry ().getRect (&x, &y, &w, &h);
+    QRect default_dock_size = QRect (x+16, y+32, w/3, h/3);
 
     m_recent_float_geom
       = settings->value (dw_float_geometry.key.arg (objectName ()),
-                         default_size).toRect ();
+                         default_floating_size).toRect ();
 
     QWidget dummy;
     dummy.setGeometry (m_recent_float_geom);
 
     if (QApplication::desktop ()->screenNumber (&dummy) == -1)
-      m_recent_float_geom = default_size;
+      m_recent_float_geom = default_floating_size;
 
     // The following is required for ensure smooth transition from old
     // saveGeomety to new QRect setting (see comment for restoring size
     // of docked widgets)
     QVariant dock_geom
       = settings->value (dw_dock_geometry.key.arg (objectName ()),
-                         dw_dock_geometry.def);
+                         default_dock_size);
     if (dock_geom.canConvert (QMetaType::QRect))
       m_recent_dock_geom = dock_geom.toRect ();
     else