PDA

View Full Version : layout



pedro74
29th September 2016, 18:17
What's the difference beetween selecting a layout in QtCreator from the toolbox or from the toolbar?
When I select it from toolbox I can see it in pink in the designer. When I apply it from the toolbar I see the result but there are no pink borders.
But I would like to know what is the difference bettween this two ways of using a layout. Thanks


edit: maybe selecting it from toolbox it's posible to apply more than one layout to one widget. But is there some other difference?

ChrisW67
29th September 2016, 21:35
The toolbar icon will create a layout of the selected type, intelligently put all the existing contained widgets and layouts into the new layout, and arrange for it to be attached to the content area of the widget being designed. There would be few instances where you did not use one of the layout tools.

The tool box layout buttons create layouts that are not directly attached to the widget being designed. You can place other widgets and layouts inside. These layouts are intended to become sub-elements of the main layout of the widget being designed (or sub layouts of another sub layouts), i.e. The sub-layout fills/organises a parent layout cell like a widget would. For simple designs you may not need to use these toolbox options, but any complex UI is likely to need them.

anda_skoa
30th September 2016, 11:32
Nested layout can also be achieve with the toolbar buttons, if you select multiple individual widgets inside the same parent.

Cheers,
_

ChrisW67
30th September 2016, 22:22
If there are no widgets selected then the layout tool button will act on the topmost widget under design. If you select multiple widget with different parents (already in different layouts) then you cannot put these in the same layout and the tool buttons are likely disabled: a very quick experiment would confirm this.

pedro74
2nd October 2016, 13:43
Thank you very much for the answares.
I only wanted to say one more thing.
As I undesrstand, with toolbox layout you can also manage the layout programmatically, using it as an ui element.
It cannot be done with toolbar layout.
Is it correct?
Thanks

anda_skoa
2nd October 2016, 15:11
Both result in the same generated code.

Cheers,
_