12#include <QLoggingCategory>
22 FlowLayout(QWidget *parent, Qt::Orientation _flowDirection,
int margin = 0,
int hSpacing = 0,
int vSpacing = 0);
29 void addItem(QLayoutItem *item)
override;
30 [[nodiscard]]
int count()
const override;
31 [[nodiscard]] QLayoutItem *
itemAt(
int index)
const override;
32 QLayoutItem *
takeAt(
int index)
override;
39 [[nodiscard]]
int doLayout(
const QRect &rect,
bool testOnly)
const;
40 [[nodiscard]]
int smartSpacing(QStyle::PixelMetric pm)
const;
45 virtual int layoutAllRows(
int originX,
int originY,
int availableWidth);
46 virtual void layoutSingleRow(
const QVector<QLayoutItem *> &rowItems,
int x,
int y);
49 [[nodiscard]] QSize
sizeHint()
const override;
int getParentScrollAreaWidth() const
Gets the width of the parent scroll area, if any.
Definition flow_layout.cpp:634
int horizontalSpacing() const
Gets the horizontal spacing between items.
Definition flow_layout.cpp:595
int verticalSpacing() const
Gets the vertical spacing between items.
Definition flow_layout.cpp:604
QSize calculateSizeHintHorizontal() const
Calculates the size hint for horizontal flow direction.
Definition flow_layout.cpp:350
int verticalMargin
Definition flow_layout.h:57
QLayoutItem * itemAt(int index) const override
Returns the layout item at the specified index.
Definition flow_layout.cpp:576
QSize minimumSize() const override
Calculates the minimum size required by the layout based on the flow direction.
Definition flow_layout.cpp:337
Qt::Orientation flowDirection
Definition flow_layout.h:55
bool hasHeightForWidth() const override
Indicates that this layout's height depends on its width.
Definition flow_layout.cpp:57
QList< QLayoutItem * > items
Definition flow_layout.h:54
int count() const override
Retrieves the count of items in the layout.
Definition flow_layout.cpp:566
QSize calculateMinimumSizeHorizontal() const
Calculates the minimum size for horizontal flow direction.
Definition flow_layout.cpp:398
QSize sizeHint() const override
Calculates the preferred size of the layout based on the flow direction.
Definition flow_layout.cpp:324
virtual void layoutSingleRow(const QVector< QLayoutItem * > &rowItems, int x, int y)
Arranges a single row of items within specified x and y starting positions.
Definition flow_layout.cpp:197
~FlowLayout() override
Destructor for FlowLayout, which cleans up all items in the layout.
Definition flow_layout.cpp:36
void setGeometry(const QRect &rect) override
Arranges layout items in rows within the specified rectangle bounds.
Definition flow_layout.cpp:120
int heightForWidth(int width) const override
Calculates the required height to display all items within the specified width.
Definition flow_layout.cpp:67
QLayoutItem * takeAt(int index) override
Removes and returns the item at the specified index.
Definition flow_layout.cpp:586
int horizontalMargin
Definition flow_layout.h:56
void layoutSingleColumn(const QVector< QLayoutItem * > &colItems, int x, int y)
Arranges a single column of items within specified x and y starting positions.
Definition flow_layout.cpp:268
Qt::Orientations expandingDirections() const override
Indicates the layout's support for expansion in both horizontal and vertical directions.
Definition flow_layout.cpp:48
int getParentScrollAreaHeight() const
Gets the height of the parent scroll area, if any.
Definition flow_layout.cpp:652
int smartSpacing(QStyle::PixelMetric pm) const
Calculates smart spacing based on the parent widget style.
Definition flow_layout.cpp:614
virtual int layoutAllRows(int originX, int originY, int availableWidth)
Lays out items into rows according to the available width, starting from a given origin....
Definition flow_layout.cpp:152
QSize calculateSizeHintVertical() const
Calculates the size hint for vertical flow direction.
Definition flow_layout.cpp:446
void addItem(QLayoutItem *item) override
Adds a new item to the layout.
Definition flow_layout.cpp:544
FlowLayout(QWidget *parent=nullptr)
void insertWidgetAtIndex(QWidget *toInsert, int index)
Definition flow_layout.cpp:551
int layoutAllColumns(int originX, int originY, int availableHeight)
Lays out items into columns according to the available height, starting from a given origin....
Definition flow_layout.cpp:224
int doLayout(const QRect &rect, bool testOnly) const
QSize calculateMinimumSizeVertical() const
Calculates the minimum size for vertical flow direction.
Definition flow_layout.cpp:494
Q_LOGGING_CATEGORY(FlowLayoutLog, "flow_layout", QtInfoMsg)