A list model storing a list of sublayers. More...
Header: | #include <ArcGISSublayerListModel.h> |
Since: | Esri::ArcGISRuntime 100.0 |
Inherits: | QAbstractListModel and Esri::ArcGISRuntime::Iterable |
Public Types
enum | SublayerRoles { SublayerNameRole, SublayerIdRole, SublayerMinScaleRole, SublayerMaxScaleRole, SublayerTypeRole, …, SublayerLabelsEnabledRole } |
Public Functions
virtual | ~ArcGISSublayerListModel() override |
void | append(Esri::ArcGISRuntime::ArcGISSublayer *sublayer) |
void | clear() |
bool | contains(Esri::ArcGISRuntime::ArcGISSublayer *sublayer) const |
Esri::ArcGISRuntime::ArcGISSublayer * | first() const |
int | indexOf(Esri::ArcGISRuntime::ArcGISSublayer *sublayer) const |
void | insert(int index, Esri::ArcGISRuntime::ArcGISSublayer *sublayer) |
bool | isEmpty() const |
Esri::ArcGISRuntime::ArcGISSublayer * | last() const |
void | move(int from, int to) |
void | removeAt(int index) |
void | removeOne(Esri::ArcGISRuntime::ArcGISSublayer *sublayer) |
Reimplemented Public Functions
virtual Esri::ArcGISRuntime::ArcGISSublayer * | at(int index) const override |
virtual QVariant | data(const QModelIndex &index, int role = Qt::DisplayRole) const override |
virtual int | size() const override |
Signals
void | errorOccurred(const Esri::ArcGISRuntime::Error &error) |
void | itemAdded(int index) |
void | itemRemoved(int index) |
Detailed Description
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:
Role | Type | Description | SublayerRoles |
---|---|---|---|
name | QString | The sublayer's name. | SublayerNameRole |
sublayerVisible | bool | Whether the sublayer is enabled to be visible. | SublayerVisibleRole |
showInLegend | bool | Whether the sublayer will be shown in the legend. | SublayerShowInLegendRole |
sublayerId | int | The sublayer's ID. | SublayerIdRole |
minScale | double | The minumum scale at which the sublayer displays. | SublayerMinScaleRole |
maxScale | double | The maximum scale at which the sublayer displays. | SublayerMaxScaleRole |
sublayerType | ArcGISSublayerType | The sublayer's type. | SublayerTypeRole |
canChangeVisibility | bool | Whether the sublayer's visibility can be changed. | SublayerCanChangeVisibilityRole |
definitionExpression | QString | The sublayer's definition expression (since 100.1) | SublayerDefinitionExpressionRole |
sublayerOpacity | float | The sublayer's opacity (since 100.1) | SublayerOpacityRole |
scaleSymbols | bool | Whether the sublayer renderers its symbols based on scale (since 100.1) | SublayerScaleSymbolsRole |
labelsEnabled | bool | Whether the sublayer's labels are displayed (since 100.1) | SublayerLabelsEnabledRole |
Relevant samples:
- Change sublayer renderer: Apply a renderer to a sublayer.
- Change sublayer visibility: Change the visibility of sublayers.
Member Type Documentation
enum ArcGISSublayerListModel::SublayerRoles
This enum specifies the custom roles which can be used with ArcGISSublayerListModel::data.
Constant | Value | Description |
---|---|---|
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerNameRole | Qt::UserRole + 1 | The sublayer's name. |
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerIdRole | Qt::UserRole + 2 | The sublayer's ID. |
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerMinScaleRole | Qt::UserRole + 3 | The minumum scale at which the sublayer displays. |
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerMaxScaleRole | Qt::UserRole + 4 | The maximum scale at which the sublayer displays. |
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerTypeRole | Qt::UserRole + 5 | The sublayer's type. |
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerCanChangeVisibilityRole | Qt::UserRole + 6 | Whether the sublayer's visibility can be changed. |
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerVisibleRole | Qt::UserRole + 7 | Whether the sublayer is enabled to be visible. |
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerShowInLegendRole | Qt::UserRole + 8 | Whether the sublayer will be shown in the legend. |
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerDefinitionExpressionRole | Qt::UserRole + 9 | The sublayer's definition expression (since 100.1). |
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerOpacityRole | Qt::UserRole + 10 | The sublayer's opacity (since 100.1). |
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerScaleSymbolsRole | Qt::UserRole + 11 | Whether the sublayer renderers its symbols based on scale (since 100.1). |
Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerLabelsEnabledRole | Qt::UserRole + 12 | Whether the sublayer's labels are displayed (since 100.1). |
Member Function Documentation
[override virtual]
ArcGISSublayerListModel::~ArcGISSublayerListModel ()
Destructor.
void ArcGISSublayerListModel::append(Esri::ArcGISRuntime::ArcGISSublayer *sublayer)
Appends a sublayer to the sublayer list model.
[override virtual]
Esri::ArcGISRuntime::ArcGISSublayer *ArcGISSublayerListModel::at(int index) const
Returns the sublayer
at the specified index.
void ArcGISSublayerListModel::clear()
Removes all sublayers from the list model.
List models do not take ownership of the objects they contain. Therefore, removing or clearing objects from the list model will not delete those objects. An RAII technique should be used to ensure that memory is properly deallocated.
bool ArcGISSublayerListModel::contains(Esri::ArcGISRuntime::ArcGISSublayer *sublayer) const
Returns true
if the list model contains the specified sublayer.
[override virtual]
QVariant ArcGISSublayerListModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const
Reimplements: QAbstractItemModel::data(const QModelIndex &index, int role) const.
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 (const Esri::ArcGISRuntime::Error &error)
Signal emitted when an error occurs.
- error - Details about the error.
Esri::ArcGISRuntime::ArcGISSublayer *ArcGISSublayerListModel::first() const
Returns the first sublayer in the list model.
int ArcGISSublayerListModel::indexOf (Esri::ArcGISRuntime::ArcGISSublayer *sublayer) const
Returns the index of the sublayer specified.
void ArcGISSublayerListModel::insert(int index, Esri::ArcGISRuntime::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.
[signal, since Esri::ArcGISRuntime 100.15]
void ArcGISSublayerListModel::itemAdded (int index)
Signal emitted when an item is added to the list model.
index is the index of the added item.
This function was introduced in Esri::ArcGISRuntime 100.15.
[signal, since Esri::ArcGISRuntime 100.15]
void ArcGISSublayerListModel::itemRemoved (int index)
Signal emitted when an item is removed from the list model.
index is the index of the removed item.
This function was introduced in Esri::ArcGISRuntime 100.15.
Esri::ArcGISRuntime::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.
List models do not take ownership of the objects they contain. Therefore, removing or clearing objects from the list model will not delete those objects. An RAII technique should be used to ensure that memory is properly deallocated.
void ArcGISSublayerListModel::removeOne (Esri::ArcGISRuntime::ArcGISSublayer *sublayer)
Removes the specified sublayer from the list model.
List models do not take ownership of the objects they contain. Therefore, removing or clearing objects from the list model will not delete those objects. An RAII technique should be used to ensure that memory is properly deallocated.
[override virtual]
int ArcGISSublayerListModel::size() const
Returns the number of sublayers contained in the list model.