Skip to content

Class ValueMapModelBase

ClassList > ValueMapModelBase

More...

  • #include <valuemapmodelbase.h>

Inherits the following classes: QAbstractListModel

Public Signals

Type Name
signal void mapChanged

Public Functions

Type Name
ValueMapModelBase (QObject * parent=nullptr)
QVariant data (const QModelIndex & index, int role=Qt::DisplayRole) override const
QVariant keyForValue (const QString & value) const
int keyToIndex (const QVariant & key) const
QVariant map () const
QHash< int, QByteArray > roleNames () override const
int rowCount (const QModelIndex & parent=QModelIndex()) override const
void setMap (const QVariant & map)

Detailed Description

A base model that manages the key/value pairs for a ValueMap widget.

Public Signals Documentation

signal mapChanged

void ValueMapModelBase::mapChanged;

Emitted when the map changes.


Public Functions Documentation

function ValueMapModelBase

explicit ValueMapModelBase::ValueMapModelBase (
    QObject * parent=nullptr
) 

Create a new value map model base


function data

QVariant ValueMapModelBase::data (
    const QModelIndex & index,
    int role=Qt::DisplayRole
) override const

function keyForValue

QVariant ValueMapModelBase::keyForValue (
    const QString & value
) const

Returns the key for a value or an invalid QVariant if not found.


function keyToIndex

int ValueMapModelBase::keyToIndex (
    const QVariant & key
) const

Returns the row (index) of a key or -1 if not found.


function map

QVariant ValueMapModelBase::map () const

The map, see the property description


function roleNames

QHash< int, QByteArray > ValueMapModelBase::roleNames () override const

function rowCount

int ValueMapModelBase::rowCount (
    const QModelIndex & parent=QModelIndex()
) override const

function setMap

void ValueMapModelBase::setMap (
    const QVariant & map
) 

The map, see the property description



The documentation for this class was generated from the following file src/core/valuemapmodelbase.h