Skip To Content ArcGIS for Developers Sign In Dashboard

LayerListModel QML Type

A list model storing a list of Layers available in a Map. More...

Import Statement: import Esri.ArcGISRuntime 100.9
Since: Esri.ArcGISRuntime 100.0

Properties

Signals

Methods

Detailed Description

Note: You cannot declare or create a component of this type in QML code.

Modifying this model (adding, removing, moving) will update the Layers available in the Map.

The model returns data for the following roles:

RoleTypeDescription
namestringThe layer's name.
descriptionstringThe layer's description.
layerVisibleboolWhether the layer is visible.
canChangeVisibilityboolWhether the layer's visibility can be changed.
loadErrorintThe layer's load error code.
loadStatusEnums.LoadStatusThe layer's load status.
layerTypeEnums.LayerTypeThe layer's type.
attributionstringThe layer's attribution if any is available.
showInLegendboolWhether the layer will be shown in the legend.
layerIdstringThe layer's ID specified in the web map JSON.
minScaledoubleThe minimum scale at which the layer displays.
maxScaledoubleThe maximum scale at which the layer displays.
layerOpacityrealThe opacity of the layer between 0.0 and 1.0.

Property Documentation

count : int

Returns the number of objects in the model (read-only).


error : Error

Returns the Error object (read-only).


Signal Documentation

countChanged()

Emitted when the count property of the model changes.

Note: The corresponding handler is onCountChanged.


errorChanged()

Emitted when the error property changes, which can indicate that an error occurred.

Note: The corresponding handler is onErrorChanged.


layerAdded(index)

Emitted when an object is added to the list model at the index specified in the parameter.

Note: The corresponding handler is onLayerAdded.


layerRemoved(index)

Emitted when an object is removed from the list model at the index specified in the parameter.

Note: The corresponding handler is onLayerRemoved.


Method Documentation

void append(layer)

Appends a layer to the layer list model.


void clear()

Removes all layers from the list model.


bool contains(layer)

Returns true if the list model contains the specified layer.


void forEach(callback)

Receives a callback function to execute for each layer in the model.

The callback function can take 0 to 3 optional arguments, in order:

  • element Current layer.
  • index Current index in array.
  • array Reference to LayerListModel.

Returns undefined if no error occurred, and an error message otherwise.

var error = layerListModel.forEach(function(element, index, array) {
    ...
});
if (error) {
    console.error(error.message);
}

Layer get(index)

Returns the Layer at the specified index.


int indexOf(layer)

Returns the index of a specific layer (layer) from the list model.

This method was introduced in Esri::ArcGISRuntime 100.5..


void insert(index, Layer layer)

Inserts a layer at a specified index in the list.


void move(from, int to)

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


void remove(index, int count = 1)

Removes one or more objects starting at the specified index.

  • index Index of first object to remove.
  • count Number of objects to remove. This parameter defaults to 1.

void removeOne(layer)

Removes the specified layer (layer) from the list model.

This method was introduced in Esri::ArcGISRuntime 100.5..


void setProperty(index, string property, variant value)

Changes the property of the layer at index in the list model to value.



Feedback on this topic?