ViewSolutions
Loading...
Searching...
No Matches
ViewSolutions::BaseHashModel< KEY, DATA > Class Template Reference

The BaseHashModel class is base class of all GUI list models. More...

#include <basehashmodel.h>

Public Member Functions

 BaseHashModel (QObject *parent=nullptr)
 
int rowCount (const QModelIndex &parent) const override
 
QHash< int, QByteArray > roleNames () const override
 
QVariant data (const QModelIndex &index, int role) const override
 
virtual QVariant getByKey (const KEY &key)
 getByKey returns value by key
 
const QHash< KEY, DATA > & dateList () const
 
virtual void setByKey (const KEY &key, const DATA &data)
 setByKey update delegate by key
 
virtual void removeByKey (const KEY &key)
 
void setDataList (const QHash< KEY, DATA > &newData)
 setDataList sets new date of model, and reset all model;
 

Detailed Description

template<class KEY, class DATA>
class ViewSolutions::BaseHashModel< KEY, DATA >

The BaseHashModel class is base class of all GUI list models.

Template Parameters
KEY- is type of hash table key,
DATA- is main stored delegate model of all list items.

Conceptions and using rooles

  • All models should provides delegate models base of qobject
  • If model require fast solution just implement BaseListModel<int> model
Note
to access to delegate model use Qt::EditRole role: available in qml by delegateModel keyword example: :
class VariantListModel: public BaseHashModel<QVariant>
{
Q_OBJECT
public:
VariantListModel(QObject* ptr = nullptr): BaseListModel<QString, QVariant>(ptr){};
};
}
The BaseHashModel class is base class of all GUI list models.
The BaseListModel class is base class of all GUI list models.
The VariantListModel class is universal implementation for all atomic types.
The BaseHashModel is not support Qml space, to short access in qml use the BaseListModel

Definition at line 42 of file basehashmodel.h.

Inheritance diagram for ViewSolutions::BaseHashModel< KEY, DATA >:
Inheritance graph
Collaboration diagram for ViewSolutions::BaseHashModel< KEY, DATA >:
Collaboration graph

Constructor & Destructor Documentation

◆ BaseHashModel()

template<class KEY , class DATA >
ViewSolutions::BaseHashModel< KEY, DATA >::BaseHashModel ( QObject *  parent = nullptr)
inline

Definition at line 46 of file basehashmodel.h.

Member Function Documentation

◆ data()

template<class KEY , class DATA >
QVariant ViewSolutions::BaseHashModel< KEY, DATA >::data ( const QModelIndex &  index,
int  role 
) const
inlineoverride

Definition at line 60 of file basehashmodel.h.

Here is the caller graph for this function:

◆ dateList()

template<class KEY , class DATA >
const QHash< KEY, DATA > & ViewSolutions::BaseHashModel< KEY, DATA >::dateList ( ) const
inline

Definition at line 117 of file basehashmodel.h.

◆ getByKey()

template<class KEY , class DATA >
virtual QVariant ViewSolutions::BaseHashModel< KEY, DATA >::getByKey ( const KEY &  key)
inlinevirtual

getByKey returns value by key

Parameters
key
Returns

Definition at line 95 of file basehashmodel.h.

◆ removeByKey()

template<class KEY , class DATA >
virtual void ViewSolutions::BaseHashModel< KEY, DATA >::removeByKey ( const KEY &  key)
inlinevirtual

Definition at line 136 of file basehashmodel.h.

◆ roleNames()

template<class KEY , class DATA >
QHash< int, QByteArray > ViewSolutions::BaseHashModel< KEY, DATA >::roleNames ( ) const
inlineoverride

Definition at line 54 of file basehashmodel.h.

◆ rowCount()

template<class KEY , class DATA >
int ViewSolutions::BaseHashModel< KEY, DATA >::rowCount ( const QModelIndex &  parent) const
inlineoverride

Definition at line 50 of file basehashmodel.h.

◆ setByKey()

template<class KEY , class DATA >
virtual void ViewSolutions::BaseHashModel< KEY, DATA >::setByKey ( const KEY &  key,
const DATA &  data 
)
inlinevirtual

setByKey update delegate by key

Parameters
key
data

Definition at line 126 of file basehashmodel.h.

Here is the call graph for this function:

◆ setDataList()

template<class KEY , class DATA >
void ViewSolutions::BaseHashModel< KEY, DATA >::setDataList ( const QHash< KEY, DATA > &  newData)
inline

setDataList sets new date of model, and reset all model;

Parameters
newData

Definition at line 151 of file basehashmodel.h.


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