mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 00:55:09 -07:00
[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:
parent
f74a957059
commit
ffa3971e90
2 changed files with 8 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue