ArcGIS Developers

PortalItemListModel Class

class Esri::ArcGISRuntime::PortalItemListModel

Represents a list of portal items. More...

Header: #include <PortalItemListModel>
Since: Esri::ArcGISRuntime 100.0
Inherits: QAbstractListModel and Esri::ArcGISRuntime::Iterable

This class was introduced in Esri::ArcGISRuntime 100.0.

Public Types

enum PortalItemRoles { PortalItemUrlRole, PortalItemItemIdRole, PortalItemAccessRole, PortalItemAccessAndUseConstraintsHtmlRole, PortalItemAverageRatingRole, …, PortalItemThumbnailUrlRole }

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


void errorOccurred(Esri::ArcGISRuntime::Error error)
void portalItemAdded(int index)
void portalItemRemoved(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:

urlQUrlThe URL for the resource represented by the item.PortalItemUrlRole
itemIdQStringThe ID of the item.PortalItemItemIdRole
accessPortalAccessThe level of access to the item.PortalItemAccessRole
accessAndUseConstraintsHtmlQStringThe access and use constraints HTML.PortalItemAccessAndUseConstraintsHtmlRole
averageRatingintThe average rating of the item.PortalItemAverageRatingRole
commentCountintThe number of comments for the item.PortalItemCommentCountRole
commentsEnabledboolWhether comments are allowed on the item.PortalItemCommentsEnabledRole
cultureQStringThe item locale information (language and country).PortalItemCultureRole
folderIdQStringThe ID of the folder containing the item.PortalItemFolderIdRole
nameQStringThe name of this item.PortalItemNameRole
ownerQStringThe username of the user who owns the item.PortalItemOwnerRole
ratingCountintThe number of ratings received by the item.PortalItemRatingCountRole
serviceUrlintThe service URL for the item.PortalItemServiceUrlRole
sizeqint64The size of the item in bytes.PortalItemSizeRole
typePortalItemTypeThe type of the item.PortalItemTypeRole
typeKeywordsQStringListA set of keywords that further describes the type of the item.PortalItemTypeKeywordsRole
typeNameQStringThe name of the type of this item.PortalItemTypeNameRole
viewCountintThe number of times this item has been viewed.PortalItemViewCountRole
descriptionQStringThe item description.PortalItemDescriptionRole
extentEnvelopeThe bounding rectangle of the item.PortalItemExtentRole
snippetQStringThe short summary description of the item.PortalItemSnippetRole
titleQStringThe title of the item.PortalItemTitleRole
accessInformationQStringThe access information on the source of the item.PortalItemAccessInformationRole
tagsQStringListThe user-defined tags that describe the item.PortalItemTagsRole
createdQDateTimeThe creation date of the item.PortalItemCreatedRole
modifiedQDateTimeThe date the item was last modified.PortalItemModifiedRole
spatialReferenceSpatialReferenceThe spatial reference of the item.PortalItemSpatialReferenceRole
thumbnailUrlQUrlThe thumbnail of the item as a local file URL.PortalItemThumbnailUrlRole

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.

Esri::ArcGISRuntime::PortalItemListModel::PortalItemUrlRoleQt::UserRole + 1The URL for the resource represented by the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemItemIdRoleQt::UserRole + 2The ID of the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemAccessRoleQt::UserRole + 3The level of access to the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemAccessAndUseConstraintsHtmlRoleQt::UserRole + 4The access and use constraints HTML.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemAverageRatingRoleQt::UserRole + 5The average rating of the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemCommentCountRoleQt::UserRole + 6The number of comments for the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemCommentsEnabledRoleQt::UserRole + 7Whether comments are allowed on the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemCultureRoleQt::UserRole + 8The item locale information (language and country).
Esri::ArcGISRuntime::PortalItemListModel::PortalItemFolderIdRoleQt::UserRole + 9The ID of the folder containing the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemNameRoleQt::UserRole + 10The name of this item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemOwnerRoleQt::UserRole + 11The username of the user who owns the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemRatingCountRoleQt::UserRole + 12The number of ratings received by the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemServiceUrlRoleQt::UserRole + 13The service URL for the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemSizeRoleQt::UserRole + 14The size of the item in bytes.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemTypeRoleQt::UserRole + 15The type of the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemTypeKeywordsRoleQt::UserRole + 16A set of keywords that further describes the type of the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemTypeNameRoleQt::UserRole + 17The name of the type of this item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemViewCountRoleQt::UserRole + 18The number of times this item has been viewed.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemDescriptionRoleQt::UserRole + 19The item description.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemExtentRoleQt::UserRole + 20The bounding rectangle of the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemSnippetRoleQt::UserRole + 21The short summary description of the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemTitleRoleQt::UserRole + 22The title of the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemAccessInformationRoleQt::UserRole + 23The access information on the source of the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemTagsRoleQt::UserRole + 24The user-defined tags that describe the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemCreatedRoleQt::UserRole + 25The creation date of the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemModifiedRoleQt::UserRole + 26The date the item was last modified.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemSpatialReferenceRoleQt::UserRole + 27The spatial reference of the item.
Esri::ArcGISRuntime::PortalItemListModel::PortalItemThumbnailUrlRoleQt::UserRole + 28The thumbnail of the item as a local file URL.

Member Function Documentation

[signal] void PortalItemListModel::errorOccurred(Esri::ArcGISRuntime::Error error)

Signal emitted when an error occurs.

  • error - Details about the error.

[signal] void PortalItemListModel::portalItemAdded(int index)

Signal emitted when a PortalItem is added to the list model.

index is the index of the added portalItem.

[signal] void PortalItemListModel::portalItemRemoved(int index)

Signal emitted when a PortalItem is removed from the list model.

index is the index of the removed portalItem.

[override virtual] PortalItemListModel::~PortalItemListModel()


[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.

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.

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.

Feedback on this topic?