PDA

View Full Version : Dealing with Layout expanding size



edxxgardo
16th August 2011, 08:43
Hello everybody,

Yes, I am dealing with the resize of my Layout. Basically, this it the situation:
I have a main window with no docking widgets. As main widget, a normal widget with a single vertical Layout and inside this two horizontal Layouts. So, we have two Layouts, one called "top" and another one called "bottom".
Inside the top, I have a QGraphicsView.
Inside the bottom I have a QToolBox to the left and a QTextEdit to the right.

When the program starts, the size looks quite good for the QGraphicsView without showing any scene, but because I want to display different scenes at different times, as soon as I display the first one, the top layout (and of course the view) get expanded down, and pushes down the toolbox, what looks horrible.

What I want is to keep a fixed size for the top Layout, which means that I don't want the view get expanded when I set a scene inside.

I tried several things to get it done, but without success. When I get something good looking on one side, it gets wrong on the other.
I do not use constant values in setting positions on the screen.
Any idea would be appreciated, thx in advance.

nish
16th August 2011, 08:48
What exactly you tried? I think calling setFixedSize (or height) on graphics view should should solve your problem.

edxxgardo
16th August 2011, 10:20
Hi nish,

your suggestion helps, thanks a lot dude.
I tried with setPolicySize with different configuration but I couldn't manage to keep the view with fixed size, it expanded all the times. My fault was probably that, because I don't want to use constant values in sizes, the view expanded every time. Anyway, good suggestion and thx again for your help.