Qt model representing a decklist for use in views (tree/table).
More...
#include <deck_list_model.h>
|
| void | rebuildTree () |
| | Rebuilds the model tree from the underlying DeckLoader.
|
|
| void | deckHashChanged () |
| | Emitted whenever the deck hash changes due to modifications in the model.
|
|
| | DeckListModel (QObject *parent=nullptr) |
| | ~DeckListModel () override |
| QModelIndex | getRoot () const |
| | Returns the root index of the model.
|
| QString | getGroupCriteriaForCard (CardInfoPtr info) const |
| | Returns the value of the grouping category for a card based on the current criteria.
|
| int | rowCount (const QModelIndex &parent) const override |
| int | columnCount (const QModelIndex &=QModelIndex()) const override |
| QVariant | data (const QModelIndex &index, int role) const override |
| void | emitBackgroundUpdates (const QModelIndex &parent) |
| QVariant | headerData (int section, Qt::Orientation orientation, int role) const override |
| QModelIndex | index (int row, int column, const QModelIndex &parent) const override |
| QModelIndex | parent (const QModelIndex &index) const override |
| Qt::ItemFlags | flags (const QModelIndex &index) const override |
| bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
| bool | removeRows (int row, int count, const QModelIndex &parent) override |
| QModelIndex | findCard (const QString &cardName, const QString &zoneName, const QString &providerId="", const QString &cardNumber="") const |
| | Finds a card by name, zone, and optional identifiers.
|
| QModelIndex | addPreferredPrintingCard (const QString &cardName, const QString &zoneName, bool abAddAnyway) |
| | Adds a card using the preferred printing if available.
|
| QModelIndex | addCard (const ExactCard &card, const QString &zoneName) |
| | Adds an ExactCard to the specified zone.
|
| int | findSortedInsertRow (InnerDecklistNode *parent, CardInfoPtr cardInfo) const |
| | Determines the sorted insertion row for a card.
|
| void | sort (int column, Qt::SortOrder order) override |
| void | cleanList () |
| | Removes all cards and resets the model.
|
| DeckList * | getDeckList () const |
| void | setDeckList (DeckList *_deck) |
| QList< ExactCard > | getCards () const |
| QList< ExactCard > | getCardsForZone (const QString &zoneName) const |
| QList< QString > * | getZones () const |
| void | setActiveGroupCriteria (DeckListModelGroupCriteria::Type newCriteria) |
| | Sets the criteria used to group cards in the model.
|
Qt model representing a decklist for use in views (tree/table).
DeckListModel is a QAbstractItemModel that exposes the structure of a deck (zones and cards) to Qt views. It organizes cards hierarchically under InnerDecklistNode containers and supports grouping, sorting, adding/removing cards, and printing decklists.
Signals:
- deckHashChanged(): emitted when the deck contents change in a way that affects its hash.
Slots:
- rebuildTree(): rebuilds the model structure from the underlying DeckLoader.
◆ DeckListModel()
| DeckListModel::DeckListModel |
( |
QObject * | parent = nullptr | ) |
|
|
explicit |
◆ ~DeckListModel()
| DeckListModel::~DeckListModel |
( |
| ) |
|
|
override |
◆ addCard()
| QModelIndex DeckListModel::addCard |
( |
const ExactCard & | card, |
|
|
const QString & | zoneName ) |
Adds an ExactCard to the specified zone.
- Parameters
-
| card | The card to add. |
| zoneName | The zone to insert the card into. |
- Returns
- QModelIndex pointing to the newly inserted card node.
◆ addPreferredPrintingCard()
| QModelIndex DeckListModel::addPreferredPrintingCard |
( |
const QString & | cardName, |
|
|
const QString & | zoneName, |
|
|
bool | abAddAnyway ) |
Adds a card using the preferred printing if available.
- Parameters
-
| cardName | Name of the card to add. |
| zoneName | Zone to insert the card into. |
| abAddAnyway | Whether to add the card even if resolution fails. |
- Returns
- QModelIndex pointing to the newly inserted card node.
◆ cleanList()
| void DeckListModel::cleanList |
( |
| ) |
|
Removes all cards and resets the model.
◆ columnCount()
| int DeckListModel::columnCount |
( |
const QModelIndex & | = QModelIndex() | ) |
const |
|
nodiscardoverride |
◆ createNodeIfNeeded()
◆ data()
| QVariant DeckListModel::data |
( |
const QModelIndex & | index, |
|
|
int | role ) const |
|
nodiscardoverride |
◆ deckHashChanged
| void DeckListModel::deckHashChanged |
( |
| ) |
|
|
signal |
Emitted whenever the deck hash changes due to modifications in the model.
◆ emitBackgroundUpdates()
| void DeckListModel::emitBackgroundUpdates |
( |
const QModelIndex & | parent | ) |
|
◆ emitRecursiveUpdates()
| void DeckListModel::emitRecursiveUpdates |
( |
const QModelIndex & | index | ) |
|
|
private |
◆ findCard()
| QModelIndex DeckListModel::findCard |
( |
const QString & | cardName, |
|
|
const QString & | zoneName, |
|
|
const QString & | providerId = "", |
|
|
const QString & | cardNumber = "" ) const |
|
nodiscard |
Finds a card by name, zone, and optional identifiers.
- Parameters
-
| cardName | The card's name. |
| zoneName | The zone to search in (main/side/etc.). |
| providerId | Optional provider-specific ID. |
| cardNumber | Optional collector number. |
- Returns
- QModelIndex of the card, or invalid index if not found.
◆ findCardNode()
| DecklistModelCardNode * DeckListModel::findCardNode |
( |
const QString & | cardName, |
|
|
const QString & | zoneName, |
|
|
const QString & | providerId = "", |
|
|
const QString & | cardNumber = "" ) const |
|
nodiscardprivate |
◆ findSortedInsertRow()
Determines the sorted insertion row for a card.
- Parameters
-
| parent | The parent node where the card will be inserted. |
| cardInfo | The card info to insert. |
- Returns
- Row index where the card should be inserted to maintain sort order.
◆ flags()
| Qt::ItemFlags DeckListModel::flags |
( |
const QModelIndex & | index | ) |
const |
|
nodiscardoverride |
◆ getCards()
| QList< ExactCard > DeckListModel::getCards |
( |
| ) |
const |
|
nodiscard |
◆ getCardsForZone()
| QList< ExactCard > DeckListModel::getCardsForZone |
( |
const QString & | zoneName | ) |
const |
|
nodiscard |
◆ getDeckList()
| DeckList * DeckListModel::getDeckList |
( |
| ) |
const |
|
inlinenodiscard |
◆ getGroupCriteriaForCard()
| QString DeckListModel::getGroupCriteriaForCard |
( |
CardInfoPtr | info | ) |
const |
|
nodiscard |
Returns the value of the grouping category for a card based on the current criteria.
- Parameters
-
| info | Pointer to card information. |
- Returns
- String representing the value of the current grouping criteria for the card.
◆ getNode()
template<typename T>
| T DeckListModel::getNode |
( |
const QModelIndex & | index | ) |
const |
|
inlineprivate |
◆ getRoot()
| QModelIndex DeckListModel::getRoot |
( |
| ) |
const |
|
inlinenodiscard |
Returns the root index of the model.
- Returns
- QModelIndex representing the root node.
◆ getZones()
| QList< QString > * DeckListModel::getZones |
( |
| ) |
const |
|
nodiscard |
◆ headerData()
| QVariant DeckListModel::headerData |
( |
int | section, |
|
|
Qt::Orientation | orientation, |
|
|
int | role ) const |
|
nodiscardoverride |
◆ index()
| QModelIndex DeckListModel::index |
( |
int | row, |
|
|
int | column, |
|
|
const QModelIndex & | parent ) const |
|
nodiscardoverride |
◆ nodeToIndex()
◆ parent()
| QModelIndex DeckListModel::parent |
( |
const QModelIndex & | index | ) |
const |
|
nodiscardoverride |
◆ rebuildTree
| void DeckListModel::rebuildTree |
( |
| ) |
|
|
slot |
Rebuilds the model tree from the underlying DeckLoader.
This updates all indices and ensures the model reflects the current state of the deck.
◆ removeRows()
| bool DeckListModel::removeRows |
( |
int | row, |
|
|
int | count, |
|
|
const QModelIndex & | parent ) |
|
override |
◆ rowCount()
| int DeckListModel::rowCount |
( |
const QModelIndex & | parent | ) |
const |
|
nodiscardoverride |
◆ setActiveGroupCriteria()
Sets the criteria used to group cards in the model.
- Parameters
-
| newCriteria | The new grouping criteria. |
◆ setData()
| bool DeckListModel::setData |
( |
const QModelIndex & | index, |
|
|
const QVariant & | value, |
|
|
int | role ) |
|
override |
◆ setDeckList()
| void DeckListModel::setDeckList |
( |
DeckList * | _deck | ) |
|
◆ sort()
| void DeckListModel::sort |
( |
int | column, |
|
|
Qt::SortOrder | order ) |
|
override |
◆ sortHelper()
◆ activeGroupCriteria
◆ deckList
Pointer to the deck loader providing the underlying data.
◆ lastKnownColumn
| int DeckListModel::lastKnownColumn |
|
private |
Last column used for sorting.
◆ lastKnownOrder
| Qt::SortOrder DeckListModel::lastKnownOrder |
|
private |
◆ root
Root node of the model tree.
The documentation for this class was generated from the following files: