Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
DeckListModelCustomZones Namespace Reference

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.

Detailed Description

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.

Function Documentation

◆ findGroupChild()

InnerDecklistNode * DeckListModelCustomZones::findGroupChild ( InnerDecklistNode * parent,
const QString & name )
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.

Parameters
parentThe shadow node whose children are searched.
nameThe group name to find.
Returns
The matching group node, or nullptr if none exists.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ findSubZoneByName()

DecklistModelSubZoneNode * DeckListModelCustomZones::findSubZoneByName ( InnerDecklistNode * root,
const QString & zoneName )
nodiscard

Finds a custom zone in the shadow tree by deck-unique name.

Parameters
rootRoot of the shadow tree.
zoneNameThe custom zone name to find.
Returns
The matching custom zone node, or nullptr if not found.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCustomZone()

bool DeckListModelCustomZones::isCustomZone ( const AbstractDecklistNode * node)
nodiscard

Whether the given node is a custom zone (as opposed to a criteria group).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mirrorCustomZones()

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.

Parameters
deckBoardZoneThe board zone in the canonical deck tree.
shadowBoardZoneThe matching board zone in the model's shadow tree.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sortWithCustomZonesLast()

QList< QPair< int, int > > DeckListModelCustomZones::sortWithCustomZonesLast ( InnerDecklistNode * root,
InnerDecklistNode * node,
Qt::SortOrder order )
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.

Parameters
rootRoot of the shadow tree (used to classify board zones).
nodeThe shadow node whose children are reordered.
orderSort order to apply.
Returns
A list of (preSortRow, finalRow) pairs describing how each node moved.
Here is the call graph for this function:
Here is the caller graph for this function: