Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
ItemMarketCartModel Class Reference

The "cart" view of ItemMarketModel – only the rows actually on the cart. More...

#include <itemmarketcartmodel.h>

Inheritance diagram for ItemMarketCartModel:
Collaboration diagram for ItemMarketCartModel:

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.

Detailed Description

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.

See also
ItemMarketModel.

Definition at line 39 of file itemmarketcartmodel.h.

Constructor & Destructor Documentation

◆ ItemMarketCartModel()

ItemMarketCartModel::ItemMarketCartModel ( ItemMarketModel * source,
QObject * parent = nullptr )
explicit

Definition at line 25 of file itemmarketcartmodel.cpp.

Member Function Documentation

◆ filterAcceptsRow()

bool ItemMarketCartModel::filterAcceptsRow ( int sourceRow,
const QModelIndex & sourceParent ) const
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.


The documentation for this class was generated from the following files: