mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 14:32:15 -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) {
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ CardGroupDisplayWidget::CardGroupDisplayWidget(QWidget *parent,
|
|||
|
||||
layout->addWidget(banner);
|
||||
|
||||
// CardGroupDisplayWidget::updateCardDisplays();
|
||||
CardGroupDisplayWidget::updateCardDisplays();
|
||||
|
||||
// connect(deckListModel, &QAbstractItemModel::rowsInserted, this, &CardGroupDisplayWidget::onCardAddition);
|
||||
// connect(deckListModel, &QAbstractItemModel::rowsRemoved, this, &CardGroupDisplayWidget::onCardRemoval);
|
||||
connect(deckListModel, &QAbstractItemModel::rowsInserted, this, &CardGroupDisplayWidget::onCardAddition);
|
||||
connect(deckListModel, &QAbstractItemModel::rowsRemoved, this, &CardGroupDisplayWidget::onCardRemoval);
|
||||
}
|
||||
|
||||
QWidget *CardGroupDisplayWidget::constructWidgetForIndex(int rowIndex)
|
||||
|
|
@ -78,7 +78,6 @@ void CardGroupDisplayWidget::onCardAddition(const QModelIndex &parent, int first
|
|||
|
||||
void CardGroupDisplayWidget::onCardRemoval(const QModelIndex &parent, int first, int last)
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
Q_UNUSED(first);
|
||||
Q_UNUSED(last);
|
||||
if (parent == trackedIndex) {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ FlatCardGroupDisplayWidget::FlatCardGroupDisplayWidget(QWidget *parent,
|
|||
}
|
||||
|
||||
FlatCardGroupDisplayWidget::updateCardDisplays();
|
||||
// connect(deckListModel, &DeckListModel::dataChanged, this, &FlatCardGroupDisplayWidget::updateCardDisplays);
|
||||
disconnect(deckListModel, &QAbstractItemModel::rowsInserted, this, &CardGroupDisplayWidget::onCardAddition);
|
||||
disconnect(deckListModel, &QAbstractItemModel::rowsRemoved, this, &CardGroupDisplayWidget::onCardRemoval);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue