;

GraphicListModel QML Type

A list model storing a list of graphics available in a GraphicsOverlay. More...

Import Statement: import Esri.ArcGISRuntime 100.12
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 graphics available in the GraphicsOverlay. Moving a graphic's position in the list model does not affect drawing order. To change drawing order for a graphic, set the zIndex property on the Graphic.

The model returns data for the following roles:

RoleTypeDescription
selectedboolWhether the graphic is selected.
graphicVisibleboolWhether the graphic is visible.
zIndexintThe z index of the graphic.
attributesAttributeListModelThe attributes of the graphic as an AttributeListModel.

Property Documentation

count : int

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


Signal Documentation

countChanged()

Emitted when the count property of the model changes.

Note: The corresponding handler is onCountChanged.


graphicAdded(int index)

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

Note: The corresponding handler is onGraphicAdded.


graphicRemoved(int index)

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

Note: The corresponding handler is onGraphicRemoved.


Method Documentation

void append(Graphic graphic)

Appends a graphic to the graphic list model.


void appendAll(list<Graphic> graphics)

Appends a graphics to the graphic list model.


void clear()

Removes all Graphics from the list model.


bool contains(Graphic graphic)

Returns true if the list model contains the specified graphic.


void forEach(callback)

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

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

  • element Current class break.
  • index Current index in array.
  • array Reference to GraphicListModel.

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

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

Graphic get(int index)

Returns the Graphic at the specified index.


int indexOf(Graphic graphic)

Returns the index of the graphic specified.

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


void insert(int index, Graphic graphic)

Inserts a graphic at a specified index in the list.


void move(int from, int to)

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

Moving a graphic's position in the list model does not affect drawing order. To change drawing order for a graphic, set the zIndex property on the Graphic.


void remove(int 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(Graphic graphic)

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

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


void setProperty(int index, string property, variant value)

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


Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.