Page Contents

Topics

Classes

QLAttributeMapModel Class

#include <QLayers/qlattributemapmodel.h>

Inherits: QAbstractItemModel

Public Functions

QLAttributeMapModel(QObject* parent = nullptr)
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override
virtual QVariant data(const QModelIndex& index, int role) const override
virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override
virtual QModelIndex parent(const QModelIndex& index) const override
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override
void set_attributes(LAttributeMap attributes, const QStringList filter_paths)

Detailed Description

A QLAttributeMapModel is a QAbstractItemModel that implements an item model for LAttributeMap data.

The model uses QLAttributeMapItem objects to point to the attributes of the attribute map.

Member Function Documentation

QLAttributeMapModel(QObject* parent = nullptr)

Constructs an attribute map model.

int columnCount(const QModelIndex& parent = QModelIndex()) const

Virtual

Override

Returns 1 since attribute map data is not structured multidimensionally.

QVariant data(const QModelIndex& index, int role) const

Virtual

Override

Returns a QVariant containing data for the specified index.

The type of data returned depends on the specified Qt::ItemDataRole role. The following table describes the available roles and the data returned:

Role QVariant Data
Qt::DisplayRole QString name of LAttribute specified by index
Qt::UserRole Pointer to LAttribute specified by index

QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const

Virtual

Override

Returns the index of the item in the model specified by the given row, column and parent index.

QModelIndex parent(const QModelIndex& index) const

Virtual

Override

Returns the parent of the model item with the given index. If the item has no parent, a invalid QModelIndex is returned.

int rowCount(const QModelIndex& parent = QModelIndex()) const

Virtual

Override

Returns the number of rows under the given parent. When the parent is valid it means that rowCount() is returning the number of children of parent.

void set_attributes(LAttributeMap attributes, const QStringList filter_paths)

Sets the model attributes.

Initializes QLAttributeMapItem objects that point to the attributes.