|
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
|
The "which PC box" selector model (Party + 12 boxes). More...
#include <pokemonboxselectmodel.h>
Public Types | |
| enum | PokemonBoxSelectModelRoles { NameRole = Qt::UserRole + 1 , ValueRole , DisabledRole , IndRole } |
| Columns (mapped in roleNames()). More... | |
Public Member Functions | |
| PokemonBoxSelectModel (PokemonStorageModel *pairedModel) | |
| virtual int | rowCount (const QModelIndex &parent) const override |
| Row count (13). | |
| virtual QVariant | data (const QModelIndex &index, int role) const override |
| Row+role value. | |
| virtual QHash< int, QByteArray > | roleNames () const override |
| Role -> QML name. | |
| virtual bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
| Selection write-back. | |
| void | onBoxChange () |
| React to this selector changing. | |
| void | onPairedBoxChange () |
| React to the paired model's box changing. | |
| QString | getDecoratedName (int box) const |
| Row label with its fill-status symbol. | |
Public Attributes | |
| QString | curBoxSym = "▷" |
| Decoration: current-box marker (points at the label). Fill status is conveyed by the (N/Max) count. | |
| QString | boxSelect [13] |
| Row labels: Party plus the 12 boxes. | |
| PokemonStorageModel * | pairedModel = nullptr |
| The storage model this selector drives (see note). | |
| Storage * | storage = nullptr |
| The PC storage (for fill status). | |
| PlayerPokemon * | party = nullptr |
| The party (box 0). | |
The "which PC box" selector model (Party + 12 boxes).
A combo-box model listing the party and the twelve storage boxes. Each row shows a (filled count / max) tally and the current box is marked with a leading ▷. It is paired to a PokemonStorageModel: selecting a box here drives that model's current box, and vice versa (see the note at pairedModel). setData() handles the selection write-back. Exposed as brg.pokemonBoxSelectModel1/2.
Definition at line 36 of file pokemonboxselectmodel.h.
Columns (mapped in roleNames()).
| Enumerator | |
|---|---|
| NameRole | |
| ValueRole | |
| DisabledRole | |
| IndRole | |
Definition at line 42 of file pokemonboxselectmodel.h.
| PokemonBoxSelectModel::PokemonBoxSelectModel | ( | PokemonStorageModel * | pairedModel | ) |
| pairedModel | the storage model to drive. |
Definition at line 30 of file pokemonboxselectmodel.cpp.
References Storage::boxesFormattedChanged(), Storage::curBoxChanged(), onBoxChange(), pairedModel, party, PokemonStorageBox::pokemonChanged(), Storage::pokemonChanged(), and storage.
|
overridevirtual |
Row+role value.
Definition at line 63 of file pokemonboxselectmodel.cpp.
References DisabledRole, getDecoratedName(), IndRole, NameRole, pairedModel, storage, and ValueRole.
| QString PokemonBoxSelectModel::getDecoratedName | ( | int | box | ) | const |
Row label with its fill-status symbol.
Definition at line 141 of file pokemonboxselectmodel.cpp.
References boxSelect, curBoxSym, party, PokemonStorageBox::pokemonCount(), PokemonStorageBox::pokemonMax(), and storage.
Referenced by data().
| void PokemonBoxSelectModel::onBoxChange | ( | ) |
React to this selector changing.
Definition at line 135 of file pokemonboxselectmodel.cpp.
Referenced by PokemonBoxSelectModel().
| void PokemonBoxSelectModel::onPairedBoxChange | ( | ) |
React to the paired model's box changing.
|
overridevirtual |
Role -> QML name.
Definition at line 106 of file pokemonboxselectmodel.cpp.
References DisabledRole, IndRole, NameRole, and ValueRole.
|
overridevirtual |
Row count (13).
Definition at line 54 of file pokemonboxselectmodel.cpp.
|
overridevirtual |
Selection write-back.
Definition at line 118 of file pokemonboxselectmodel.cpp.
References IndRole, and pairedModel.
| QString PokemonBoxSelectModel::boxSelect[13] |
Row labels: Party plus the 12 boxes.
Definition at line 53 of file pokemonboxselectmodel.h.
Referenced by getDecoratedName().
| QString PokemonBoxSelectModel::curBoxSym = "▷" |
Decoration: current-box marker (points at the label). Fill status is conveyed by the (N/Max) count.
Definition at line 51 of file pokemonboxselectmodel.h.
Referenced by getDecoratedName().
| PokemonStorageModel* PokemonBoxSelectModel::pairedModel = nullptr |
The storage model this selector drives (see note).
Definition at line 81 of file pokemonboxselectmodel.h.
Referenced by data(), PokemonBoxSelectModel(), and setData().
| PlayerPokemon* PokemonBoxSelectModel::party = nullptr |
The party (box 0).
Definition at line 83 of file pokemonboxselectmodel.h.
Referenced by getDecoratedName(), and PokemonBoxSelectModel().
| Storage* PokemonBoxSelectModel::storage = nullptr |
The PC storage (for fill status).
Definition at line 82 of file pokemonboxselectmodel.h.
Referenced by data(), getDecoratedName(), and PokemonBoxSelectModel().