SymbolStyleSearchResultListModel Class

  • SymbolStyleSearchResultListModel
  • class Esri::ArcGISRuntime::SymbolStyleSearchResultListModel

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

    Header: #include <SymbolStyleSearchResultListModel.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: QAbstractListModel

    Public Types

    enum SymbolStyleSearchResultRoles { CategoryRole, KeyRole, NameRole, SymbolClassRole, TagsRole, SymbolUrlRole }

    Public Functions

    virtual ~SymbolStyleSearchResultListModel() override
    bool isEmpty() const
    QList<Esri::ArcGISRuntime::SymbolStyleSearchResult> searchResults() const
    int size() const

    Reimplemented Public Functions

    virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override

    Signals

    void errorOccurred(const Esri::ArcGISRuntime::Error &error)

    Detailed Description

    This list model is commonly used to create a symbol gallery viewing application. This is achieved by applying the list model to a list view or grid view, and displaying the symbol swatch and some relevant information along side it in the view's delegate.

    This class is a subclass of QAbstractListModel.

    The model returns data for the following roles:

    RoleTypeDescriptionSymbolStyleSearchResultRoles
    categoryQStringThe category of the search result.CategoryRole
    keyQStringThe key of the search result.KeyRole
    nameQStringThe name of the search result.NameRole
    symbolClassQStringThe symbol class of the search result.SymbolClassRole
    tagsQStringListThe tags of the search result.TagsRole
    symbolUrlQUrlThe file path of the results' symbol swatch.SymbolUrlRole

    The symbolUrl role automatically fetches the symbol swatch for the model. You don't need to call createSwatch manually for this to work. All symbolUrl urls are local files, as such QUrl::toLocalFile() should be used to convert to a string path if desired.

    Relevant samples:

    See also SymbolStyleSearchResult.

    Member Type Documentation

    enum SymbolStyleSearchResultListModel::SymbolStyleSearchResultRoles

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

    ConstantValueDescription
    Esri::ArcGISRuntime::SymbolStyleSearchResultListModel::CategoryRoleQt::UserRole + 1The category of the search result.
    Esri::ArcGISRuntime::SymbolStyleSearchResultListModel::KeyRoleQt::UserRole + 2The key of the search result.
    Esri::ArcGISRuntime::SymbolStyleSearchResultListModel::NameRoleQt::UserRole + 3The name of the search result.
    Esri::ArcGISRuntime::SymbolStyleSearchResultListModel::SymbolClassRoleQt::UserRole + 4The symbol class of the search result.
    Esri::ArcGISRuntime::SymbolStyleSearchResultListModel::TagsRoleQt::UserRole + 5The tags of the search result.
    Esri::ArcGISRuntime::SymbolStyleSearchResultListModel::SymbolUrlRoleQt::UserRole + 6The file path of the results' symbol swatch.

    Member Function Documentation

    [override virtual] SymbolStyleSearchResultListModel::~SymbolStyleSearchResultListModel()

    Destructor.

    [override virtual] QVariant SymbolStyleSearchResultListModel::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 symbol style search result referred to by the index.

    • index. The index in the model for which to return data.
    • role. The role for which to return data.

    [signal] void SymbolStyleSearchResultListModel::errorOccurred(const Esri::ArcGISRuntime::Error &error)

    Signal emitted when an error occurs.

    • error - Details about the error.

    bool SymbolStyleSearchResultListModel::isEmpty() const

    Returns true if the list model contains no style symbol search results.

    QList<Esri::ArcGISRuntime::SymbolStyleSearchResult> SymbolStyleSearchResultListModel::searchResults() const

    Returns a list of the SymbolStyleSearchResult contained in the list model.

    int SymbolStyleSearchResultListModel::size() const

    Returns the number of style symbol search results 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.