mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 22:42:14 -07:00
Address comments.
This commit is contained in:
parent
bbac3e0de1
commit
cd6693a956
4 changed files with 8 additions and 7 deletions
|
|
@ -551,7 +551,10 @@ 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));
|
||||
|
||||
// We don't want to fail on an index that violates the bounds, so we just clamp it.
|
||||
int boundedIndex = qBound(0, index, qMax(0, static_cast<int>(items.size())));
|
||||
items.insert(boundedIndex, new QWidgetItem(toInsert));
|
||||
|
||||
invalidate();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue