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:
Role | Type | Description | SymbolStyleSearchResultRoles |
---|---|---|---|
category | QString | The category of the search result. | CategoryRole |
key | QString | The key of the search result. | KeyRole |
name | QString | The name of the search result. | NameRole |
symbolClass | QString | The symbol class of the search result. | SymbolClassRole |
tags | QStringList | The tags of the search result. | TagsRole |
symbolUrl | QUrl | The 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:
- Create symbol styles from web styles: Create symbol styles from a style file hosted on a portal.
- Read symbols from a mobile style: Combine multiple symbols from a mobile style file into a single symbol.
- Search dictionary symbol style: Find symbols within the mil2525d specification that match a keyword.
See also SymbolStyleSearchResult.
Member Type Documentation
enum SymbolStyleSearchResultListModel::SymbolStyleSearchResultRoles
This enum specifies the custom roles which can be used with SymbolStyleSearchResultListModel::data.
Constant | Value | Description |
---|---|---|
Esri::ArcGISRuntime::SymbolStyleSearchResultListModel::CategoryRole | Qt::UserRole + 1 | The category of the search result. |
Esri::ArcGISRuntime::SymbolStyleSearchResultListModel::KeyRole | Qt::UserRole + 2 | The key of the search result. |
Esri::ArcGISRuntime::SymbolStyleSearchResultListModel::NameRole | Qt::UserRole + 3 | The name of the search result. |
Esri::ArcGISRuntime::SymbolStyleSearchResultListModel::SymbolClassRole | Qt::UserRole + 4 | The symbol class of the search result. |
Esri::ArcGISRuntime::SymbolStyleSearchResultListModel::TagsRole | Qt::UserRole + 5 | The tags of the search result. |
Esri::ArcGISRuntime::SymbolStyleSearchResultListModel::SymbolUrlRole | Qt::UserRole + 6 | The 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.