|
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
|
Move picker model – context-aware on a chosen Pokemon. More...
#include <moveselectmodel.h>
Public Types | |
| enum | ItemRoles { IndRole = Qt::UserRole + 1 , NameRole } |
| Picker columns (mapped in roleNames()). More... | |
Public Member Functions | |
| MoveSelectModel () | |
| 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. | |
| int | moveToListIndex (int ind) |
Row index for move ind. | |
| void | onMonChange () |
| React to mon changing. | |
| void | rebuildListGeneral () |
| Rebuild with all moves. | |
| void | rebuildListSpecific () |
| Rebuild with mon's legal moves only. | |
| void | monFromBox (PokemonBox *box) |
| Set mon from a QML-passed PokemonBox. | |
Public Attributes | |
| QVector< MoveSelectEntry * > | moveListCache |
| Cached picker rows. | |
| PokemonDBEntry * | mon = nullptr |
Move picker model – context-aware on a chosen Pokemon.
Select-model variant (see SpeciesSelectModel) with a twist: when mon is set (via monFromBox() from the details editor) the list rebuilds to that species' legal moves (rebuildListSpecific); otherwise it shows the general move list. Exposed as brg.moveSelectModel.
Definition at line 45 of file moveselectmodel.h.
Picker columns (mapped in roleNames()).
| Enumerator | |
|---|---|
| IndRole | |
| NameRole | |
Definition at line 56 of file moveselectmodel.h.
| MoveSelectModel::MoveSelectModel | ( | ) |
Definition at line 35 of file moveselectmodel.cpp.
References onMonChange().
|
overridevirtual |
Row+role value.
Definition at line 50 of file moveselectmodel.cpp.
References IndRole, moveListCache, and NameRole.
| void MoveSelectModel::monFromBox | ( | PokemonBox * | box | ) |
Set mon from a QML-passed PokemonBox.
Definition at line 452 of file moveselectmodel.cpp.
References mon, PokemonDBEntry::pokedex, and PokemonBox::toData().
| int MoveSelectModel::moveToListIndex | ( | int | ind | ) |
Row index for move ind.
Definition at line 85 of file moveselectmodel.cpp.
References moveListCache.
| void MoveSelectModel::onMonChange | ( | ) |
React to mon changing.
Definition at line 100 of file moveselectmodel.cpp.
References mon, moveListCache, rebuildListGeneral(), and rebuildListSpecific().
Referenced by MoveSelectModel().
| void MoveSelectModel::rebuildListGeneral | ( | ) |
Rebuild with all moves.
Definition at line 116 of file moveselectmodel.cpp.
References MovesDB::inst(), and moveListCache.
Referenced by onMonChange(), and rebuildListSpecific().
| void MoveSelectModel::rebuildListSpecific | ( | ) |
Rebuild with mon's legal moves only.
Definition at line 209 of file moveselectmodel.cpp.
References MovesDB::inst(), mon, moveListCache, and rebuildListGeneral().
Referenced by onMonChange().
|
overridevirtual |
Role -> QML name.
Definition at line 75 of file moveselectmodel.cpp.
|
overridevirtual |
| PokemonDBEntry* MoveSelectModel::mon = nullptr |
Definition at line 78 of file moveselectmodel.h.
Referenced by monFromBox(), onMonChange(), and rebuildListSpecific().
| QVector<MoveSelectEntry*> MoveSelectModel::moveListCache |
Cached picker rows.
Definition at line 77 of file moveselectmodel.h.
Referenced by data(), moveToListIndex(), onMonChange(), rebuildListGeneral(), rebuildListSpecific(), and rowCount().