Set the index correctly when removing a non-providerId printing for a providerId printing to avoid jumping to the next card.

This commit is contained in:
Lukas Brübach 2024-12-01 13:12:49 +01:00 committed by ZeldaZach
parent 7a136178e0
commit 059c23f8f4
No known key found for this signature in database

View file

@ -87,12 +87,14 @@ void CardAmountWidget::updateCardCount()
void CardAmountWidget::addPrinting(const QString &zone)
{
const auto newCardIndex = deckModel->addCard(rootCard->getName(), setInfoForCard, zone);
auto newCardIndex = deckModel->addCard(rootCard->getName(), setInfoForCard, zone);
recursiveExpand(newCardIndex);
QModelIndex find_card = deckModel->findCard(rootCard->getName(), zone);
if (find_card.isValid() && find_card != newCardIndex) {
deckModel->removeRow(find_card.row(), find_card.parent());
};
newCardIndex = deckModel->findCard(rootCard->getName(), zone, setInfoForCard.getProperty("uuid"));
deckView->setCurrentIndex(newCardIndex);
deckView->setFocus(Qt::FocusReason::MouseFocusReason);
}