NDEVR
API Documentation
LayerModel

Used for showing Layers in a table using the QAbstractItemModel interface. More...

Collaboration diagram for LayerModel:
[legend]

Public Member Functions

 LayerModel (QTModelManager *manager)
 Constructs a LayerModel backed by the given model manager.
QVector< int > cacheObject (UUID id)
 Updates the cached display data for the given layer and returns changed roles.
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 Returns the number of columns for the given parent.
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 Returns the display data for the given index and role.
bool hasChildren (const QModelIndex &parent=QModelIndex()) const override
 Returns whether the given parent has any children.
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 Returns the model index for the given row, column, and parent.
const Buffer< UUID > & layers () const
 Returns the list of layer UUIDs managed by this model.
QTModelManagermanager () const
 Returns the model manager backing this layer model.
QModelIndex parent (const QModelIndex &child) const override
 Returns the parent index of the given child index.
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 Returns the number of rows under the given parent.
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 Sets data for the given index and role.

Protected Member Functions

void layerAddedSlot (Buffer< UUID > layer)
 Slot called when new layers are added to the scene.
void layerUpdatedSlot (Buffer< UUID > objects)
 Slot called when existing layers are updated.
void onClearAllSlot ()
 Slot called when all layers are cleared from the scene.

Protected Attributes

Dictionary< UUID, LayerCacheObjectm_layer_cache
 Cached display data for each layer.
Buffer< UUIDm_layers
 The list of layer UUIDs in this model.
QTModelManagerm_manager
 The model manager providing layer data.

Detailed Description

Used for showing Layers in a table using the QAbstractItemModel interface.


Definition at line 22 of file LayerCombo.h.

Constructor & Destructor Documentation

◆ LayerModel()

LayerModel::LayerModel ( QTModelManager * manager)

Constructs a LayerModel backed by the given model manager.

Parameters
[in]managerThe model manager providing layer data.

References manager().

Member Function Documentation

◆ cacheObject()

QVector< int > LayerModel::cacheObject ( UUID id)

Updates the cached display data for the given layer and returns changed roles.

Parameters
[in]idThe UUID of the layer to re-cache.
Returns
A vector of Qt item data roles that changed.

◆ columnCount()

int LayerModel::columnCount ( const QModelIndex & parent = QModelIndex()) const
override

Returns the number of columns for the given parent.

Parameters
[in]parentThe parent model index.
Returns
The number of columns.

References parent().

◆ data()

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

Returns the display data for the given index and role.

Parameters
[in]indexThe model index to query.
[in]roleThe Qt item data role.
Returns
The data as a QVariant.

References index().

◆ hasChildren()

bool LayerModel::hasChildren ( const QModelIndex & parent = QModelIndex()) const
override

Returns whether the given parent has any children.

Parameters
[in]parentThe parent model index.
Returns
True if the parent has child rows.

References parent().

◆ index()

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

Returns the model index for the given row, column, and parent.

Parameters
[in]rowThe row index.
[in]columnThe column index.
[in]parentThe parent model index.
Returns
The QModelIndex for the specified cell.

References parent().

Referenced by data(), and setData().

◆ layerAddedSlot()

void LayerModel::layerAddedSlot ( Buffer< UUID > layer)
protected

Slot called when new layers are added to the scene.

Parameters
[in]layerThe UUIDs of the newly added layers.

◆ layers()

const Buffer< UUID > & LayerModel::layers ( ) const
inline

Returns the list of layer UUIDs managed by this model.

Returns
A reference to the buffer of layer UUIDs.

Definition at line 73 of file LayerCombo.h.

References m_layers.

◆ layerUpdatedSlot()

void LayerModel::layerUpdatedSlot ( Buffer< UUID > objects)
protected

Slot called when existing layers are updated.

Parameters
[in]objectsThe UUIDs of the updated layers.

◆ manager()

QTModelManager * LayerModel::manager ( ) const
inline

Returns the model manager backing this layer model.

Returns
A pointer to the QTModelManager.

Definition at line 85 of file LayerCombo.h.

References m_manager.

Referenced by LayerModel().

◆ parent()

QModelIndex LayerModel::parent ( const QModelIndex & child) const
override

Returns the parent index of the given child index.

Parameters
[in]childThe child model index.
Returns
The parent QModelIndex.

Referenced by columnCount(), hasChildren(), index(), and rowCount().

◆ rowCount()

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

Returns the number of rows under the given parent.

Parameters
[in]parentThe parent model index.
Returns
The number of child rows.

References parent().

◆ setData()

bool LayerModel::setData ( const QModelIndex & index,
const QVariant & value,
int role = Qt::EditRole )
override

Sets data for the given index and role.

Parameters
[in]indexThe model index to modify.
[in]valueThe new value to set.
[in]roleThe Qt item data role.
Returns
True if the data was successfully set.

References index().


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