Layout¶
Inherited: None
Description¶
The Layout class is a base class used for managing the layout and positioning of widgets within a graphical user interface (GUI). It provides a structured way to organize UI elements, ensuring that they are placed efficiently and consistently on the screen. The Layout class is essential for developers who need to arrange multiple components (such as buttons, labels, text fields, etc.) in a clean and organized manner.
Public Methods¶
void |
addTransform (RectTransform * transform) |
int |
count () const |
int |
indexOf (const RectTransform * transform) const |
void |
insertTransform (int index, RectTransform * transform) |
void |
invalidate () |
int |
orientation () const |
void |
removeTransform (RectTransform * transform) |
void |
setOrientation (int orientation) |
void |
setSpacing (int spacing) |
sizeHint () |
|
int |
spacing () const |
transformAt (int index) |
Static Methods¶
None
Methods Description¶
void Layout::addTransform (RectTransform * transform)
Adds a transform to the current layout.
int Layout::count () const
Returns number of items in the layout.
int Layout::indexOf (RectTransform * transform) const
Returns the index of the specified transform.
void Layout::insertTransform (int index, RectTransform * transform)
Inserts a transform at the specified index. If -1, the layout is appended to the end.
void Layout::invalidate ()
Marks the layout as dirty, indicating that it needs to be recomputed.
int Layout::orientation () const
Returns the layout orientation (Vertical or Horizontal).
See also setOrientation().
RectTransform * Layout::rectTransform ()
Returns the parent rect transform of this layout, or nullptr if this layout is not installed on any rect transform. If the layout is a sub-layout, this function returns the parent rect transform of the parent layout.
void Layout::removeTransform (RectTransform * transform)
Removes a transform from the current layout.
void Layout::setOrientation (int orientation)
Sets the layout orientation.
See also orientation().
void Layout::setSpacing (int spacing)
Sets the spacing between items in the layout.
See also spacing().
Vector2 Layout::sizeHint ()
Returns the size hint for the layout.
int Layout::spacing () const
Returns the spacing between items in the layout.
See also setSpacing().
RectTransform * Layout::transformAt (int index)
Returns transform located at index.