![]() |
Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
|
Tree-level helpers for the deck list model's custom-zone shadow nodes. More...
Functions | |
| bool | isCustomZone (const AbstractDecklistNode *node) |
| Whether the given node is a custom zone (as opposed to a criteria group). | |
| void | mirrorCustomZones (const InnerDecklistNode *deckBoardZone, InnerDecklistNode *shadowBoardZone) |
| Mirrors the custom zones of a deck board zone into its shadow board node. | |
| InnerDecklistNode * | findGroupChild (InnerDecklistNode *parent, const QString &name) |
Finds a criteria-group child of parent by name, skipping custom zones. | |
| DecklistModelSubZoneNode * | findSubZoneByName (InnerDecklistNode *root, const QString &zoneName) |
| Finds a custom zone in the shadow tree by deck-unique name. | |
| QList< QPair< int, int > > | sortWithCustomZonesLast (InnerDecklistNode *root, InnerDecklistNode *node, Qt::SortOrder order) |
| Sorts a shadow node's children, keeping a board's custom zones last. | |
Tree-level helpers for the deck list model's custom-zone shadow nodes.
The deck list model keeps a second "shadow" tree of InnerDecklistNode that mirrors the canonical deck tree for grouping and sorting. Custom zones add a layer of bookkeeping to that shadow tree: they must be mirrored alongside criteria groups, always sort after the groups within a board, and be resolvable by deck-unique name.
This namespace centralizes every "what is / where is a custom zone" decision so the model itself only wires the results into Qt model signals.
|
nodiscard |
Finds a criteria-group child of parent by name, skipping custom zones.
The shadow tree keeps criteria groups and mirrored custom zones as siblings under a board zone, and InnerDecklistNode::findChild matches both by name. Group lookups must not resolve a custom zone that happens to share the group name (e.g. a zone called "Creature"), so this searches only non-custom children.
| parent | The shadow node whose children are searched. |
| name | The group name to find. |
|
nodiscard |
Finds a custom zone in the shadow tree by deck-unique name.
| root | Root of the shadow tree. |
| zoneName | The custom zone name to find. |
|
nodiscard |
Whether the given node is a custom zone (as opposed to a criteria group).
| void DeckListModelCustomZones::mirrorCustomZones | ( | const InnerDecklistNode * | deckBoardZone, |
| InnerDecklistNode * | shadowBoardZone ) |
Mirrors the custom zones of a deck board zone into its shadow board node.
Each custom zone becomes a DecklistModelSubZoneNode under shadowBoardZone with its cards as direct (un-grouped) children.
| deckBoardZone | The board zone in the canonical deck tree. |
| shadowBoardZone | The matching board zone in the model's shadow tree. |
|
nodiscard |
Sorts a shadow node's children, keeping a board's custom zones last.
Sorting alone would interleave custom zones with criteria groups by name, but custom zones must always stay after the groups within a board, regardless of name. This applies the sort and, for board zones, stably moves the custom zones to the end.
| root | Root of the shadow tree (used to classify board zones). |
| node | The shadow node whose children are reordered. |
| order | Sort order to apply. |