|
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
|
The "cart" view of ItemMarketModel – only the rows actually on the cart. More...
#include <itemmarketcartmodel.h>
Public Member Functions | |
| ItemMarketCartModel (ItemMarketModel *source, QObject *parent=nullptr) | |
Protected Member Functions | |
| bool | filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override |
| Accept a source row only when it's on the cart and isn't a section header. | |
The "cart" view of ItemMarketModel – only the rows actually on the cart.
A thin filter proxy over the full market model that keeps just the rows the user has put on the cart (cartCount > 0) and drops the section-header ("msg") rows. It inherits the source's role names verbatim, so a QML delegate reads exactly the same data* roles (dataName, dataCartCount, dataItemWorth, dataCartWorth, dataWhichType). Exposed as brg.marketCartModel; it backs the Pokemart screen's right-hand receipt pane, which itemizes the cart instead of summing it.
It re-filters live: the source emits per-row dataChanged on a cart edit (setData) plus a model-wide dataChanged on every recompute (onReUpdateValues), and resets on a mode/save change – with dynamicSortFilter on, rows appear/leave the receipt as their cart count crosses zero. The model-wide totals (total, leftover, space/money checks) stay on ItemMarketModel; the receipt reads those directly.
Definition at line 39 of file itemmarketcartmodel.h.
|
explicit |
Definition at line 25 of file itemmarketcartmodel.cpp.
|
overrideprotected |
Accept a source row only when it's on the cart and isn't a section header.
Definition at line 37 of file itemmarketcartmodel.cpp.
References ItemMarketModel::CartCountRole, and ItemMarketModel::WhichTypeRole.