19#include <QAbstractListModel>
46 void hasCheckedChanged();
47 void hasCheckedChangedCached();
63 virtual int rowCount(
const QModelIndex& parent)
const override;
64 virtual QVariant
data(
const QModelIndex& index,
int role)
const override;
65 virtual QHash<int, QByteArray>
roleNames()
const override;
66 bool setData(
const QModelIndex &index,
const QVariant &value,
67 int role = Qt::EditRole)
override;
72 void onMove(
int from,
int to);
97 Q_INVOKABLE
void dragReorder(
int fromIndex,
int toIndex,
bool group);
101 Q_INVOKABLE
void dragTransfer(
int fromIndex,
int toIndex,
bool group);
105 Q_INVOKABLE
void deleteItem(
int index,
bool group);
A container of Items – either the trainer's bag or a PC item box.
static constexpr const char * isCheckedKey
QML attached-property name for the per-row checkbox.
void onReset()
React to a box reset.
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Edit a row (e.g. checkbox).
void clearCheckedStateGone()
Clear checked state for removed rows.
bool checkedStateDirty
Whether the checked-state cache needs refresh.
void onMove(int from, int to)
React to a box move.
QVector< Item * > getChecked()
The currently-checked items.
virtual int rowCount(const QModelIndex &parent) const override
Row count.
void checkedMoveToBottom()
Move checked rows to the bottom.
virtual QVariant data(const QModelIndex &index, int role) const override
Row+role value.
void clearCheckedState()
Uncheck everything.
void checkedTransfer()
Transfer checked rows to the paired box.
ItemStorageBox * items
The wrapped item box.
void onBeforeRelocate(Item *item)
Cleanup hook before an item relocates away.
ItemStorageModel(ItemStorageBox *items, Router *router)
bool hasChecked()
Are any rows checked (live)?
void checkedMoveToTop()
Move checked rows to the top.
void pageClosing()
Hook for when the page closes.
QVariant getPlaceHolderData(int role) const
The "empty slot" placeholder row's data.
void deleteItem(int index, bool group)
Delete the item at index, or – when group – the whole checked set (the per-row hover/checked delete b...
void onRemove(int ind)
React to a box removal.
void dragReorder(int fromIndex, int toIndex, bool group)
Reorder within this box: move fromIndex (or the checked set) to toIndex.
BagItemRoles
Columns (mapped in roleNames()).
void checkedToggleAll()
Toggle all checkboxes.
bool hasCheckedCached()
Cached form (backs the property).
void checkedMoveUp()
Move checked rows up one.
virtual QHash< int, QByteArray > roleNames() const override
Role -> QML name.
void onInsert()
React to a box insert.
void checkedDelete()
Delete checked rows.
void dragTransfer(int fromIndex, int toIndex, bool group)
Move fromIndex (or the checked set) from this box into the paired box, inserting at toIndex there.
Router * router
For page hooks.
ItemStorageModel * otherModel
The paired sibling model (for cross-pane transfers).
void checkedMoveDown()
Move checked rows down one.
void checkStateDirty()
Mark the checked-state cache stale.
One inventory slot: an item index and an amount, with live pricing.
Screen navigation for the UI – the QML StackView's controller.