mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-17 16:02:14 -07:00
Actually make widgets track their indices.
This commit is contained in:
parent
59998b38c2
commit
8032e7fea1
13 changed files with 213 additions and 246 deletions
|
|
@ -548,6 +548,14 @@ void FlowLayout::addItem(QLayoutItem *item)
|
|||
}
|
||||
}
|
||||
|
||||
void FlowLayout::insertWidgetAtIndex(QWidget *toInsert, int index)
|
||||
{
|
||||
addChildWidget(toInsert);
|
||||
items.insert(qBound(0, index, std::max(0, static_cast<int>(items.size()))), new QWidgetItem(toInsert));
|
||||
|
||||
invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieves the count of items in the layout.
|
||||
* @return The number of layout items.
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ public:
|
|||
explicit 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);
|
||||
|
||||
QSize calculateMinimumSizeHorizontal() const;
|
||||
QSize calculateSizeHintVertical() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue