mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 09:04:53 -07:00
[DeckEditor] Don't change widget focus when adding card (#6503)
This commit is contained in:
parent
7c7755b61d
commit
0deaa9d9b4
5 changed files with 11 additions and 7 deletions
|
|
@ -459,12 +459,15 @@ void DeckEditorDeckDockWidget::syncBannerCardComboBoxSelectionWithDeck()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckEditorDeckDockWidget::setSelectedIndex(const QModelIndex &newCardIndex)
|
void DeckEditorDeckDockWidget::setSelectedIndex(const QModelIndex &newCardIndex, bool preserveWidgetFocus)
|
||||||
{
|
{
|
||||||
deckView->clearSelection();
|
deckView->clearSelection();
|
||||||
deckView->setCurrentIndex(newCardIndex);
|
deckView->setCurrentIndex(newCardIndex);
|
||||||
recursiveExpand(newCardIndex);
|
recursiveExpand(newCardIndex);
|
||||||
deckView->setFocus(Qt::FocusReason::MouseFocusReason);
|
|
||||||
|
if (!preserveWidgetFocus) {
|
||||||
|
deckView->setFocus(Qt::FocusReason::MouseFocusReason);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckEditorDeckDockWidget::syncDisplayWidgetsToModel()
|
void DeckEditorDeckDockWidget::syncDisplayWidgetsToModel()
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ private slots:
|
||||||
void writeComments();
|
void writeComments();
|
||||||
void writeBannerCard(int);
|
void writeBannerCard(int);
|
||||||
void applyActiveGroupCriteria();
|
void applyActiveGroupCriteria();
|
||||||
void setSelectedIndex(const QModelIndex &newCardIndex);
|
void setSelectedIndex(const QModelIndex &newCardIndex, bool preserveWidgetFocus);
|
||||||
void updateHash();
|
void updateHash();
|
||||||
void refreshShortcuts();
|
void refreshShortcuts();
|
||||||
void updateShowBannerCardComboBox(bool visible);
|
void updateShowBannerCardComboBox(bool visible);
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ QModelIndex DeckStateManager::addCard(const ExactCard &card, const QString &zone
|
||||||
QModelIndex idx = modifyDeck(reason, [&card, &zone](auto model) { return model->addCard(card, zone); });
|
QModelIndex idx = modifyDeck(reason, [&card, &zone](auto model) { return model->addCard(card, zone); });
|
||||||
|
|
||||||
if (idx.isValid()) {
|
if (idx.isValid()) {
|
||||||
emit focusIndexChanged(idx);
|
emit focusIndexChanged(idx, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return idx;
|
return idx;
|
||||||
|
|
@ -208,7 +208,7 @@ QModelIndex DeckStateManager::decrementCard(const ExactCard &card, const QString
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idx.isValid()) {
|
if (idx.isValid()) {
|
||||||
emit focusIndexChanged(idx);
|
emit focusIndexChanged(idx, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return idx;
|
return idx;
|
||||||
|
|
|
||||||
|
|
@ -290,8 +290,9 @@ signals:
|
||||||
/**
|
/**
|
||||||
* The selected card on any views connected to this deck should be changed to this index.
|
* The selected card on any views connected to this deck should be changed to this index.
|
||||||
* @param index The model index
|
* @param index The model index
|
||||||
|
* @param preserveWidgetFocus Whether to keep the widget focus unchanged
|
||||||
*/
|
*/
|
||||||
void focusIndexChanged(QModelIndex index);
|
void focusIndexChanged(QModelIndex index, bool preserveWidgetFocus);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COCKATRICE_DECK_STATE_MANAGER_H
|
#endif // COCKATRICE_DECK_STATE_MANAGER_H
|
||||||
|
|
@ -198,7 +198,7 @@ void CardAmountWidget::addPrinting(const QString &zone)
|
||||||
});
|
});
|
||||||
|
|
||||||
if (newCardIndex.isValid()) {
|
if (newCardIndex.isValid()) {
|
||||||
emit deckStateManager->focusIndexChanged(newCardIndex);
|
emit deckStateManager->focusIndexChanged(newCardIndex, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue