PDA

View Full Version : window sizes changing even though max size defined



JonathanForQT4
3rd August 2007, 13:14
Hi all,

I have two questions, the title referring to the first one:

I have defined my mainwindow to have a max size, but when I show a qgraphicsview inside the mainwindow (which is defined to be a certain size) then the window gets bigger...the buttons surrounding the qgraphicsview don't shrink, but instead the mainwindow gets bigger...any clues as to why this happens and everything isn't just scrunched into the main window? How does it override the mainwindow max size setting?

Thanks in advance!

Jonathan

marcel
3rd August 2007, 13:32
This can be done by adding a few layouts in there and by setting minimum sizes for the buttons and also size policies for them.

But I cannot tell you exactly what to do, since I don't know your main window configuration(what it looks like).

Maybe you can post the UI, or the code that creates the UI. If it is compilable, even better.

Regards

JonathanForQT4
6th August 2007, 08:41
my main window is made in designer and I have set the max height to 768 therein.

For there I then have a gridlayoutA which divides the window into two areas, the left being the viewport of the qgraphicsscene and the right being the button area. All the button groups have their own layout and are added to another gridlayoutB which is within the gridlayoutA (second column). When more buttons are dynamically added to one of the layouts on the right, the max window size keeps the window at that size and buttons are squashed together. If I click the "toggle minimap" button, a mini viewport (qgraphicsscene) pops up on the right and makes the window bigger....is there some setting for qgraphicsscene to not override the main window max height?

Thanks!


Link to picture of program:

http://www.qtcentre.org/forum/attachment.php?attachmentid=1366&d=1184328369

marcel
6th August 2007, 10:39
No, there is no such setting.
It all has to do with the layouts from the right side.
They could be set to shrink when you add a new widget( a new view ).
I guess you could play with that a bit.

Another thing: don't use grid layouts if you don't need to. QHBoxLayout or QVBoxLayout are OK.

Regards