;

LegendInfoListModel Class

  • LegendInfoListModel
  • class Esri::ArcGISRuntime::LegendInfoListModel

    A list model storing a list of LegendInfos available for a LayerContent type. More...

    Header: #include <LegendInfoListModel>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: QAbstractListModel and Esri::ArcGISRuntime::Iterable

    This class was introduced in Esri::ArcGISRuntime 100.0.

    Public Types

    enum LegendInfoRoles { LegendInfoNameRole, LegendInfoSymbolUrlRole, LegendInfoSymbolWidthRole, LegendInfoSymbolHeightRole, LegendInfoLayerNameRole, …, LegendInfoLayerMaxScaleRole }

    Public Functions

    virtual ~LegendInfoListModel() override
    void clear()
    Esri::ArcGISRuntime::TaskWatcher fetchLegendInfos(bool recursive = true)
    bool isEmpty() const

    Reimplemented Public Functions

    virtual Esri::ArcGISRuntime::LegendInfo *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 fetchLegendInfosCompleted()

    Detailed Description

    By default, legend information will be fetched recursively (from base layer type to sublayer types) and added to the list model. This automatic fetching of legend information can be changed by calling the setAutoFetchLegendInfos method on LayerContent or Map, whichever was the source for the model. This list model contains roles for accessing particular legend information.

    This class is a subclass of QAbstractListModel.

    The model returns data for the following roles:

    RoleTypeDescription
    nameQStringThe name of the legend info value.
    symbolUrlQUrlA temporary file path to a symbol image contained in the legend info. This temporary file is deleted when the list model is destroyed.
    symbolWidthfloatThe width of the symbol image.
    symbolHeightfloatThe height of the symbol image.
    layerNameQStringThe name of the layer that the legend information belongs to.
    layerMinScaledoubleThe minimum scale of the layer that the legend information belongs to.
    layerMaxScaledoubleThe maximum scale of the layer that the legend information belongs to.

    See also LegendInfo.

    Member Type Documentation

    enum LegendInfoListModel::LegendInfoRoles

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

    ConstantValueDescription
    Esri::ArcGISRuntime::LegendInfoListModel::LegendInfoNameRoleQt::DisplayRoleThe name of the legend info value.
    Esri::ArcGISRuntime::LegendInfoListModel::LegendInfoSymbolUrlRoleQt::UserRole + 1A temporary file path to a symbol image contained in the legend info.
    Esri::ArcGISRuntime::LegendInfoListModel::LegendInfoSymbolWidthRoleQt::UserRole + 2The width of the symbol image.
    Esri::ArcGISRuntime::LegendInfoListModel::LegendInfoSymbolHeightRoleQt::UserRole + 3The height of the symbol image.
    Esri::ArcGISRuntime::LegendInfoListModel::LegendInfoLayerNameRoleQt::UserRole + 4The name of the layer that the legend information belongs to.
    Esri::ArcGISRuntime::LegendInfoListModel::LegendInfoLayerMinScaleRoleQt::UserRole + 5The minimum scale of the layer that the legend information belongs to.
    Esri::ArcGISRuntime::LegendInfoListModel::LegendInfoLayerMaxScaleRoleQt::UserRole + 6The maximum scale of the layer that the legend information belongs to.

    Member Function Documentation

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

    Signal emitted when an error occurs.

    • error - Details about the error.

    [signal] void LegendInfoListModel::fetchLegendInfosCompleted()

    Signal emitted when the model has completed fetching all requested legend infos.

    [override virtual] LegendInfoListModel::~LegendInfoListModel()

    Destructor.

    [override virtual] Esri::ArcGISRuntime::LegendInfo *LegendInfoListModel::at(int index) const

    Returns the legend info at the specified index.

    void LegendInfoListModel::clear()

    Removes all legend infos from the list model.

    After clearing the list model, you can repopulate the model by calling fetchLegendInfos.

    [override virtual] QVariant LegendInfoListModel::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 legend info 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::TaskWatcher LegendInfoListModel::fetchLegendInfos(bool recursive = true)

    Fetches legend information from its source layer or map, adds to the list model, and returns a TaskWatcher for the asynchronous task.

    To fetch legend information recursively through the source layer and its sublayers, pass in true (the default) for the recursive parameter.

    If the model's source LayerContent type or Map is configured to automatically fetch legend infos, this method will be called automatically.

    bool LegendInfoListModel::isEmpty() const

    Returns true if the list model contains no legend infos.

    [override virtual] int LegendInfoListModel::size() const

    Returns the number of legend infos 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.