[Qt-interest] restoreGeometry of QMdiSubWindow

John McClurkin jwm at nei.nih.gov
Tue Aug 11 14:36:01 CEST 2009


RZ wrote:
> Hi all,
> 
> I want my mdi sub windows to appear at the same location and with the 
> same size they were closed with. To achieve that I just copied code out 
> of the Qt Assistant docs namely
> 
> QSettings settings("MyCompany", "MyApp");
> settings.setValue("geometry", saveGeometry());
> 
> in the closeEvent and
> 
> QSettings settings("MyCompany", "MyApp");
> restoreGeometry(settings.value("myWidget/geometry").toByteArray());
> 
> in the c'tor of the mdiChild. Although the settings get stored this does 
> not work (can very easily be checked with the mainwindows/mdi example).
> 
> While this usualy works is this a bug? Or did I miss some special 
> features of QMdi* ?!?
> 
> Regards,
> 
> RZ

I think that the problem is in trying to set the geometry in the 
constructor. What I have had to do is set the geometry after calling 
show(). In my app, there is no visible change in the subwindow when done 
in this order so it doesn't seem a problem.



More information about the Qt-interest-old mailing list