Layout and Containers
Layout and Containers
Layout and container controls organize the structure of a WidgetKit interface.
Typical Controls
- Window and top-level containers.
- Horizontal and vertical layout containers.
- Card and panel containers.
- Absolute dock containers for overlays or window chrome.
- Scrollable containers for large content areas.
Key Concepts
- Direction: horizontal or vertical child flow.
- Padding and spacing: internal layout rhythm.
- Size policy: fixed size or ratio-based sizing.
- Theme name: reusable visual appearance.
- Draw background: whether the container paints its own background.
Class Diagram
QWidget
├─ UIGQContainer + IUIGQWidgetBase
├─ UIGQStackContainer + IUIGQWidgetBase
├─ QScrollArea
│ └─ UIGQScrollView + IUIGQWidgetBase
│ └─ UIGQPropertyList
├─ UIGQSplitter + IUIGQWidgetBase
├─ UIGQSpacer + IUIGQWidgetBase
└─ UIGQGroupBox + IUIGQWidgetBase
Common APIs
| Method | Description | Parameters | Return |
|---|---|---|---|
setChildLayout(UIGQContainer::AutoChildLayout layout) |
Sets the child layout direction or flow mode. | layout: kHorizontal, kVertical, kHorizontalFlow, kVerticalFlow, or kUnset. |
void |
setChildSpace(int space) |
Sets the gap between child controls. | space: gap in pixels. |
void |
setChildPadding(int left, int top, int right, int bottom) |
Sets container padding. | left/top/right/bottom: padding values in pixels. |
void |
addChildWidget(QWidget* child, int ratio = 1) |
Adds a child widget and assigns its layout ratio. | child: child control; ratio: space weight. |
void |
setChildRatio(QWidget* child, int ratio) |
Updates a child control's layout ratio. | child: child control; ratio: space weight. |
void |
setLayoutRatio(int ratio) |
Sets a widget's own ratio when it participates in parent layout. | ratio: space weight. |
void |
getLayoutRatio() const |
Reads the widget's current layout ratio. | None. | int |
Use container themes for visible surfaces, and keep non-visual layout containers background-free.