Anchoring the widgets for resizing with the form
-
"niche concept"?
Are you sure layouts are a niche concept?
As far as I know Java GUI for example uses layouts as well (see https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html). I like layouts - they are very flexible and powerful. -
wrote on 9 May 2016, 13:44 last edited by
Adding a layout to the UI elements on a form resizes and rearranges them all and it is not possible to change their sizes once they are in a layout. How's that powerful and flexible?
-
Adding a layout to the UI elements on a form resizes and rearranges them all and it is not possible to change their sizes once they are in a layout. How's that powerful and flexible?
@nulluse
The layout define the size.Not reversed.
If you dont want the layout size for all widgets ,
u can then adjust with min/max sizes on individual widgets.
You can also instruct layout if u want to be greedy and use all space/and or other options. -
@nulluse
The layout define the size.Not reversed.
If you dont want the layout size for all widgets ,
u can then adjust with min/max sizes on individual widgets.
You can also instruct layout if u want to be greedy and use all space/and or other options.wrote on 9 May 2016, 14:30 last edited by@mrjj said:
@nulluse
If you dont want the layout size for all widgets ,
u can then adjust with min/max sizes on individual widgets.
You can also instruct layout if u want to be greedy and use all space/and or other options.Exactly! This is double work, and very tedious one, versus defining the anchors.
The anchors do not require defining fixed sizes. -
@mrjj said:
@nulluse
If you dont want the layout size for all widgets ,
u can then adjust with min/max sizes on individual widgets.
You can also instruct layout if u want to be greedy and use all space/and or other options.Exactly! This is double work, and very tedious one, versus defining the anchors.
The anchors do not require defining fixed sizes.@nulluse
Yeah but layouts dont either.
Its assumed u want same size for all.
So only if u dont , u set it.
Its not double work as often NOT needed.
I want same size for all anyway.
and u can have margins if u want and many other nice tweaks. -
@mrjj said:
@nulluse
If you dont want the layout size for all widgets ,
u can then adjust with min/max sizes on individual widgets.
You can also instruct layout if u want to be greedy and use all space/and or other options.Exactly! This is double work, and very tedious one, versus defining the anchors.
The anchors do not require defining fixed sizes.@nulluse said:
Exactly! This is double work, and very tedious one, versus defining the anchors.
The anchors do not require defining fixed sizes.Neither do layouts. There are things called resize policies and stretch factors, which I suppose you should take a look at. Also how do you anchor two elements back to back such that one of them takes 2/3 of the space and one 1/3, ain't it necessary to go and set that manually?
-
wrote on 9 May 2016, 16:26 last edited by
And that's even more work vs flipping yes/no anchors and not having to worry about anything else.
-
@nulluse
Yeah but layouts dont either.
Its assumed u want same size for all.
So only if u dont , u set it.
Its not double work as often NOT needed.
I want same size for all anyway.
and u can have margins if u want and many other nice tweaks.wrote on 9 May 2016, 16:27 last edited by@mrjj said:
@nulluse
Yeah but layouts dont either.
Its assumed u want same size for all.
So only if u dont , u set it.
Its not double work as often NOT needed.
I want same size for all anyway.
and u can have margins if u want and many other nice tweaks.You probably need to look at a system that uses anchors to realize how much more productive they allow the developers to be.
-
wrote on 21 May 2016, 19:06 last edited by
If the layouts are so wonderful, can anyone explain why specifying a horizontal layout for a form with 3 panels adds 9 pixel margin on all sides of the form? How can that margin be eliminated?
-
If the layouts are so wonderful, can anyone explain why specifying a horizontal layout for a form with 3 panels adds 9 pixel margin on all sides of the form? How can that margin be eliminated?
wrote on 21 May 2016, 19:25 last edited by@nulluse said:
How can that margin be eliminated?
Simple: For centralWidget set layoutLeftMargin, layoutRightMargin, layoutTopMargin, layoutBottomMargin, and layoutSpacing all to 0. Default is 9, resp. 6.
-
wrote on 21 May 2016, 19:27 last edited by
BTW: If you want a fancy GUI that doesn't look / behave natively then you can use QtQuick for that. Besides layouts it has anchors, too.