ArcGISSublayerListModel Class

  • ArcGISSublayerListModel
  • class Esri::ArcGISRuntime::ArcGISSublayerListModel

    A list model storing a list of sublayers. More...

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

    This class was introduced in Esri::ArcGISRuntime 100.0.

    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(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:

    RoleTypeDescriptionSublayerRoles
    nameQStringThe sublayer's name.SublayerNameRole
    sublayerVisibleboolWhether the sublayer is enabled to be visible.SublayerVisibleRole
    showInLegendboolWhether the sublayer will be shown in the legend.SublayerShowInLegendRole
    sublayerIdintThe sublayer's ID.SublayerIdRole
    minScaledoubleThe minumum scale at which the sublayer displays.SublayerMinScaleRole
    maxScaledoubleThe maximum scale at which the sublayer displays.SublayerMaxScaleRole
    sublayerTypeArcGISSublayerTypeThe sublayer's type.SublayerTypeRole
    canChangeVisibilityboolWhether the sublayer's visibility can be changed.SublayerCanChangeVisibilityRole
    definitionExpressionQStringThe sublayer's definition expression (since 100.1)SublayerDefinitionExpressionRole
    sublayerOpacityfloatThe sublayer's opacity (since 100.1)SublayerOpacityRole
    scaleSymbolsboolWhether the sublayer renderers its symbols based on scale (since 100.1)SublayerScaleSymbolsRole
    labelsEnabledboolWhether the sublayer's labels are displayed (since 100.1)SublayerLabelsEnabledRole

    Member Type Documentation

    enum ArcGISSublayerListModel::SublayerRoles

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

    ConstantValueDescription
    Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerNameRoleQt::UserRole + 1The sublayer's name.
    Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerIdRoleQt::UserRole + 2The sublayer's ID.
    Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerMinScaleRoleQt::UserRole + 3The minumum scale at which the sublayer displays.
    Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerMaxScaleRoleQt::UserRole + 4The maximum scale at which the sublayer displays.
    Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerTypeRoleQt::UserRole + 5The sublayer's type.
    Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerCanChangeVisibilityRoleQt::UserRole + 6Whether the sublayer's visibility can be changed.
    Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerVisibleRoleQt::UserRole + 7Whether the sublayer is enabled to be visible.
    Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerShowInLegendRoleQt::UserRole + 8Whether the sublayer will be shown in the legend.
    Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerDefinitionExpressionRoleQt::UserRole + 9The sublayer's definition expression (since 100.1).
    Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerOpacityRoleQt::UserRole + 10The sublayer's opacity (since 100.1).
    Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerScaleSymbolsRoleQt::UserRole + 11Whether the sublayer renderers its symbols based on scale (since 100.1).
    Esri::ArcGISRuntime::ArcGISSublayerListModel::SublayerLabelsEnabledRoleQt::UserRole + 12Whether the sublayer's labels are displayed (since 100.1).

    Member Function Documentation

    [signal] void ArcGISSublayerListModel::errorOccurred(Esri::ArcGISRuntime::Error error)

    Signal emitted when an error occurs.

    • error - Details about the error.

    [signal] 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] 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.

    [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.

    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.

    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.

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