qt - QMainWindow: size management of central widget and dock widgets -


i want mainwindow keep approximate ratio of dock widget sizes , central widget size, when window's size changed. i've written simplest mainwindow central widget , 6 dock widgets:

#include <qplaintextedit> #include <qdockwidget>  #include "mainwindow.h"  mainwindow::mainwindow(qwidget *parent) :     qmainwindow(parent) {     this->setgeometry(20, 20, 600, 600);      this->setcentralwidget(           new qplaintextedit("central", this)           );      qdockwidget *p_dw;      (int = 0; < 6; ++i){        p_dw = new qdockwidget("dock " + qstring::number(i));         p_dw->setwidget(              new qplaintextedit("dock " + qstring::number(i), this)              );         qt::dockwidgetarea area;        switch (i){           case 0:           case 1:              area = qt::topdockwidgetarea;              break;           case 2:              area = qt::rightdockwidgetarea;              break;           case 3:           case 4:              area = qt::bottomdockwidgetarea;              break;           default:              area = qt::leftdockwidgetarea;              break;        }         adddockwidget(area, p_dw);     } }  mainwindow::~mainwindow() { } 

when started, looks follows:

enter image description here

i can shrink it:

enter image description here

and expand back, , after expanded, looks @ first screenshot. fine.

the problem if user "touches" central widget bounds (i mean, changes central widget size manually, ever little bit), main window changes policy dramatically: after user touches central widget, shrinks window, , expands back, dockwidgets have minimum sizes:

enter image description here

the question is, how prevent behavior? or, more generally, how can influence on size policy of qmainwindow? can't find documentation behaviour i've explained above.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -