|
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
|
Read-only "where are my items" overview for the Bag screen's View All pane. More...
#include <itemoverviewmodel.h>
Public Types | |
| enum | OverviewRoles { NameRole = Qt::UserRole + 1 , BagCountRole , StorageCountRole } |
| Columns (mapped in roleNames()). More... | |
Public Member Functions | |
| ItemOverviewModel (ItemStorageBox *bag, ItemStorageBox *storage) | |
| 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. | |
| void | rebuild () |
| Re-aggregate both boxes (full model reset). Wired to itemsChanged. | |
Read-only "where are my items" overview for the Bag screen's View All pane.
Aggregates the player's two item boxes (bag + PC storage) into one alphabetized table: each distinct item the save holds becomes a row carrying its display name plus the total amount in the bag and the total amount in storage (summed across any duplicate rows – the editor supports same-item duplicates). Rows with a zero total on BOTH sides are dropped; a side that's zero is surfaced as 0 so the view can hide just that number. Rebuilds (full reset) whenever either box changes, so the pane stays live while the user edits. Exposed as brg.itemOverviewModel.
Definition at line 37 of file itemoverviewmodel.h.
Columns (mapped in roleNames()).
| Enumerator | |
|---|---|
| NameRole | Display name. |
| BagCountRole | Total amount in the bag (0 if none). |
| StorageCountRole | Total amount in PC storage (0 if none). |
Definition at line 43 of file itemoverviewmodel.h.
| ItemOverviewModel::ItemOverviewModel | ( | ItemStorageBox * | bag, |
| ItemStorageBox * | storage ) |
| bag | the player's bag box; |
| storage | the PC item box. |
Definition at line 32 of file itemoverviewmodel.cpp.
References ItemStorageBox::itemsChanged(), and rebuild().
|
overridevirtual |
Row+role value.
Definition at line 49 of file itemoverviewmodel.cpp.
References BagCountRole, NameRole, and StorageCountRole.
| void ItemOverviewModel::rebuild | ( | ) |
Re-aggregate both boxes (full model reset). Wired to itemsChanged.
Definition at line 75 of file itemoverviewmodel.cpp.
References ItemStorageBox::items.
Referenced by ItemOverviewModel().
|
overridevirtual |
Role -> QML name.
Definition at line 66 of file itemoverviewmodel.cpp.
References BagCountRole, NameRole, and StorageCountRole.
|
overridevirtual |
Row count.
Definition at line 43 of file itemoverviewmodel.cpp.