PortalGroupListModel Class
Represents a particular set of groups in a portal. More...
Header: | #include <PortalGroupListModel.h> |
Since: | Esri::ArcGISRuntime 100.0 |
Inherits: | QAbstractListModel and Esri::ArcGISRuntime::Iterable |
This class was introduced in Esri::ArcGISRuntime 100.0.
Public Types
enum | PortalGroupRoles { PortalGroupAccessRole, PortalGroupAdminsRole, PortalGroupCreatedRole, PortalGroupGroupDescriptionRole, PortalGroupGroupIdRole, …, PortalGroupViewOnlyRole } |
Public Functions
virtual | ~PortalGroupListModel() override |
void | clear() |
bool | contains(Esri::ArcGISRuntime::PortalGroup *portalGroup) const |
Esri::ArcGISRuntime::PortalGroup * | first() const |
int | indexOf(Esri::ArcGISRuntime::PortalGroup *portalGroup) const |
bool | isEmpty() const |
Esri::ArcGISRuntime::PortalGroup * | last() const |
Reimplemented Public Functions
virtual Esri::ArcGISRuntime::PortalGroup * | 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(Esri::ArcGISRuntime::Error error) |
void | portalGroupAdded(int index) |
void | portalGroupRemoved(int index) |
Detailed Description
This model type is returned by:
- Querying a Portal using PortalQueryParametersForGroups.
- Accessing the featuredGroups of a Portal.
- Calling fetchGroups with a PortalItem.
The model returns data for the following roles:
Role | Type | Description | PortalGroupRoles |
---|---|---|---|
access | PortalAccess | The access level for the group. | PortalGroupAccessRole |
admins | QStringList | The administrator users of the group. | PortalGroupAdminsRole |
created | QDateTime | The date the group was created. | PortalGroupCreatedRole |
groupDescription | QString | The description of the group. | PortalGroupGroupDescriptionRole |
groupId | QString | The group's ID. | PortalGroupGroupIdRole |
invitationOnly | bool | Whether the group membership is invitation-only. | PortalGroupInvitationOnlyRole |
modified | QDateTime | The date on which the group was last modified. | PortalGroupModifiedRole |
owner | QString | The username of the owner of the group. | PortalGroupOwnerRole |
phone | QString | The telephone number of the group. | PortalGroupPhoneRole |
snippet | QString | The group summary. | PortalGroupSnippetRole |
sortField | PortalGroupSortField | The field that items in the group are sorted by. | PortalGroupSortFieldRole |
sortOrder | PortalQuerySortOrder | The sort order for items in this group. | PortalGroupSortOrderRole |
tags | QStringList | The user-defined tags that describe the group. | PortalGroupTagsRole |
thumbnailUrl | QUrl | The URL of the thumbnail used for the group. | PortalGroupThumbnailUrlRole |
title | QString | The title of the group. | PortalGroupTitleRole |
users | QStringList | The users of the group. | PortalGroupUsersRole |
viewOnly | bool | Whether the group membership is view-only. | PortalGroupViewOnlyRole |
Example:
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) return; // lambda function to iterate over PortalGroupListModels auto printGroupTitles = [](PortalGroupListModel* groupsModel, const QString& groupName) { if (!groupsModel) return; 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(); }); portalItem->fetchGroups();
Example:
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.
Constant | Value | Description |
---|---|---|
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupAccessRole | Qt::UserRole + 1 | The access level for the group. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupAdminsRole | Qt::UserRole + 2 | The administrator users of the group. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupCreatedRole | Qt::UserRole + 3 | The date the group was created. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupGroupDescriptionRole | Qt::UserRole + 4 | The description of the group. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupGroupIdRole | Qt::UserRole + 5 | The group's ID. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupInvitationOnlyRole | Qt::UserRole + 6 | Whether the group membership is invitation-only. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupModifiedRole | Qt::UserRole + 7 | The date on which the group was last modified. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupOwnerRole | Qt::UserRole + 8 | The username of the owner of the group. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupPhoneRole | Qt::UserRole + 9 | The telephone number of the group. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupSnippetRole | Qt::UserRole + 10 | The group summary. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupSortFieldRole | Qt::UserRole + 11 | The field that items in the group are sorted by. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupSortOrderRole | Qt::UserRole + 12 | The sort order for items in this group. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupTagsRole | Qt::UserRole + 13 | The user-defined tags that describe the group. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupThumbnailUrlRole | Qt::UserRole + 14 | The URL of the thumbnail used for the group. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupTitleRole | Qt::UserRole + 15 | The title of the group. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupUsersRole | Qt::UserRole + 16 | The users of the group. |
Esri::ArcGISRuntime::PortalGroupListModel::PortalGroupViewOnlyRole | Qt::UserRole + 17 | Whether the group membership is view-only. |
Member Function Documentation
[signal]
void PortalGroupListModel::errorOccurred(Esri::ArcGISRuntime::Error error)
Signal emitted when an error occurs.
- error - Details about the error.
[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.
[override virtual]
PortalGroupListModel::~PortalGroupListModel()
Destructor.
[override virtual]
Esri::ArcGISRuntime::PortalGroup *PortalGroupListModel::at(int index) const
Returns the PortalGroup at the specified index.
void PortalGroupListModel::clear()
Removes all PortalGroups 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 PortalGroupListModel::contains(Esri::ArcGISRuntime::PortalGroup *portalGroup) const
Returns true
if the list model contains the PortalGroup portalGroup.
[override virtual]
QVariant PortalGroupListModel::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 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.
Esri::ArcGISRuntime::PortalGroup *PortalGroupListModel::first() const
Returns the first PortalGroup in the list model.
int PortalGroupListModel::indexOf(Esri::ArcGISRuntime::PortalGroup *portalGroup) const
Returns the index of the PortalGroup portalGroup.
bool PortalGroupListModel::isEmpty() const
Returns whether the list model is empty (contains no groups).
Esri::ArcGISRuntime::PortalGroup *PortalGroupListModel::last() const
Returns the last PortalGroup in the list model.
[override virtual]
int PortalGroupListModel::size() const
Returns the number of PortalGroups contained in the list model.