From ffa3971e9034b927cb6338264b19173f6a43900d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Sun, 20 Sep 2026 19:27:07 +0200 Subject: [PATCH] [DeckShare] Keep the share selection consistent with the visible decks Filtered-out previews are hidden but kept alive, so selectedFilePaths() counted them in the share and the selection highlight. Only decks the user can see are now shared, and a deck that stops matching the filters is deselectd as the deck pass runs, keeping the %n count and the highlight in sync with the screen. --- .../visual_deck_storage_folder_display_widget.cpp | 5 +++++ .../visual_deck_storage/visual_deck_storage_widget.cpp | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_folder_display_widget.cpp b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_folder_display_widget.cpp index 90440beed..911f3dee9 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_folder_display_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_folder_display_widget.cpp @@ -126,6 +126,11 @@ void VisualDeckStorageFolderDisplayWidget::continueDeckPass() const bool matches = index.data(VisualDeckStorageRoles::FilterMatchRole).toBool(); deckPreviewWidget->setVisible(matches); + if (!matches) { + // A deck that no longer matches the filters is dropped from the selection so its + // highlight cannot linger on an invisible preview or be counted in the share. + deckPreviewWidget->setShareSelected(false); + } if (matches) { ++visibleDeckCount; } diff --git a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_widget.cpp b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_widget.cpp index 5ec57c360..bd167ec5b 100644 --- a/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_storage/visual_deck_storage_widget.cpp @@ -194,7 +194,9 @@ QStringList VisualDeckStorageWidget::selectedFilePaths() const if (folderWidget != nullptr) { const auto previews = folderWidget->findChildren(); for (DeckPreviewWidget *preview : previews) { - if (preview->isShareSelected()) { + // Filtered-out previews stay alive hidden in their sorted place, so only decks the + // user can actually see are part of the share. + if (preview->isVisible() && preview->isShareSelected()) { selectedPaths.append(preview->filePath); } }