[Client] Visual Deck Editor: Added more mouse click modifiers to add/decrement cards to specific zones (#7589)

* Make visual database mouse click modifiers properly add/decrement different card zones

* Use event->modifiers(), refactor

* Removed QApplication include

* Added visual database display documentation page

* Minor fixes

* Added documentation for the mouse interaction of the table view
This commit is contained in:
Jurriaan 2026-11-03 10:35:58 +01:00 • committed by GitHub
parent 381dd21e8c
commit bfb53c5def
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 43 additions and 10 deletions

View file

@ -20,7 +20,6 @@
#include "tab_deck_editor_visual_tab_widget.h" #include "tab_deck_editor_visual_tab_widget.h"
#include <QAction> #include <QAction>
#include <QApplication>
#include <QByteArray> #include <QByteArray>
#include <QDebug> #include <QDebug>
#include <QDockWidget> #include <QDockWidget>
@ -261,17 +260,25 @@ void TabDeckEditorVisual::processMainboardCardClick(const QMouseEvent *event,
} }
} }
/** @brief Get a zone name corresponding to keyboard modifiers. */
static QString zoneForClickModifiers(const Qt::KeyboardModifiers &modifiers)
{
if (modifiers.testFlag(Qt::ControlModifier)) {
return DECK_ZONE_SIDE;
} else if (modifiers.testFlag(Qt::ShiftModifier)) {
return DECK_ZONE_MAYBEBOARD;
} else {
return DECK_ZONE_MAIN;
}
}
/** @brief Handles clicks on cards in the database display. */ /** @brief Handles clicks on cards in the database display. */
void TabDeckEditorVisual::processDatabaseCardClick(const QMouseEvent *event, const ExactCard &card) void TabDeckEditorVisual::processDatabaseCardClick(const QMouseEvent *event, const ExactCard &card)
{ {
if (event->button() == Qt::LeftButton) { if (event->button() == Qt::LeftButton) {
if (QApplication::keyboardModifiers() & Qt::ControlModifier) { addCard(card, zoneForClickModifiers(event->modifiers()));
addCard(card, DECK_ZONE_SIDE);
} else {
addCard(card, DECK_ZONE_MAIN);
}
} else if (event->button() == Qt::RightButton) { } else if (event->button() == Qt::RightButton) {
decrementCard(card, DECK_ZONE_MAIN); decrementCard(card, zoneForClickModifiers(event->modifiers()));
} else if (event->button() == Qt::MiddleButton) { } else if (event->button() == Qt::MiddleButton) {
deckDockWidget->actRemoveCard(); deckDockWidget->actRemoveCard();
} }

View file

@ -1,6 +1,7 @@
@page editing_decks Editing Decks @page editing_decks Editing Decks
- @subpage editing_decks_classic - @subpage editing_decks_classic
- @subpage editing_decks_visual - @subpage editing_decks_visual
- @subpage editing_decks_printings - @subpage visual_database_display
- @subpage editing_decks_printings

View file

@ -0,0 +1,25 @@
@page visual_database_display Visual Database Display
# Purpose
The VisualDatabaseDisplay presents all the cards from the enabled sets in the CardDatabase, providing a visual way to find and add cards to your DeckList.
# Using the Visual Database Display
The VisualDatabaseDisplay can be opened by itself using the Tabs section in the menu bar at the top of the screen, or by selecting the "Visual Database Display" tab in the visual deck editor. When opened as a part of the visual deck editor, the VisualDatabaseDisplay can be used to add and remove cards from your deck. See @ref editing_decks_visual for more information about modifying your deck.
By default the cards are displayed as a grid of pictures. However, a table view using card names can be toggled by pressing the Visual/Table button at the top right of the widget.
# Filtering cards
The top section of the VisualDatabaseDisplay can be used to filter cards based on various card properties, as well as specifying in which way they should be sorted. Filters can be saved and reused at a later time by using the Save/Load button at the right of this panel.
# Modifying the Deck list
When the VisualDatabaseDisplay is opened as part of the visual deck editor, clicking on cards adds or removes them to and from your deck.
In the picture view, left-clicking on a card will add that card to the main board of your deck, while right-clicking will remove that printing of the card from the main board, if it exists. When clicking cards, modifier keys can be used to add (or remove) the card to zones other than the main board. Holding a Ctrl key on Windows and Linux or a Command key on MacOS adds/removes cards to the sideboard, while the Shift keys add/remove cards to the maybeboard.
In the table view, double-clicking on a card adds that card to the main board of your deck, while right-click opens the card menu. Holding the Ctrl key on Windows and Linux or the Command key on MacOS when double-clicking adds the card to the sideboard instead.
Tokens are always added to the token zone, regardless of which view is open or which modifier key is pressed.