Add card selection counter (#6685)

* feat(game): add drag selection counter overlay
   Display count of selected cards inside the lasso during drag selection.
   Count appears near cursor, repositioning to stay within selection bounds.

   Includes SelectionRubberBand subclass to allow label to appear above band.
   QRubberBand calls raise() in showEvent/changeEvent to stay on top - this
   subclass suppresses that behavior so dragCountLabel can be visible.

   Adds user setting to enable/disable the drag count overlay.

* feat(game): add persistent selection counter overlay.
Display total count of selected cards in bottom-right corner when multiple cards are selected.
Updates on selection changes and window resize.
The counter connects to QGraphicsScene::selectionChanged to stay up-to-date without requiring manual refresh.
Adds user setting to enable/disable the total count overlay.

---------

Co-authored-by: RickyRister <42636155+RickyRister@users.noreply.github.com>
This commit is contained in:
DawnFire42 2026-03-16 18:44:29 -04:00 committed by GitHub
parent 69c046cca4
commit fc453c68a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 170 additions and 11 deletions

View file

@ -821,6 +821,14 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
connect(&annotateTokensCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
&SettingsCache::setAnnotateTokens);
showDragSelectionCountCheckBox.setChecked(SettingsCache::instance().getShowDragSelectionCount());
connect(&showDragSelectionCountCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
&SettingsCache::setShowDragSelectionCount);
showTotalSelectionCountCheckBox.setChecked(SettingsCache::instance().getShowTotalSelectionCount());
connect(&showTotalSelectionCountCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
&SettingsCache::setShowTotalSelectionCount);
useTearOffMenusCheckBox.setChecked(SettingsCache::instance().getUseTearOffMenus());
connect(&useTearOffMenusCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
[](const QT_STATE_CHANGED_T state) { SettingsCache::instance().setUseTearOffMenus(state == Qt::Checked); });
@ -833,7 +841,9 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
generalGrid->addWidget(&closeEmptyCardViewCheckBox, 4, 0);
generalGrid->addWidget(&focusCardViewSearchBarCheckBox, 5, 0);
generalGrid->addWidget(&annotateTokensCheckBox, 6, 0);
generalGrid->addWidget(&useTearOffMenusCheckBox, 7, 0);
generalGrid->addWidget(&showDragSelectionCountCheckBox, 7, 0);
generalGrid->addWidget(&showTotalSelectionCountCheckBox, 8, 0);
generalGrid->addWidget(&useTearOffMenusCheckBox, 9, 0);
generalGroupBox = new QGroupBox;
generalGroupBox->setLayout(generalGrid);
@ -955,6 +965,8 @@ void UserInterfaceSettingsPage::retranslateUi()
closeEmptyCardViewCheckBox.setText(tr("Close card view window when last card is removed"));
focusCardViewSearchBarCheckBox.setText(tr("Auto focus search bar when card view window is opened"));
annotateTokensCheckBox.setText(tr("Annotate card text on tokens"));
showDragSelectionCountCheckBox.setText(tr("Show selection counter during drag selection"));
showTotalSelectionCountCheckBox.setText(tr("Show total selection counter"));
useTearOffMenusCheckBox.setText(tr("Use tear-off menus, allowing right click menus to persist on screen"));
notificationsGroupBox->setTitle(tr("Notifications settings"));
notificationsEnabledCheckBox.setText(tr("Enable notifications in taskbar"));