The result of fetching the basemaps available for a portal. More...
Header: | #include <BasemapListModel.h> |
Since: | Esri::ArcGISRuntime 100.0 |
Inherits: | QAbstractListModel and Esri::ArcGISRuntime::Iterable |
Public Types
enum | BasemapRoles { BasemapNameRole, BasemapUrlRole, BasemapItemAccessInformationRole, BasemapItemCreatedRole, BasemapItemDescriptionRole, …, BasemapItemThumbnailUrlRole } |
Public Functions
virtual | ~BasemapListModel() override |
void | append(Esri::ArcGISRuntime::Basemap *basemap) |
void | clear() |
bool | contains(Esri::ArcGISRuntime::Basemap *basemap) const |
Esri::ArcGISRuntime::Basemap * | first() const |
int | indexOf(Esri::ArcGISRuntime::Basemap *basemap) const |
void | insert(int index, Esri::ArcGISRuntime::Basemap *basemap) |
bool | isEmpty() const |
Esri::ArcGISRuntime::Basemap * | last() const |
void | move(int from, int to) |
void | removeAt(int index) |
void | removeOne(Esri::ArcGISRuntime::Basemap *basemap) |
Reimplemented Public Functions
virtual Esri::ArcGISRuntime::Basemap * | 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(const Esri::ArcGISRuntime::Error &error) |
void | itemAdded(int index) |
void | itemRemoved(int index) |
Detailed Description
The request is made by calling fetchBasemaps and if the operation is succesful, this type is returned by the portal's basemaps method.
The basemaps contained in the model are initially unloaded.
The model returns data for the following roles:
Role | Type | Description | BasemapRoles |
---|---|---|---|
name | string | The basemap's name. | BasemapNameRole |
url | url | The basemap's URL. | BasemapUrlRole |
accessInformation | string | The item's access information. | BasemapItemAccessInformationRole |
created | date | The date this item was created. | BasemapItemCreatedRole |
description | string | The item's description. | BasemapItemDescriptionRole |
itemId | string | The item's ID. | BasemapItemIdRole |
type | PortalItemType | The item's type. | BasemapItemTypeRole |
modified | date | The date this item was last modified. | BasemapItemModifiedRole |
snippet | string | The item's snippet. | BasemapItemSnippetRole |
tags | QStringList | The item's tags. | BasemapItemTagsRole |
title | string | The item's title. | BasemapItemTitleRole |
thumbnailUrl | url | The local file URL of the thumbnail image for this item. | BasemapItemThumbnailUrlRole |
Example: Accessing roles from a BasemapListModel from within a QML delegate:
Image { id: basemapImg anchors { bottom: basemapLabel.top; horizontalCenter: parent.horizontalCenter } height: parent.height - ( basemapLabel.height * 2 ); source: thumbnailUrl // use the thumbnailUrl role of the model width: height fillMode: Image.PreserveAspectCrop } Text { id: basemapLabel anchors { bottom: parent.bottom; left: parent.left; right: parent.right } height: 16 z: 100 wrapMode: Text.Wrap horizontalAlignment: Text.AlignHCenter elide: Text.ElideRight text: title // use the title role of the model font.pointSize: 8 font.bold: index === basemapsGrid.currentIndex }
See also Portal, Basemap, and Loadable.
Member Type Documentation
enum BasemapListModel::BasemapRoles
This enum specifies the custom roles which can be used with BasemapListModel::data.
Constant | Value | Description |
---|---|---|
Esri::ArcGISRuntime::BasemapListModel::BasemapNameRole | Qt::UserRole + 1 | The basemap's name. |
Esri::ArcGISRuntime::BasemapListModel::BasemapUrlRole | Qt::UserRole + 2 | The basemap's URL. |
Esri::ArcGISRuntime::BasemapListModel::BasemapItemAccessInformationRole | Qt::UserRole + 3 | The item's access information. |
Esri::ArcGISRuntime::BasemapListModel::BasemapItemCreatedRole | Qt::UserRole + 4 | The date this item was created. |
Esri::ArcGISRuntime::BasemapListModel::BasemapItemDescriptionRole | Qt::UserRole + 5 | The item's description. |
Esri::ArcGISRuntime::BasemapListModel::BasemapItemIdRole | Qt::UserRole + 6 | The item's ID. |
Esri::ArcGISRuntime::BasemapListModel::BasemapItemTypeRole | Qt::UserRole + 7 | The item's type. |
Esri::ArcGISRuntime::BasemapListModel::BasemapItemModifiedRole | Qt::UserRole + 8 | The date this item was last modified. |
Esri::ArcGISRuntime::BasemapListModel::BasemapItemSnippetRole | Qt::UserRole + 9 | The item's snippet. |
Esri::ArcGISRuntime::BasemapListModel::BasemapItemTagsRole | Qt::UserRole + 10 | The item's tags. |
Esri::ArcGISRuntime::BasemapListModel::BasemapItemTitleRole | Qt::UserRole + 11 | The item's title. |
Esri::ArcGISRuntime::BasemapListModel::BasemapItemThumbnailUrlRole | Qt::UserRole + 12 | The local file URL of the thumbnail image for this item. |
Member Function Documentation
[override virtual]
BasemapListModel::~BasemapListModel ()
Destructor.
void BasemapListModel::append(Esri::ArcGISRuntime::Basemap *basemap)
Appends a basemap to the basemap list model.
[override virtual]
Esri::ArcGISRuntime::Basemap *BasemapListModel::at(int index) const
Returns the basemap at the specified index.
void BasemapListModel::clear()
Removes all basemaps 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 BasemapListModel::contains(Esri::ArcGISRuntime::Basemap *basemap) const
Returns true
if the list model contains the specified basemap.
[override virtual]
QVariant BasemapListModel::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 basemap 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 BasemapListModel::errorOccurred (const Esri::ArcGISRuntime::Error &error)
Signal emitted when an error occurs.
- error - Details about the error.
Esri::ArcGISRuntime::Basemap *BasemapListModel::first() const
Returns the first basemap in the list model.
int BasemapListModel::indexOf (Esri::ArcGISRuntime::Basemap *basemap) const
Returns the index of the basemap specified.
void BasemapListModel::insert(int index, Esri::ArcGISRuntime::Basemap *basemap)
Inserts a basemap 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 BasemapListModel::isEmpty () const
Returns true
if the list model contains no basemaps.
[signal, since Esri::ArcGISRuntime 100.15]
void BasemapListModel::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, since Esri::ArcGISRuntime 100.15]
void BasemapListModel::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.
Esri::ArcGISRuntime::Basemap *BasemapListModel::last() const
Returns the last basemap in the list model.
void BasemapListModel::move(int from, int to)
Moves one basemap from an index in the list model to a different index.
void BasemapListModel::removeAt (int index)
Removes a basemap 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 BasemapListModel::removeOne (Esri::ArcGISRuntime::Basemap *basemap)
Removes the specified basemap 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 BasemapListModel::size() const
Returns the number of basemaps contained in the list model.