[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.
This commit is contained in:
Lukas Brübach 2026-09-20 19:27:07 +02:00 committed by GitHub
parent f74a957059
commit ffa3971e90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -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;
}

View file

@ -194,7 +194,9 @@ QStringList VisualDeckStorageWidget::selectedFilePaths() const
if (folderWidget != nullptr) {
const auto previews = folderWidget->findChildren<DeckPreviewWidget *>();
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);
}
}