mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-17 16:02: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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ OverlapLayout::~OverlapLayout()
|
|||
void OverlapLayout::insertWidgetAtIndex(QWidget *toInsert, int index)
|
||||
{
|
||||
addChildWidget(toInsert);
|
||||
int clampedIndex = qBound(0, index, std::max(0, static_cast<int>(itemList.size())));
|
||||
int clampedIndex = qBound(0, index, qMax(0, static_cast<int>(itemList.size())));
|
||||
itemList.insert(clampedIndex, new QWidgetItem(toInsert));
|
||||
|
||||
for (int i = clampedIndex; i < itemList.size(); ++i) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue