Represents a list of portal items. More...
Header: | #include <PortalItemListModel.h> |
Since: | Esri::ArcGISRuntime 100.0 |
Inherits: | QAbstractListModel and Esri::ArcGISRuntime::Iterable |
Public Types
enum | PortalItemRoles { PortalItemUrlRole, PortalItemItemIdRole, PortalItemAccessRole, PortalItemAverageRatingRole, PortalItemCommentCountRole, …, PortalItemTermsOfUseRole } |
Public Functions
virtual | ~PortalItemListModel() override |
bool | contains(Esri::ArcGISRuntime::PortalItem *portalItem) const |
Esri::ArcGISRuntime::PortalItem * | first() const |
int | indexOf(Esri::ArcGISRuntime::PortalItem *portalItem) const |
bool | isEmpty() const |
Esri::ArcGISRuntime::PortalItem * | last() const |
Reimplemented Public Functions
virtual Esri::ArcGISRuntime::PortalItem * | 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
A PortalItem is a unit of content in the Portal. This type is populated by starting an operation to retrieve content and then can be accessed after the operation is complete. For example, the list of items can be retrieved by: querying the portal (such as with PortalQueryParametersForItems) or by fetching the featuredItems or by fetching the items belonging to a user.
The model returns data for the following roles:
Role | Type | Description | PortalItemRoles |
---|---|---|---|
url | QUrl | The URL for the resource represented by the item. | PortalItemUrlRole |
itemId | QString | The ID of the item. | PortalItemItemIdRole |
access | PortalAccess | The level of access to the item. | PortalItemAccessRole |
averageRating | int | The average rating of the item. | PortalItemAverageRatingRole |
commentCount | int | The number of comments for the item. | PortalItemCommentCountRole |
commentsEnabled | bool | Whether comments are allowed on the item. | PortalItemCommentsEnabledRole |
culture | QString | The item locale information (language and country). | PortalItemCultureRole |
folderId | QString | The ID of the folder containing the item. | PortalItemFolderIdRole |
name | QString | The name of this item. | PortalItemNameRole |
owner | QString | The username of the user who owns the item. | PortalItemOwnerRole |
ratingCount | int | The number of ratings received by the item. | PortalItemRatingCountRole |
serviceUrl | int | The service URL for the item. | PortalItemServiceUrlRole |
size | qint64 | The size of the item in bytes. | PortalItemSizeRole |
type | PortalItemType | The type of the item. | PortalItemTypeRole |
typeKeywords | QStringList | A set of keywords that further describes the type of the item. | PortalItemTypeKeywordsRole |
typeName | QString | The name of the type of this item. | PortalItemTypeNameRole |
viewCount | int | The number of times this item has been viewed. | PortalItemViewCountRole |
description | QString | The item description. | PortalItemDescriptionRole |
extent | Envelope | The bounding rectangle of the item. | PortalItemExtentRole |
snippet | QString | The short summary description of the item. | PortalItemSnippetRole |
title | QString | The title of the item. | PortalItemTitleRole |
accessInformation | QString | The access information on the source of the item. | PortalItemAccessInformationRole |
tags | QStringList | The user-defined tags that describe the item. | PortalItemTagsRole |
created | QDateTime | The creation date of the item. | PortalItemCreatedRole |
modified | QDateTime | The date the item was last modified. | PortalItemModifiedRole |
spatialReference | SpatialReference | The spatial reference of the item. | PortalItemSpatialReferenceRole |
thumbnailUrl | QUrl | The thumbnail of the item as a local file URL. | PortalItemThumbnailUrlRole |
termsOfUse | QString | The terms of use of the item. | PortalItemTermsOfUseRole |
Example: Accessing roles from a PortalItemListModel from within a QML delegate:
Text { anchors { fill: parent margins: 10 } text: title // access the title role of the model color: "white" elide: Text.ElideRight wrapMode: Text.Wrap horizontalAlignment: Text.AlignHCenter }
See also Portal, PortalUser, and PortalItem.
Member Type Documentation
enum PortalItemListModel::PortalItemRoles
This enum specifies the custom roles which can be used with PortalItemListModel::data and ImmutablePortalItemListModel::data.
Constant | Value | Description |
---|---|---|
Esri::ArcGISRuntime::PortalItemListModel::PortalItemUrlRole | Qt::UserRole + 1 | The URL for the resource represented by the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemItemIdRole | Qt::UserRole + 2 | The ID of the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemAccessRole | Qt::UserRole + 3 | The level of access to the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemAverageRatingRole | Qt::UserRole + 5 | The average rating of the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemCommentCountRole | Qt::UserRole + 6 | The number of comments for the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemCommentsEnabledRole | Qt::UserRole + 7 | Whether comments are allowed on the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemCultureRole | Qt::UserRole + 8 | The item locale information (language and country). |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemFolderIdRole | Qt::UserRole + 9 | The ID of the folder containing the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemNameRole | Qt::UserRole + 10 | The name of this item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemOwnerRole | Qt::UserRole + 11 | The username of the user who owns the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemRatingCountRole | Qt::UserRole + 12 | The number of ratings received by the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemServiceUrlRole | Qt::UserRole + 13 | The service URL for the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemSizeRole | Qt::UserRole + 14 | The size of the item in bytes. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemTypeRole | Qt::UserRole + 15 | The type of the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemTypeKeywordsRole | Qt::UserRole + 16 | A set of keywords that further describes the type of the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemTypeNameRole | Qt::UserRole + 17 | The name of the type of this item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemViewCountRole | Qt::UserRole + 18 | The number of times this item has been viewed. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemDescriptionRole | Qt::UserRole + 19 | The item description. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemExtentRole | Qt::UserRole + 20 | The bounding rectangle of the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemSnippetRole | Qt::UserRole + 21 | The short summary description of the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemTitleRole | Qt::UserRole + 22 | The title of the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemAccessInformationRole | Qt::UserRole + 23 | The access information on the source of the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemTagsRole | Qt::UserRole + 24 | The user-defined tags that describe the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemCreatedRole | Qt::UserRole + 25 | The creation date of the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemModifiedRole | Qt::UserRole + 26 | The date the item was last modified. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemSpatialReferenceRole | Qt::UserRole + 27 | The spatial reference of the item. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemThumbnailUrlRole | Qt::UserRole + 28 | The thumbnail of the item as a local file URL. |
Esri::ArcGISRuntime::PortalItemListModel::PortalItemTermsOfUseRole | Qt::UserRole + 29 | The terms of use of the item. |
Member Function Documentation
[override virtual]
PortalItemListModel::~PortalItemListModel ()
Destructor.
[override virtual]
Esri::ArcGISRuntime::PortalItem *PortalItemListModel::at(int index) const
Returns the PortalItem at the specified index.
bool PortalItemListModel::contains(Esri::ArcGISRuntime::PortalItem *portalItem ) const
Returns whether the list model contains the specified portalItem.
[override virtual]
QVariant PortalItemListModel::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 portal item 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 PortalItemListModel::errorOccurred (const Esri::ArcGISRuntime::Error &error)
Signal emitted when an error occurs.
- error - Details about the error.
Esri::ArcGISRuntime::PortalItem *PortalItemListModel::first() const
Returns the first PortalItem in the list model.
int PortalItemListModel::indexOf (Esri::ArcGISRuntime::PortalItem *portalItem ) const
Returns the index of the PortalItem portalItem.
bool PortalItemListModel::isEmpty () const
Returns whether the list model contains no items.
[signal, since Esri::ArcGISRuntime 100.15]
void PortalItemListModel::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 PortalItemListModel::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::PortalItem *PortalItemListModel::last() const
Returns the last PortalItem in the list model.
[override virtual]
int PortalItemListModel::size() const
Returns the number of items contained in the list model.