PDA

View Full Version : MDISubWindow will not resize



ad5xj
19th February 2009, 22:48
I have created several MDISubWindow(s) in an MDIArea. All windows appear in tiled format as requested but none will resize or move with code. I have tried to resize and move from code in each window and by code from the MDI MainWindow. The only thing that seems to effect size is setFixedSize() and setMinimumSize().

How can I resize and/or move a MDIChild/MDISubWindw window? What is preventing the MDISubWindow from being resized or moved by the code in that window or from the MDI MainWindow?

nix
20th February 2009, 09:27
I remember i lost some time with that too, it was a long time ago when I used QWorkspace instead of QMdiArea. Try something like this :

mdi_Widget->parentWidget()->setGeometry(...)
Replace setGeometry() by other functions you need to call.

I found that in the QWorkspace documentation (complete description) but it works with the MdiArea too.

ad5xj
21st February 2009, 05:26
Thank you for your suggestion. I did find the reference in QWorkspace you mentioned. I changed the program to perform the resize on the parentWidget(). It did produce some result. I can now resize the MDISubWindow from the MDI Mainwindow. However, here is a strange phenomenon. You cannot specify a layout strategy like tileSubWindow() or cascadeSubWindow() to do it. If either is specified it will not work.

I still have not been able to make the move() work. I am trying to restore all MDISubWindow children to the same place and size as they were last. Settings will store the size and position correctly but there is still the problem of moving once they are initially created and the size and pos are recalled from the settings.

ad5xj
22nd February 2009, 23:17
I have discovered a couple of things of interest.

1) An internal widget can be proportioned to be larger than the viewport area of a MDISubWindow. When this happens, the x() and y() values are not reliable.

2) the parentWidget() must be used even in the code for each MDISubWindow when referencing the window geometry.

3) the moveEvent does not fire on a simple move. It does get called when a resize moves the 0,0 corner of the MDISubWindow from it's original position.

I am trying to find a reason for this but still come up blank. Anyone have ideas?