![]() |
Cockatrice 2026-06-01-Development-3.1.0-beta.3
A virtual tabletop for multiplayer card games
|
#include <flow_layout.h>
Public Member Functions | |
| FlowLayout (QWidget *parent=nullptr) | |
| FlowLayout (QWidget *parent, Qt::Orientation flowDirection, int margin=0, int hSpacing=0, int vSpacing=0) | |
| ~FlowLayout () override | |
| void | insertWidgetAtIndex (QWidget *toInsert, int index) |
| void | addItem (QLayoutItem *item) override |
| Adds a new item to the layout. | |
| int | count () const override |
| Retrieves the count of items in the layout. | |
| QLayoutItem * | itemAt (int index) const override |
| Returns the layout item at the specified index. | |
| QLayoutItem * | takeAt (int index) override |
| Removes and returns the item at the specified index. | |
| void | setGeometry (const QRect &rect) override |
Places all children within rect. | |
| Qt::Orientations | expandingDirections () const override |
| Reports which axis the layout can expand along. | |
| bool | hasHeightForWidth () const override |
| Height-for-width is only meaningful for horizontal (wrapping) flow. | |
| int | heightForWidth (int width) const override |
Returns the height required to display all items within width. | |
| QSize | sizeHint () const override |
| QSize | minimumSize () const override |
| void | setHorizontalMargin (int margin) |
| int | horizontalSpacing () const |
| Gets the horizontal spacing between items. | |
| void | setVerticalMargin (int margin) |
| int | verticalSpacing () const |
| Gets the vertical spacing between items. | |
| int | smartSpacing (QStyle::PixelMetric pm) const |
| Calculates smart spacing based on the parent widget style. | |
| virtual int | layoutAllRows (int originX, int originY, int availableWidth) |
Places all items into wrapping rows within availableWidth. | |
| virtual void | layoutSingleRow (const QVector< QLayoutItem * > &rowItems, int x, int y, int availableWidth) |
Sets the geometry for every item in rowItems, starting at (x, y). | |
| int | layoutAllColumns (int originX, int originY, int availableHeight) |
Places all items into wrapping columns within availableHeight. | |
| void | layoutSingleColumn (const QVector< QLayoutItem * > &colItems, int x, int y) |
Sets the geometry for every item in colItems, starting at (x, y). | |
Protected Member Functions | |
| QSize | calculateSizeHintHorizontal () const |
| Preferred size for horizontal flow: all items in a single row (unconstrained). | |
| QSize | calculateMinimumSizeHorizontal () const |
| Minimum size for horizontal flow: the largest single item. | |
| QSize | calculateSizeHintVertical () const |
| Preferred size for vertical flow: all items in a single column (unconstrained). | |
| QSize | calculateMinimumSizeVertical () const |
| Minimum size for vertical flow: the largest single item. | |
Protected Attributes | |
| QList< QLayoutItem * > | items |
| Qt::Orientation | flowDirection |
| int | horizontalMargin |
| Horizontal spacing between items (-1 = use style default). | |
| int | verticalMargin |
| Vertical spacing between items (-1 = use style default). | |
|
explicit |
| FlowLayout::FlowLayout | ( | QWidget * | parent, |
| Qt::Orientation | flowDirection, | ||
| int | margin = 0, | ||
| int | hSpacing = 0, | ||
| int | vSpacing = 0 ) |
|
override |
|
override |
Adds a new item to the layout.
| item | The layout item to add. |
|
nodiscardprotected |
Minimum size for horizontal flow: the largest single item.
This guarantees we can always display at least one item per row.
|
nodiscardprotected |
Minimum size for vertical flow: the largest single item.
|
nodiscardprotected |
Preferred size for horizontal flow: all items in a single row (unconstrained).
The actual displayed height is determined by heightForWidth() once Qt knows the real available width.
|
nodiscardprotected |
Preferred size for vertical flow: all items in a single column (unconstrained).
|
nodiscardoverride |
Retrieves the count of items in the layout.
|
nodiscardoverride |
Reports which axis the layout can expand along.
A horizontally-flowing layout expands horizontally (and wraps vertically, but that is governed by heightForWidth, not by this flag). A vertically-flowing layout expands vertically.
|
nodiscardoverride |
Height-for-width is only meaningful for horizontal (wrapping) flow.
|
nodiscardoverride |
Returns the height required to display all items within width.
Only valid for horizontal flow; returns -1 otherwise so Qt ignores it. Spacing is counted once between adjacent items, never before the first or after the last.
|
nodiscard |
Gets the horizontal spacing between items.
| void FlowLayout::insertWidgetAtIndex | ( | QWidget * | toInsert, |
| int | index ) |
|
nodiscardoverride |
Returns the layout item at the specified index.
| index | The index of the item to retrieve. |
| int FlowLayout::layoutAllColumns | ( | int | originX, |
| int | originY, | ||
| int | availableHeight ) |
Places all items into wrapping columns within availableHeight.
|
virtual |
Places all items into wrapping rows within availableWidth.
| void FlowLayout::layoutSingleColumn | ( | const QVector< QLayoutItem * > & | colItems, |
| int | x, | ||
| int | y ) |
Sets the geometry for every item in colItems, starting at (x, y).
Each item is placed at its sizeHint, clamped to its maximumSize.
|
virtual |
Sets the geometry for every item in rowItems, starting at (x, y).
Items whose horizontal size policy includes the Expand or MinimumExpanding flag share the leftover row width proportionally (like QHBoxLayout stretch), so that e.g. a QLineEdit can fill remaining space while fixed-size buttons stay compact.
Items without an expanding policy are placed at their sizeHint, clamped to maximumSize.
|
nodiscardoverride |
|
override |
Places all children within rect.
This is the only method that may move/resize children. It does NOT resize the parent widget; that would break Qt's layout protocol.
|
inline |
|
inline |
|
nodiscardoverride |
|
nodiscard |
Calculates smart spacing based on the parent widget style.
| pm | The pixel metric to calculate. |
|
override |
Removes and returns the item at the specified index.
| index | The index of the item to remove. |
|
nodiscard |
Gets the vertical spacing between items.
|
protected |
|
protected |
Horizontal spacing between items (-1 = use style default).
|
protected |
|
protected |
Vertical spacing between items (-1 = use style default).