Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGISSublayerListModel Class

(Esri::ArcGISRuntime::ArcGISSublayerListModel)

A list model storing a list of sublayers. More...

Header: #include <ArcGISSublayerListModel>
Since: Esri::ArcGISRuntime 100.0
Inherits: QAbstractListModel and Iterable<ArcGISSublayer *>

Public Types

enum SublayerRoles { SublayerNameRole, SublayerIdRole, SublayerMinScaleRole, SublayerMaxScaleRole, ..., SublayerLabelsEnabledRole }

Public Functions

~ArcGISSublayerListModel()
void append(ArcGISSublayer *sublayer)
ArcGISSublayer *at(int index) const
void clear()
bool contains(ArcGISSublayer *sublayer) const
ArcGISSublayer *first() const
int indexOf(ArcGISSublayer *sublayer) const
void insert(int index, ArcGISSublayer *sublayer)
bool isEmpty() const
ArcGISSublayer *last() const
void move(int from, int to)
void removeAt(int index)
void removeOne(ArcGISSublayer *sublayer)
int size() const

Reimplemented Public Functions

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

Signals

void errorOccurred(Esri::ArcGISRuntime::Error error)
void sublayerAdded(int index)
void sublayerRemoved(int index)

Additional Inherited Members

Detailed Description

A list model storing a list of sublayers.

Modifying this model (adding, removing, moving) results in updates to any objects that are currently referencing these sublayers.

The model returns data for the following roles:

RoleTypeDescriptionSublayerRoles
nameQStringThe sublayer's name.SublayerNameRole
sublayerVisibleboolWhether the sublayer is enabled to be visible.SublayerVisibleRole
showInLegendboolWhether the sublayer will be shown in the legend.SublayerShowInLegendRole
sublayerIdintThe sublayer's ID.SublayerIdRole
minScaledoubleThe minumum scale at which the sublayer displays.SublayerMinScaleRole
maxScaledoubleThe maximum scale at which the sublayer displays.SublayerMaxScaleRole
sublayerTypeArcGISSublayerTypeThe sublayer's type.SublayerTypeRole
canChangeVisibilityboolWhether the sublayer's visibility can be changed.SublayerCanChangeVisibilityRole
definitionExpressionQStringThe sublayer's definition expression (since 100.1)SublayerDefinitionExpressionRole
sublayerOpacityfloatThe sublayer's opacity (since 100.1)SublayerOpacityRole
scaleSymbolsboolWhether the sublayer renderers its symbols based on scale (since 100.1)SublayerScaleSymbolsRole
labelsEnabledboolWhether the sublayer's labels are displayed (since 100.1)SublayerLabelsEnabledRole

Member Type Documentation

enum ArcGISSublayerListModel::SublayerRoles

This enum specifies the custom roles which can be used with ArcGISSublayerListModel::data.

ConstantValueDescription
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerNameRoleQt::UserRole + 1The sublayer's name.
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerIdRoleQt::UserRole + 2The sublayer's ID.
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerMinScaleRoleQt::UserRole + 3The minumum scale at which the sublayer displays.
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerMaxScaleRoleQt::UserRole + 4The maximum scale at which the sublayer displays.
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerTypeRoleQt::UserRole + 5The sublayer's type.
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerCanChangeVisibilityRoleQt::UserRole + 6Whether the sublayer's visibility can be changed.
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerVisibleRoleQt::UserRole + 7Whether the sublayer is enabled to be visible.
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerShowInLegendRoleQt::UserRole + 8Whether the sublayer will be shown in the legend.
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerDefinitionExpressionRoleQt::UserRole + 9The sublayer's definition expression (since 100.1).
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerOpacityRoleQt::UserRole + 10The sublayer's opacity (since 100.1).
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerScaleSymbolsRoleQt::UserRole + 11Whether the sublayer renderers its symbols based on scale (since 100.1).
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerLabelsEnabledRoleQt::UserRole + 12Whether the sublayer's labels are displayed (since 100.1).

Member Function Documentation

ArcGISSublayerListModel::~ArcGISSublayerListModel()

Destructor.

void ArcGISSublayerListModel::append(ArcGISSublayer *sublayer)

Appends a sublayer to the sublayer list model.

ArcGISSublayer *ArcGISSublayerListModel::at(int index) const

Returns the sublayer at the specified index.

void ArcGISSublayerListModel::clear()

Removes all sublayers from the list model.

bool ArcGISSublayerListModel::contains(ArcGISSublayer *sublayer) const

Returns true if the list model contains the specified sublayer.

[virtual] QVariant ArcGISSublayerListModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const

Reimplemented from QAbstractItemModel::data().

Returns the data stored under the given role for the sublayer referred to by the index.

  • index. The index in the model for which to return data.
  • role. The role for which to return data.

[signal] void ArcGISSublayerListModel::errorOccurred(Esri::ArcGISRuntime::Error error)

Signal emitted when an error occurs.

  • error - Details about the error.

ArcGISSublayer *ArcGISSublayerListModel::first() const

Returns the first sublayer in the list model.

int ArcGISSublayerListModel::indexOf(ArcGISSublayer *sublayer) const

Returns the index of the sublayer specified.

void ArcGISSublayerListModel::insert(int index, ArcGISSublayer *sublayer)

Inserts a sublayer at a specified index in the list model.

This method will append to the list model if the index is greater than the current size of the list.

bool ArcGISSublayerListModel::isEmpty() const

Returns true if the list model contains no sublayers.

ArcGISSublayer *ArcGISSublayerListModel::last() const

Returns the last sublayer in the list model.

void ArcGISSublayerListModel::move(int from, int to)

Moves one sublayer from an index in the list model to a different index.

void ArcGISSublayerListModel::removeAt(int index)

Removes a sublayer at the specified index.

void ArcGISSublayerListModel::removeOne(ArcGISSublayer *sublayer)

Removes the specified sublayer from the list model.

int ArcGISSublayerListModel::size() const

Returns the number of sublayers contained in the list model.

[signal] void ArcGISSublayerListModel::sublayerAdded(int index)

Signal emitted when a sublayer is added to the list model.

index is the index of the added sublayer.

[signal] void ArcGISSublayerListModel::sublayerRemoved(int index)

Signal emitted when a sublayer is removed from the list model.

index is the index of the removed sublayer.


Feedback on this topic?