FemaLocalSoftware/flowlayout.h

39 lines
1.0 KiB
C
Raw Normal View History

2024-12-10 08:02:54 +00:00
#ifndef FLOWLAYOUT_H
#define FLOWLAYOUT_H
#include <QLayout>
#include <QStyle>
#include <QRect>
#include <QList>
class FlowLayout : public QLayout {
public:
explicit FlowLayout(QWidget *parent = nullptr, int margin = 0, int hSpacing = -1, int vSpacing = -1);
~FlowLayout() override;
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