46 : QLayout(parent), m_hSpace(hSpacing), m_vSpace(vSpacing) {
47 setContentsMargins(margin, margin, margin, margin);
51 setContentsMargins(margin, margin, margin, margin);
99 QLayout::setGeometry(rect);
107 foreach (QLayoutItem *item,
itemList)
108 size = size.expandedTo(item->minimumSize());
110 size += QSize(2 * margin(), 2 * margin());
118 int x = effectiveRect.x();
119 int y = effectiveRect.y();
123 QWidget *wid = item->widget();
126 spaceX = wid->style()->layoutSpacing(QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Horizontal);
129 spaceY = wid->style()->layoutSpacing(QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Vertical);
130 int nextX = x + item->sizeHint().width() + spaceX;
131 if (nextX - spaceX > effectiveRect.right() && lineHeight > 0) {
132 x = effectiveRect.x();
133 y = y + lineHeight + spaceY;
134 nextX = x + item->sizeHint().width() + spaceX;
139 item->setGeometry(QRect(QPoint(x, y), item->sizeHint()));
142 lineHeight = qMax(lineHeight, item->sizeHint().height());
144 return y + lineHeight - rect.y() +
bottom;
147 QObject *parent = this->parent();
150 }
else if (parent->isWidgetType()) {
151 auto *pw =
static_cast<QWidget *
>(parent);
152 return pw->style()->pixelMetric(pm,
nullptr, pw);
154 return static_cast<QLayout *
>(parent)->spacing();
std::map< DeltaEMode::Type, std::string > index
QSize minimumSize() const override
QLayoutItem * takeAt(int index) override
int heightForWidth(int) const override
int smartSpacing(QStyle::PixelMetric pm) const
bool hasHeightForWidth() const override
void addItem(QLayoutItem *item) override
QLayoutItem * itemAt(int index) const override
int count() const override
int verticalSpacing() const
int doLayout(const QRect &rect, bool testOnly) const
QSize sizeHint() const override
QList< QLayoutItem * > itemList
FlowLayout(QWidget *parent, int margin=-1, int hSpacing=-1, int vSpacing=-1)
void setGeometry(const QRect &rect) override
Qt::Orientations expandingDirections() const override
int horizontalSpacing() const