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

The three canonical starters as a picker model. More...

#include <pokemonstartersmodel.h>

Inheritance diagram for PokemonStartersModel:
Collaboration diagram for PokemonStartersModel:

Public Types

enum  PokemonStarterRoles { IndRole = Qt::UserRole + 1 , NameRole }
 Columns (mapped in roleNames()). More...

Public Member Functions

virtual int rowCount (const QModelIndex &parent) const override
 Row count (3).
virtual QVariant data (const QModelIndex &index, int role) const override
 Row+role value.
virtual QHash< int, QByteArray > roleNames () const override
 Role -> QML name.
int valToIndex (int val)
 Row index for species value val.
PokemonDBEntrygetMon (int ind) const
 DB entry for row ind.

Public Attributes

QString starters [3]
 The three canonical starter species.

Detailed Description

The three canonical starters as a picker model.

A tiny fixed list model (see CreditsModel) over starters. valToIndex() maps a species value to its row; getMon() resolves a row to its DB entry. Exposed as brg.starterModel.

Definition at line 30 of file pokemonstartersmodel.h.

Member Enumeration Documentation

◆ PokemonStarterRoles

Columns (mapped in roleNames()).

Enumerator
IndRole 
NameRole 

Definition at line 36 of file pokemonstartersmodel.h.

Member Function Documentation

◆ data()

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

Row+role value.

Definition at line 34 of file pokemonstartersmodel.cpp.

References getMon(), IndRole, and NameRole.

◆ getMon()

PokemonDBEntry * PokemonStartersModel::getMon ( int ind) const

DB entry for row ind.

Definition at line 100 of file pokemonstartersmodel.cpp.

References PokemonDB::getIndAt(), PokemonDB::inst(), and starters.

Referenced by data().

◆ roleNames()

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

Role -> QML name.

Definition at line 70 of file pokemonstartersmodel.cpp.

References IndRole, and NameRole.

◆ rowCount()

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

Row count (3).

Definition at line 25 of file pokemonstartersmodel.cpp.

◆ valToIndex()

int PokemonStartersModel::valToIndex ( int val)

Row index for species value val.

Definition at line 80 of file pokemonstartersmodel.cpp.

References PokemonDB::getIndAt(), and PokemonDB::inst().

Member Data Documentation

◆ starters

QString PokemonStartersModel::starters[3]
Initial value:
= {
"Bulbasaur",
"Charmander",
"Squirtle"
}

The three canonical starter species.

Definition at line 42 of file pokemonstartersmodel.h.

Referenced by getMon().


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