[Solved] How to resize objects when the window is expanding?
-
wrote on 25 Mar 2014, 07:03 last edited by
Hi there. I currently need to let all widgets in my window automatically resize when I expand the window. I already tried to put everything into a QFormLayout and then the QFormLayout into a QWidget. But this does not show any differences. It's still not resizing.
So, what do I have to do? -
Hi,
Can you show how you setup your widgets/layout ?
-
wrote on 25 Mar 2014, 08:26 last edited by
Try experiment with "sizePolicy":http://qt-project.org/doc/qt-5/qwidget.html#sizePolicy-prop
-
wrote on 25 Mar 2014, 08:30 last edited by
!http://i.epvpimg.com/jGEob.png(picture)!
That's my setup. I also tried to experiment with sizePolicy on different widgets and the window itself, without effect. -
wrote on 25 Mar 2014, 09:23 last edited by
Your centralWidget has no layout.
-
wrote on 25 Mar 2014, 10:50 last edited by
Set the centralwidget on a vertical layout now. So that was why there was a stop sign, got headache because of this lol. Now, that's my new setup (read a bit through the documentation etc., but yeah, still no effect):
-
Are you sure you need that many layouts ?
-
wrote on 25 Mar 2014, 11:22 last edited by
You do not need layout for every widget.
Show us screenshot of form editor and tell how do you want resize widgets on form resize. -
wrote on 25 Mar 2014, 11:24 last edited by
Also take a look to "Docs":http://qt-project.org/doc/qt-5/layout.html
-
wrote on 25 Mar 2014, 11:34 last edited by
!http://i.epvpimg.com/fdqtf.png(picture)!
Well, the OK button should move to the right and the bottom. The textbox and the button next to it should resize horizontally. The two labels can stay where they are.
I really don't know why nothing happens when I resize the window. -
wrote on 25 Mar 2014, 11:42 last edited by
Ok. What about -horizontal- vertical resizing?
edited
-
wrote on 25 Mar 2014, 11:48 last edited by
Nah, just as I told. The OK buttom just moves bottom/right, the textfield/button in the middle resize horizontally and the stuff at the top should stay.
-
wrote on 25 Mar 2014, 11:54 last edited by
Sorry :). I mean Vertical resizing.
-
wrote on 25 Mar 2014, 12:20 last edited by
No, only the bottom on the bottom right should move. No vertical resizing/moving. Only for the bottom right button.
-
wrote on 25 Mar 2014, 13:06 last edited by
Well then here the simple solution:
!http://s14.postimg.org/6u38iuaap/Untitled.png(layout)! -
wrote on 26 Mar 2014, 07:12 last edited by
Oh my.. Thank you, it works! Had to create a whole new form though. Got a Qt book here for today, I'll read myself a bit into layout management. Thanks for your help!
10/16