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

Item picker model (select-model variant; see SpeciesSelectModel). More...

#include <itemselectmodel.h>

Inheritance diagram for ItemSelectModel:
Collaboration diagram for ItemSelectModel:

Public Types

enum  ItemRoles { IndRole = Qt::UserRole + 1 , NameRole , InfoRole }
 Picker columns (mapped in roleNames()). More...

Public Member Functions

 ItemSelectModel ()
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.
int itemToListIndex (int ind)
 Row index for item ind.
QString infoForInd (int ind) const
 Detailed-tooltip text for item ind (empty if none).

Public Attributes

QVector< ItemSelectEntryData * > itemListCache
 Cached picker rows.

Detailed Description

Item picker model (select-model variant; see SpeciesSelectModel).

Standard picker: cached rows + itemToListIndex() for combo highlighting. Exposed as brg.itemSelectModel.

Definition at line 38 of file itemselectmodel.h.

Member Enumeration Documentation

◆ ItemRoles

Picker columns (mapped in roleNames()).

Enumerator
IndRole 
NameRole 
InfoRole 

Definition at line 44 of file itemselectmodel.h.

Constructor & Destructor Documentation

◆ ItemSelectModel()

ItemSelectModel::ItemSelectModel ( )

Definition at line 34 of file itemselectmodel.cpp.

References ItemsDB::inst(), and itemListCache.

Member Function Documentation

◆ data()

QVariant ItemSelectModel::data ( const QModelIndex & index,
int role ) const
overridevirtual

Row+role value.

Definition at line 120 of file itemselectmodel.cpp.

References IndRole, infoForInd(), InfoRole, itemListCache, and NameRole.

◆ infoForInd()

QString ItemSelectModel::infoForInd ( int ind) const

Detailed-tooltip text for item ind (empty if none).

Definition at line 158 of file itemselectmodel.cpp.

References ItemsDB::getIndAt(), ItemDBEntry::getInfo(), and ItemsDB::inst().

Referenced by data().

◆ itemToListIndex()

int ItemSelectModel::itemToListIndex ( int ind)

Row index for item ind.

Definition at line 166 of file itemselectmodel.cpp.

References itemListCache.

◆ roleNames()

QHash< int, QByteArray > ItemSelectModel::roleNames ( ) const
overridevirtual

Role -> QML name.

Definition at line 147 of file itemselectmodel.cpp.

References IndRole, InfoRole, and NameRole.

◆ rowCount()

int ItemSelectModel::rowCount ( const QModelIndex & parent) const
overridevirtual

Row count.

Definition at line 111 of file itemselectmodel.cpp.

References itemListCache.

Member Data Documentation

◆ itemListCache

QVector<ItemSelectEntryData*> ItemSelectModel::itemListCache

Cached picker rows.

Definition at line 56 of file itemselectmodel.h.

Referenced by data(), ItemSelectModel(), itemToListIndex(), and rowCount().


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