Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QRangeModel::ItemAccess< T > Class Template Reference

\inmodule QtCore More...

#include <qrangemodel.h>

Inheritance diagram for QRangeModel::ItemAccess< T >:
Collaboration diagram for QRangeModel::ItemAccess< T >:

Detailed Description

template<typename T>
class QRangeModel::ItemAccess< T >

\inmodule QtCore

The ItemAccess template provides a customization point to control how QRangeModel accesses role data of individual items.

Since
6.11

ItemAccess<T> is a struct template where T specifies the item type. Specialize this template for the type used in your data structure, and implement {readRole()} and (optionally since 6.12) {writeRole()} members to access the role-specific data of your type.

template <>
struct QRangeModel::ItemAccess<ItemType>
{
static QVariant readRole(const ItemType &item, int role)
{
switch (role) {
// ...
}
return {};
}
static bool writeRole(ItemType &item, const QVariant &data, int role)
{
bool ok = false;
switch (role) {
// ...
}
return ok;
}
};
\inmodule QtCore
Definition qvariant.h:68
static bool ok(QGradientStop stop)
Definition qbrush.cpp:1682
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
[0]
\inmodule QtCore
Definition qrangemodel.h:41

Optionally [since 6.12], a {flags()} implementation can return a combination of Qt::ItemFlags:

static Qt::ItemFlags flags(const ItemType &item)
{
return item.flags();
}
GLbitfield flags

A specialization of this type will take precedence over any predefined behavior. Do not specialize this template for types you do not own. Types for which ItemAccess is specialized with a {readRole} implementation are implicitly interpreted as \l{RowCategory}{multi-role items}.

Definition at line 41 of file qrangemodel.h.


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