mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -07:00
don't redraw PrintingSelector's FlowWidget unless cards actually changed (#5392)
This commit is contained in:
parent
455cd9717a
commit
68226786a2
2 changed files with 17 additions and 4 deletions
|
|
@ -57,10 +57,14 @@ PrintingSelector::PrintingSelector(QWidget *parent,
|
|||
layout->addWidget(cardSelectionBar);
|
||||
|
||||
// Connect deck model data change signal to update display
|
||||
connect(deckModel, &DeckListModel::dataChanged, this, [this]() {
|
||||
// Delay the update to avoid race conditions
|
||||
QTimer::singleShot(100, this, &PrintingSelector::updateDisplay);
|
||||
});
|
||||
connect(deckModel, &DeckListModel::rowsInserted, this, &PrintingSelector::printingsInDeckChanged);
|
||||
connect(deckModel, &DeckListModel::rowsRemoved, this, &PrintingSelector::printingsInDeckChanged);
|
||||
}
|
||||
|
||||
void PrintingSelector::printingsInDeckChanged()
|
||||
{
|
||||
// Delay the update to avoid race conditions
|
||||
QTimer::singleShot(100, this, &PrintingSelector::updateDisplay);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -89,6 +93,12 @@ void PrintingSelector::setCard(const CardInfoPtr &newCard, const QString &_curre
|
|||
if (newCard.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// we don't need to redraw the widget if the card is the same
|
||||
if (!selectedCard.isNull() && selectedCard->getName() == newCard->getName()) {
|
||||
return;
|
||||
}
|
||||
|
||||
selectedCard = newCard;
|
||||
currentZone = _currentZone;
|
||||
if (isVisible()) {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ public slots:
|
|||
void toggleVisibilityCardSizeSlider(bool _state);
|
||||
void toggleVisibilityNavigationButtons(bool _state);
|
||||
|
||||
private slots:
|
||||
void printingsInDeckChanged();
|
||||
|
||||
private:
|
||||
QVBoxLayout *layout;
|
||||
PrintingSelectorViewOptionsToolbarWidget *viewOptionsToolbar;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue