FemaLocalSoftware/flowlayout.h

44 lines
1.1 KiB
C
Raw Normal View History

2024-12-10 08:02:54 +00:00
#ifndef FLOWLAYOUT_H
#define FLOWLAYOUT_H
#include <QLayout>
#include <QList>
2025-01-07 22:13:48 +00:00
#include <QRect>
#include <QStyle>
2024-12-10 08:02:54 +00:00
2025-01-07 22:13:48 +00:00
class FlowLayout : public QLayout
{
2024-12-10 08:02:54 +00:00
public:
2025-01-07 22:13:48 +00:00
explicit FlowLayout(QWidget *parent = nullptr,
int margin = 0,
int hSpacing = -1,
int vSpacing = -1);
2024-12-10 08:02:54 +00:00
~FlowLayout() override;
2024-12-16 08:38:04 +00:00
void clear();
2024-12-10 08:02:54 +00:00
void addItem(QLayoutItem *item) override;
int count() const override;
QLayoutItem *itemAt(int index) const override;
QLayoutItem *takeAt(int index) override;
Qt::Orientations expandingDirections() const override;
bool hasHeightForWidth() const override;
int heightForWidth(int width) const override;
void setGeometry(const QRect &rect) override;
QSize sizeHint() const override;
QSize minimumSize() const override;
private:
int doLayout(const QRect &rect, bool testOnly) const;
int horizontalSpacing() const;
int verticalSpacing() const;
int smartSpacing(QStyle::PixelMetric pm) const;
QList<QLayoutItem *> m_items;
int m_hSpacing;
int m_vSpacing;
};
#endif // FLOWLAYOUT_H