BasemapListModel Class
The result of fetching the basemaps available for a portal. More...
Header: | #include <BasemapListModel> |
Since: | Esri::ArcGISRuntime 100.0 |
Inherits: | QAbstractListModel and Iterable<Basemap *> |
Public Types
enum | BasemapRoles { BasemapNameRole, BasemapUrlRole, BasemapItemAccessInformationRole, BasemapItemCreatedRole, ..., BasemapItemThumbnailUrlRole } |
Public Functions
~BasemapListModel() | |
void | append(Basemap *basemap) |
Basemap * | at(int index) const |
void | clear() |
bool | contains(Basemap *basemap) const |
Basemap * | first() const |
int | indexOf(Basemap *basemap) const |
void | insert(int index, Basemap *basemap) |
bool | isEmpty() const |
Basemap * | last() const |
void | move(int from, int to) |
void | removeAt(int index) |
void | removeOne(Basemap *basemap) |
int | size() const |
Reimplemented Public Functions
virtual QVariant | data(const QModelIndex &index, int role = Qt::DisplayRole) const |
- 4 public functions inherited from QAbstractListModel
- 8 public functions inherited from Esri::ArcGISRuntime::Iterable
- 39 public functions inherited from QAbstractItemModel
- 31 public functions inherited from QObject
Signals
void | basemapAdded(int index) |
void | basemapRemoved(int index) |
void | errorOccurred(Esri::ArcGISRuntime::Error error) |
- 18 signals inherited from QAbstractItemModel
- 2 signals inherited from QObject
Additional Inherited Members
- 1 property inherited from QObject
- 2 public slots inherited from QAbstractItemModel
- 1 public slot inherited from QObject
- 1 public variable inherited from QObject
- 10 static public members inherited from QObject
- 19 protected functions inherited from QAbstractItemModel
- 9 protected functions inherited from QObject
- 1 protected slot inherited from QAbstractItemModel
- 2 protected variables inherited from QObject
Detailed Description
The result of fetching the basemaps available for a portal.
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 | list<string> | 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
BasemapListModel::~BasemapListModel()
Destructor.
void BasemapListModel::append(Basemap *basemap)
Appends a basemap to the basemap list model.
Basemap *BasemapListModel::at(int index) const
Returns the basemap at the specified index.
[signal]
void BasemapListModel::basemapAdded(int index)
Signal emitted when a basemap is added to the list model.
index is the index of the added basemap.
[signal]
void BasemapListModel::basemapRemoved(int index)
Signal emitted when a basemap is removed from the list model.
index is the index of the removed basemap.
void BasemapListModel::clear()
Removes all basemaps from the list model.
bool BasemapListModel::contains(Basemap *basemap) const
Returns true
if the list model contains the specified basemap.
[virtual]
QVariant BasemapListModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const
Reimplemented from QAbstractItemModel::data().
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(Esri::ArcGISRuntime::Error error)
Signal emitted when an error occurs.
- error - Details about the error.
Basemap *BasemapListModel::first() const
Returns the first basemap in the list model.
int BasemapListModel::indexOf(Basemap *basemap) const
Returns the index of the basemap specified.
void BasemapListModel::insert(int index, 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.
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.
void BasemapListModel::removeOne(Basemap *basemap)
Removes the specified basemap from the list model.
int BasemapListModel::size() const
Returns the number of basemaps contained in the list model.