Skip To Content ArcGIS for Developers Sign In Dashboard

PortalGroupListModel Class


Represents a particular set of groups in a portal. More...

Header: #include <PortalGroupListModel>
Since: Esri::ArcGISRuntime 100.0
Inherits: QAbstractListModel and Iterable<PortalGroup *>

Public Types

enum PortalGroupRoles { PortalGroupAccessRole, PortalGroupAdminsRole, PortalGroupCreatedRole, PortalGroupGroupDescriptionRole, ..., PortalGroupViewOnlyRole }

Public Functions

PortalGroup *at(int index) const
void clear()
bool contains(PortalGroup *portalGroup) const
PortalGroup *first() const
int indexOf(PortalGroup *portalGroup) const
bool isEmpty() const
PortalGroup *last() const
int size() const

Reimplemented Public Functions

virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const


void errorOccurred(Esri::ArcGISRuntime::Error error)
void portalGroupAdded(int index)
void portalGroupRemoved(int index)

Additional Inherited Members

Detailed Description

Represents a particular set of groups in a portal.

This model type is returned by:

The model returns data for the following roles:

accessPortalAccessThe access level for the group.PortalGroupAccessRole
adminsQStringListThe administrator users of the group.PortalGroupAdminsRole
createdQDateTimeThe date the group was created.PortalGroupCreatedRole
groupDescriptionQStringThe description of the group.PortalGroupGroupDescriptionRole
groupIdQStringThe group's ID.PortalGroupGroupIdRole
invitationOnlyboolWhether the group membership is invitation-only.PortalGroupInvitationOnlyRole
modifiedQDateTimeThe date on which the group was last modified.PortalGroupModifiedRole
ownerQStringThe username of the owner of the group.PortalGroupOwnerRole
phoneQStringThe telephone number of the group.PortalGroupPhoneRole
snippetQStringThe group summary.PortalGroupSnippetRole
sortFieldPortalGroupSortFieldThe field that items in the group are sorted by.PortalGroupSortFieldRole
sortOrderPortalQuerySortOrderThe sort order for items in this group.PortalGroupSortOrderRole
tagsQStringListThe user-defined tags that describe the group.PortalGroupTagsRole
thumbnailUrlQUrlThe URL of the thumbnail used for the group.PortalGroupThumbnailUrlRole
titleQStringThe title of the group.PortalGroupTitleRole
usersQStringListThe users of the group.PortalGroupUsersRole
viewOnlyboolWhether the group membership is view-only.PortalGroupViewOnlyRole


Access the various groups of a portalItem:

int adminGroupsCount = 0;
int memberGroupsCount = 0;
int otherGroupsCount = 0;
connect(portalItem, &PortalItem::fetchGroupsCompleted,
        this, [portalItem, &adminGroupsCount, &memberGroupsCount, &otherGroupsCount](bool success)
  if (!success)

  // lambda function to iterate over PortalGroupListModels
  auto printGroupTitles = [](PortalGroupListModel* groupsModel, const QString& groupName)
    if (!groupsModel)

    qDebug() << groupName << ":";
    for (int i = 0; i < groupsModel->rowCount(); ++i)
      if (groupsModel->at(i))
        qDebug() << groupsModel->at(i)->title();

  printGroupTitles(portalItem->adminGroups(), "admin groups");
  printGroupTitles(portalItem->memberGroups(), "member groups");
  printGroupTitles(portalItem->otherGroups(), "other groups");
  adminGroupsCount = portalItem->adminGroups()->rowCount();
  memberGroupsCount = portalItem->memberGroups()->rowCount();
  otherGroupsCount = portalItem->otherGroups()->rowCount();



Accessing various roles of the model from within a QML delegate:

Image {
    source: thumbnailUrl // use the thumbnailUrl role of the model
    fillMode: Image.PreserveAspectCrop
    height: parent.height
    width: height

Text {
    text: title // access the title role of the group
    font.bold: true

See also Portal, PortalGroup, PortalItem, PortalQueryParametersForGroups, and PortalQueryResultSetForGroups.

Member Type Documentation

enum PortalGroupListModel::PortalGroupRoles

This enum specifies the custom roles which can be used with PortalGroupListModel::data.

Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupAccessRoleQt::UserRole + 1The access level for the group.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupAdminsRoleQt::UserRole + 2The administrator users of the group.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupCreatedRoleQt::UserRole + 3The date the group was created.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupGroupDescriptionRoleQt::UserRole + 4The description of the group.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupGroupIdRoleQt::UserRole + 5The group's ID.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupInvitationOnlyRoleQt::UserRole + 6Whether the group membership is invitation-only.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupModifiedRoleQt::UserRole + 7The date on which the group was last modified.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupOwnerRoleQt::UserRole + 8The username of the owner of the group.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupPhoneRoleQt::UserRole + 9The telephone number of the group.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupSnippetRoleQt::UserRole + 10The group summary.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupSortFieldRoleQt::UserRole + 11The field that items in the group are sorted by.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupSortOrderRoleQt::UserRole + 12The sort order for items in this group.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupTagsRoleQt::UserRole + 13The user-defined tags that describe the group.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupThumbnailUrlRoleQt::UserRole + 14The URL of the thumbnail used for the group.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupTitleRoleQt::UserRole + 15The title of the group.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupUsersRoleQt::UserRole + 16The users of the group.
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupViewOnlyRoleQt::UserRole + 17Whether the group membership is view-only.

Member Function Documentation



PortalGroup *PortalGroupListModel::at(int index) const

Returns the PortalGroup at the specified index.

void PortalGroupListModel::clear()

Removes all PortalGroups from the list model.

bool PortalGroupListModel::contains(PortalGroup *portalGroup) const

Returns true if the list model contains the PortalGroup portalGroup.

[virtual] QVariant PortalGroupListModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const

Reimplemented from QAbstractItemModel::data().

Returns the data stored under the given role for the portal group 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 PortalGroupListModel::errorOccurred(Esri::ArcGISRuntime::Error error)

Signal emitted when an error occurs.

  • error - Details about the error.

PortalGroup *PortalGroupListModel::first() const

Returns the first PortalGroup in the list model.

int PortalGroupListModel::indexOf(PortalGroup *portalGroup) const

Returns the index of the PortalGroup portalGroup.

bool PortalGroupListModel::isEmpty() const

Returns whether the list model is empty (contains no groups).

PortalGroup *PortalGroupListModel::last() const

Returns the last PortalGroup in the list model.

[signal] void PortalGroupListModel::portalGroupAdded(int index)

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

index is the index of the added PortalGroup.

[signal] void PortalGroupListModel::portalGroupRemoved(int index)

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

index is the index of the removed PortalGroup.

int PortalGroupListModel::size() const

Returns the number of PortalGroups contained in the list model.

Feedback on this topic?