Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
PokemonOverviewModel Class Reference

Read-only "where are my Pokemon" overview for the Pokemon screen's View All pane – the Pokemon analogue of ItemOverviewModel. More...

#include <pokemonoverviewmodel.h>

Inheritance diagram for PokemonOverviewModel:
Collaboration diagram for PokemonOverviewModel:

Public Types

enum  OverviewRoles { NameRole = Qt::UserRole + 1 , CountsRole , TooltipsRole }
 Column header labels, in display order (e.g. More...
enum  SortSelect {
  SortBegin , SortDex , SortName , SortInternal ,
  SortEnd
}
 Species-column sort orders – the SAME set the Pokedex screen cycles (PokedexModel::PokemonSortSelect): dex number, alphabetical, internal id. More...

Public Member Functions

 PokemonOverviewModel (PokemonStorageBox *party, Storage *storage, PlayerBasics *basics)
virtual int rowCount (const QModelIndex &parent) const override
 Row count.
virtual QVariant data (const QModelIndex &index, int role) const override
 Row+role value.
virtual QHash< int, QByteArray > roleNames () const override
 Role -> QML name.
QStringList columns () const
QString sortLabel () const
QString sortIcon () const
void sortCycle ()
 Advance to the next species sort order (re-sorts in place).
void rebuild ()
 Re-aggregate the party + boxes (full model reset). Wired to pokemonChanged.
protected::void columnsChanged ()
void sortSelectChanged ()

Detailed Description

Read-only "where are my Pokemon" overview for the Pokemon screen's View All pane – the Pokemon analogue of ItemOverviewModel.

Aggregates the party and the 12 PC boxes into one alphabetized species table. Each row is a distinct species (keyed by raw species id, displayed by species name – NOT nickname); the columns are the party first, then only the boxes that actually hold Pokemon (empty boxes are omitted entirely, keeping the table clean). Each cell carries the count of that species in that column plus a precomputed hover tooltip listing the differing nicknames in that cell, an "...and xN others" tail for the un-nicknamed remainder, and a caught/traded breakdown (a mon is "traded" when its OT name/ID differs from the player's – PokemonBox::hasTradeStatus). A zero cell carries an empty tooltip so the view can hide just that number. Rebuilds (full reset) whenever the party or any box changes, plus an explicit rebuild-on-open. Exposed as brg.pokemonOverviewModel.

The column headers are exposed separately as the columns string list so the QML header row and the per-row count cells stay aligned.

See also
ItemOverviewModel (the items analogue), PokemonStorageBox, Storage, PokemonBox::hasTradeStatus / hasNickname / speciesName.

Definition at line 50 of file pokemonoverviewmodel.h.

Member Enumeration Documentation

◆ OverviewRoles

Column header labels, in display order (e.g.

"Party", "Box 1", ...). One per entry in each row's counts/tooltips. Changes on every rebuild. Current species-column sort order (see SortSelect). Cycled by sortCycle(). Human-readable label for the current sort (kept for reference/debug). qrc path of the icon for the current sort (so the header button shows which order is active, instead of one static icon + a tooltip). Roles (mapped in roleNames()).

Enumerator
NameRole 

Species display name.

CountsRole 

Per-column counts (QVariantList<int>, aligned to columns).

TooltipsRole 

Per-column hover tooltips (QVariantList<QString>; empty when count 0).

Definition at line 68 of file pokemonoverviewmodel.h.

◆ SortSelect

Species-column sort orders – the SAME set the Pokedex screen cycles (PokedexModel::PokemonSortSelect): dex number, alphabetical, internal id.

Enumerator
SortBegin 
SortDex 

Pokedex number order.

SortName 

Alphabetical by species name.

SortInternal 

Internal / creation (raw species id) order.

SortEnd 

Definition at line 76 of file pokemonoverviewmodel.h.

Constructor & Destructor Documentation

◆ PokemonOverviewModel()

PokemonOverviewModel::PokemonOverviewModel ( PokemonStorageBox * party,
Storage * storage,
PlayerBasics * basics )
Parameters
partythe player's party;
storagethe PC (12 boxes);
basicsthe player's basics (for trade-status comparison).

Definition at line 50 of file pokemonoverviewmodel.cpp.

References PokemonStorageBox::pokemonChanged(), and rebuild().

Member Function Documentation

◆ columns()

QStringList PokemonOverviewModel::columns ( ) const
See also
columns property.

Definition at line 79 of file pokemonoverviewmodel.cpp.

◆ columnsChanged()

protected::void PokemonOverviewModel::columnsChanged ( )

Referenced by rebuild().

◆ data()

QVariant PokemonOverviewModel::data ( const QModelIndex & index,
int role ) const
overridevirtual

Row+role value.

Definition at line 84 of file pokemonoverviewmodel.cpp.

References CountsRole, NameRole, and TooltipsRole.

◆ rebuild()

void PokemonOverviewModel::rebuild ( )

Re-aggregate the party + boxes (full model reset). Wired to pokemonChanged.

Definition at line 194 of file pokemonoverviewmodel.cpp.

References columnsChanged(), PokemonStorageBox::pokemon, and PokemonStorageBox::pokemonCount().

Referenced by PokemonOverviewModel().

◆ roleNames()

QHash< int, QByteArray > PokemonOverviewModel::roleNames ( ) const
overridevirtual

Role -> QML name.

Definition at line 113 of file pokemonoverviewmodel.cpp.

References CountsRole, NameRole, and TooltipsRole.

◆ rowCount()

int PokemonOverviewModel::rowCount ( const QModelIndex & parent) const
overridevirtual

Row count.

Definition at line 73 of file pokemonoverviewmodel.cpp.

◆ sortCycle()

void PokemonOverviewModel::sortCycle ( )

Advance to the next species sort order (re-sorts in place).

Definition at line 280 of file pokemonoverviewmodel.cpp.

References SortBegin, SortEnd, and sortSelectChanged().

◆ sortIcon()

QString PokemonOverviewModel::sortIcon ( ) const
See also
sortIcon property.

Definition at line 305 of file pokemonoverviewmodel.cpp.

References SortDex, SortInternal, and SortName.

◆ sortLabel()

QString PokemonOverviewModel::sortLabel ( ) const
See also
sortLabel property.

Definition at line 295 of file pokemonoverviewmodel.cpp.

References SortDex, SortInternal, and SortName.

◆ sortSelectChanged()

void PokemonOverviewModel::sortSelectChanged ( )

Referenced by sortCycle().


The documentation for this class was generated from the following files: