A list model storing a list of layers available in a map. More...
|  Header |  #include <Layer | 
|  Since |  Esri | 
|  Inherits |  QAbstract | 
This class was introduced in Esri::ArcGISRuntime 100.0.
Public Types
| enum | Layer | 
Public Functions
| virtual | ~ | 
| void | append( | 
| void | clear() | 
| bool | contains( | 
|  Esri | first() const | 
| int | index | 
| void | insert(int index, Esri | 
| bool | is | 
|  Esri | last() const | 
| void | move(int from, int to) | 
| void | remove | 
| void | remove | 
Reimplemented Public Functions
|  virtual Esri | at(int index) const override | 
| virtual QVariant | data(const QModel | 
| virtual int | size() const override | 
Signals
| void | error | 
| void | item | 
| void | item | 
Detailed Description
Modifying this model (adding, removing, moving) will update the layers available in the map.
The model returns data for the following roles:
| Role | Type | Description | 
|---|---|---|
| name | QString | The layer's name. | 
| description | QString | The layer's description. | 
| layer | bool | Whether the layer is visible. | 
| can | bool | Whether the layer's visibility can be changed. | 
| load | Error | The layer's load error type. | 
| load | Load | The layer's load status. | 
| layer | Layer | The layer's type. | 
| attribution | QString | The layer's attribution if any is available. | 
| show | bool | Whether the layer will be shown in the legend. | 
| layer | QString | The layer's I | 
| min | double | The minimum scale at which the layer displays. | 
| max | double | The maximum scale at which the layer displays. | 
| layer | float | The opacity of the layer between 0.0 and 1.0. | 
Map *map = new Map(BasemapType::NationalGeographic, -117, 34, 15, this); ServiceFeatureTable *featureTable = new ServiceFeatureTable(featureServiceUrl, this); FeatureLayer *featureLayer = new FeatureLayer(featureTable, this); LayerListModel* llModel = map->operationalLayers(); llModel->insert(1,featureLayer);
Member Type Documentation
enum LayerListModel::LayerRoles    
This enum specifies the custom roles which can be used with LayerListModel::data.
| Constant | Value | Description | 
|---|---|---|
Esri | Qt | The layer's name. | 
Esri | Qt | The layer's description. | 
Esri | Qt | Whether the layer is visible. | 
Esri | Qt | Whether the layer's visibility can be changed. | 
Esri | Qt | The layer's load error type. Deprecated | 
Esri | Qt | The layer's load status. | 
Esri | Qt | The layer's type. | 
Esri | Qt | The layer's attribution if any is available. | 
Esri | Qt | Whether the layer will be shown in the legend. | 
Esri | Qt | The layer's I | 
Esri | Qt | The minimum scale at which the layer displays. | 
Esri | Qt | The maximum scale at which the layer displays. | 
Esri | Qt | The opacity of the layer between 0.0 and 1.0. | 
Member Function Documentation
[signal] void LayerListModel::errorOccurred (Esri::ArcGISRuntime::Error    error)   
Signal emitted when an error occurs.
- error - Details about the error.
 
[signal] void LayerListModel::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] void LayerListModel::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.
[override virtual] LayerListModel::~LayerListModel   ()   
Destructor.
void LayerListModel::append(Esri::ArcGISRuntime::Layer    *layer)   
Appends a layer to the layer list model.
[override virtual] Esri::ArcGISRuntime::Layer    *LayerListModel::at(int index) const    
Returns the Layer at the specified index.
void LayerListModel::clear()   
Removes all layers 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 LayerListModel::contains(Esri::ArcGISRuntime::Layer    *layer) const   
Returns true if the list model contains the specified layer.
[override virtual] QVariant LayerListModel::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 layer referred to by the index.
- index. The index in the model for which to return data.
 - role. The role for which to return data.
 
Esri::ArcGISRuntime::Layer    *LayerListModel::first() const    
Returns the first layer in the list model.
int LayerListModel::indexOf (Esri::ArcGISRuntime::Layer    *layer) const   
Returns the index of the layer specified.
void LayerListModel::insert(int index, Esri::ArcGISRuntime::Layer    *layer)   
Inserts a layer at a specified index in the list model.
This method will append to the list if the index is greater than the current size of the list model.
bool LayerListModel::isEmpty () const   
Returns true if the list model contains no layers.
Esri::ArcGISRuntime::Layer    *LayerListModel::last() const    
Returns the last layer in the list model.
void LayerListModel::move(int from, int to)   
Moves one layer from an index in the list model to a different index.
void LayerListModel::removeAt (int index)   
Removes a layer 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 LayerListModel::removeOne (Esri::ArcGISRuntime::Layer    *layer)   
Removes the specified layer 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 LayerListModel::size() const   
Returns the number of layers contained in the list model.