|
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
|
A species picker list model (the "select model" variant). More...
#include <speciesselectmodel.h>
Public Types | |
| enum | ItemRoles { IndRole = Qt::UserRole + 1 , NameRole } |
| Picker columns (mapped to names in roleNames()). More... | |
Public Member Functions | |
| SpeciesSelectModel () | |
| Build the cache from the species DB. | |
| virtual int | rowCount (const QModelIndex &parent) const override |
| Number of species rows. | |
| virtual QVariant | data (const QModelIndex &index, int role) const override |
| Value for a row + role. | |
| virtual QHash< int, QByteArray > | roleNames () const override |
| Role -> QML name map. | |
| int | speciesToListIndex (int ind) |
Row index for species ind (for combo highlighting). | |
Public Attributes | |
| QVector< SpeciesSelectEntry * > | speciesListCache |
| Cached picker rows. | |
A species picker list model (the "select model" variant).
The picker flavour of the mvc-model convention (see CreditsModel): besides the standard rowCount/data/roleNames, it holds a speciesListCache of SpeciesSelectEntry rows and adds speciesToListIndex() to map a species index to its row – so a combo box can highlight the current value. The other *SelectModel pickers (status/nature/move/map/item/box) follow the same shape.
Definition at line 41 of file speciesselectmodel.h.
Picker columns (mapped to names in roleNames()).
| Enumerator | |
|---|---|
| IndRole | |
| NameRole | |
Definition at line 47 of file speciesselectmodel.h.
| SpeciesSelectModel::SpeciesSelectModel | ( | ) |
Build the cache from the species DB.
Definition at line 33 of file speciesselectmodel.cpp.
References PokemonDB::inst(), and speciesListCache.
|
overridevirtual |
Value for a row + role.
Definition at line 97 of file speciesselectmodel.cpp.
References IndRole, NameRole, and speciesListCache.
|
overridevirtual |
Role -> QML name map.
Definition at line 122 of file speciesselectmodel.cpp.
|
overridevirtual |
Number of species rows.
Definition at line 88 of file speciesselectmodel.cpp.
References speciesListCache.
| int SpeciesSelectModel::speciesToListIndex | ( | int | ind | ) |
Row index for species ind (for combo highlighting).
Definition at line 132 of file speciesselectmodel.cpp.
References speciesListCache.
| QVector<SpeciesSelectEntry*> SpeciesSelectModel::speciesListCache |
Cached picker rows.
Definition at line 58 of file speciesselectmodel.h.
Referenced by data(), rowCount(), SpeciesSelectModel(), and speciesToListIndex().