LeechCraft  0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
LC::Util::RoleNamesMixin< Model > Class Template Reference

Wraps differences between role names handling in Qt4 and Qt5. More...

#include "rolenamesmixin.h"

+ Inheritance diagram for LC::Util::RoleNamesMixin< Model >:
+ Collaboration diagram for LC::Util::RoleNamesMixin< Model >:

Protected Member Functions

void setRoleNames (const QHash< int, QByteArray > &roleNames)
 Sets the role names to roleNames. More...
 
QHash< int, QByteArray > roleNames () const override
 Returns the role names. More...
 

Detailed Description

template<typename Model>
class LC::Util::RoleNamesMixin< Model >

Wraps differences between role names handling in Qt4 and Qt5.

Qt4 uses QAbstractItemModel::setRoleNames() to set role names for a (non-virtual) QAbstractItemModel::roleNames() method. Qt5, on the other hand, just suggests overriding the (virtual) roleNames() method. This class provides an uniform interface. This class provides an uniform interface for role names setting.

Template Parameters
ModelThe original model type to derive from.

Definition at line 30 of file rolenamesmixin.h.

Member Function Documentation

◆ roleNames()

template<typename Model>
QHash<int, QByteArray> LC::Util::RoleNamesMixin< Model >::roleNames ( ) const
inlineoverrideprotected

Returns the role names.

Returns the mapping from the role value to its name that was previously set via setRoleNames().

Returns
The mapping from role value to its name.
See also
setRoleNames()

Definition at line 56 of file rolenamesmixin.h.

Referenced by LC::Util::RoleNamesMixin< QStandardItemModel >::setRoleNames().

+ Here is the caller graph for this function:

◆ setRoleNames()

template<typename Model>
void LC::Util::RoleNamesMixin< Model >::setRoleNames ( const QHash< int, QByteArray > &  roleNames)
inlineprotected

Sets the role names to roleNames.

Parameters
[in]roleNamesThe mapping from role value to its name.
See also
roleNames()

Definition at line 42 of file rolenamesmixin.h.


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