GraphicListModel Class

  • GraphicListModel
  • class Esri::ArcGISRuntime::GraphicListModel

    A container class storing a list of graphics available in a GraphicsOverlay. More...

    Header: #include <GraphicListModel.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: QAbstractListModel and Esri::ArcGISRuntime::Iterable

    Public Types

    enum GraphicRoles { GraphicSelectedRole, GraphicVisibleRole, GraphicZIndexRole, GraphicAttributesRole }

    Public Functions

    virtual ~GraphicListModel() override
    void append(Esri::ArcGISRuntime::Graphic *graphic)
    void append(const QList<Esri::ArcGISRuntime::Graphic *> &graphics)
    void clear()
    bool contains(Esri::ArcGISRuntime::Graphic *graphic) const
    Esri::ArcGISRuntime::Graphic *first() const
    int indexOf(Esri::ArcGISRuntime::Graphic *graphic) const
    void insert(int index, Esri::ArcGISRuntime::Graphic *graphic)
    bool isEmpty() const
    Esri::ArcGISRuntime::Graphic *last() const
    void move(int from, int to)
    void removeAt(int index)
    void removeOne(Esri::ArcGISRuntime::Graphic *graphic)

    Reimplemented Public Functions

    virtual Esri::ArcGISRuntime::Graphic *at(int index) const override
    virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
    virtual int size() const override

    Signals

    void itemAdded(int index)
    void itemRemoved(int index)

    Detailed Description

    Modifying this collection (adding, removing, moving) will update the graphics available in a GraphicsOverlay. Moving a graphic's position in the list model does not affect drawing order. To change drawing order, use the Graphic::zIndex property on each Graphic.

    The model returns data for the following roles:

    RoleTypeDescriptionGraphicRoles
    selectedboolWhether the graphic is selected.GraphicSelectedRole
    graphicVisibleboolWhether the graphic is visible.GraphicVisibleRole
    zIndexintThe z index of the graphic.GraphicZIndexRole
    attributesQVariantMapThe attributes of the graphic.GraphicAttributesRole

    See also GraphicsOverlay and Graphic.

    Member Type Documentation

    enum GraphicListModel::GraphicRoles

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

    ConstantValueDescription
    Esri::ArcGISRuntime::GraphicListModel::GraphicSelectedRoleQt::UserRole + 1Whether the graphic is selected.
    Esri::ArcGISRuntime::GraphicListModel::GraphicVisibleRoleQt::UserRole + 2Whether the graphic is visible.
    Esri::ArcGISRuntime::GraphicListModel::GraphicZIndexRoleQt::UserRole + 3The z index of the graphic.
    Esri::ArcGISRuntime::GraphicListModel::GraphicAttributesRoleQt::UserRole + 4The attributes of the graphic.

    Member Function Documentation

    [override virtual] GraphicListModel::~GraphicListModel()

    Destructor.

    void GraphicListModel::append(Esri::ArcGISRuntime::Graphic *graphic)

    Appends the graphic to the graphic list model.

    void GraphicListModel::append(const QList<Esri::ArcGISRuntime::Graphic *> &graphics)

    Appends graphics to the graphic list model.

    [override virtual] Esri::ArcGISRuntime::Graphic *GraphicListModel::at(int index) const

    Returns the graphic at the specified index.

    void GraphicListModel::clear()

    Removes all graphics 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 GraphicListModel::contains(Esri::ArcGISRuntime::Graphic *graphic) const

    Returns true if the provided graphic is in the list model.

    [override virtual] QVariant GraphicListModel::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 graphic 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::Graphic *GraphicListModel::first() const

    Returns the first graphic in the list model.

    int GraphicListModel::indexOf(Esri::ArcGISRuntime::Graphic *graphic) const

    Returns the index of the provided graphic in the list model.

    void GraphicListModel::insert(int index, Esri::ArcGISRuntime::Graphic *graphic)

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

    bool GraphicListModel::isEmpty() const

    Returns true if this list model is empty.

    [signal, since Esri::ArcGISRuntime 100.15] void GraphicListModel::itemAdded(int index)

    Signal emitted when an item is added to the list.

    index is the index of the added item.

    This function was introduced in Esri::ArcGISRuntime 100.15.

    [signal, since Esri::ArcGISRuntime 100.15] void GraphicListModel::itemRemoved(int index)

    Signal emitted when an item is removed from the list.

    index is the index of the removed item.

    This function was introduced in Esri::ArcGISRuntime 100.15.

    Esri::ArcGISRuntime::Graphic *GraphicListModel::last() const

    Returns the last graphic in the list model.

    void GraphicListModel::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, use the Graphic::zIndex property on each Graphic.

    void GraphicListModel::removeAt(int index)

    Removes a graphic at the specified index in 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.

    void GraphicListModel::removeOne(Esri::ArcGISRuntime::Graphic *graphic)

    Removes the specified graphic 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 GraphicListModel::size() const

    Returns the number of graphics in the model.

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