Layout

Inherited: None

Description

The Layout class provides a flexible mechanism for managing the arrangement of widgets and child layouts within a graphical user interface. Child items can be widgets or nested layouts, and the layout can be configured with spacing, margins, and direction.

Public Methods

void

addLayout (Layout * layout)

void

addWidget (Widget * widget)

int

count () const

int

direction () const

int

indexOf (const Layout * layout) const

int

indexOf (const Widget * widget) const

void

insertLayout (int index, Layout * layout)

void

insertWidget (int index, Widget * widget)

void

invalidate ()

void

removeLayout (Layout * layout)

void

removeWidget (Widget * widget)

void

setDirection (int direction)

void

setMargins (float left, float top, float right, float bottom)

void

setSpacing (float spacing)

Vector2

sizeHint () const

float

spacing () const

Static Methods

None

Methods Description

void Layout::addLayout (Layout * layout)

Adds a child layout to the current layout.


void Layout::addWidget (Widget * widget)

Adds a widget to the current layout.


int Layout::count () const

Returns number of items in the layout.


int Layout::direction () const

Returns the layout direction (Vertical or Horizontal).

See also setDirection().


int Layout::indexOf (Layout * layout) const

Returns the index of the specified child layout.


int Layout::indexOf (Widget * widget) const

Returns the index of the specified widget.


void Layout::insertLayout (int index, Layout * layout)

Inserts a child layout at the specified index. If -1, the layout is appended to the end.


void Layout::insertWidget (int index, Widget * widget)

Inserts a widget 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.


void Layout::removeLayout (Layout * layout)

Removes a child layout from the current layout.


void Layout::removeWidget (Widget * widget)

Removes a widget from the current layout.


void Layout::setDirection (int direction)

Sets the layout direction.

See also *direction*().


void Layout::setMargins (float left, float top, float right, float bottom)

Sets the left, top, right and bottom margins for the layout.


void Layout::setSpacing (float spacing)

Sets the spacing between items in the layout.

See also *spacing*().


Vector2 Layout::sizeHint () const

Returns the size hint for the layout.


float Layout::spacing () const

Returns the spacing between items in the layout.

See also setSpacing().