Represents a particular set of groups in a portal. More...
| Header | #include <Portal |
| Since | Esri |
| Inherits | QAbstract |
This class was introduced in Esri::ArcGISRuntime 100.0.
Public Types
| enum | Portal |
Public Functions
| virtual | ~ |
| bool | contains( |
| Esri | first() const |
| int | index |
| bool | is |
| Esri | last() const |
Reimplemented Public Functions
| virtual Esri | at(int index) const override |
| virtual QVariant | data(const QModel |
| virtual int | size() const override |
Signals
| void | error |
| void | item |
| void | item |
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 | Portal | The access level for the group. | Portal |
| admins | QString | The administrator users of the group. | Portal |
| created | QDate | The date the group was created. | Portal |
| group | QString | The description of the group. | Portal |
| group | QString | The group's I | Portal |
| invitation | bool | Whether the group membership is invitation-only. | Portal |
| modified | QDate | The date on which the group was last modified. | Portal |
| owner | QString | The username of the owner of the group. | Portal |
| phone | QString | The telephone number of the group. | Portal |
| snippet | QString | The group summary. | Portal |
| sort | Portal | The field that items in the group are sorted by. | Portal |
| sort | Portal | The sort order for items in this group. | Portal |
| tags | QString | The user-defined tags that describe the group. | Portal |
| thumbnail | QUrl | The UR | Portal |
| title | QString | The title of the group. | Portal |
| users | QString | The users of the group. | Portal |
| view | bool | Whether the group membership is view-only. | Portal |
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 | Qt | The access level for the group. |
Esri | Qt | The administrator users of the group. |
Esri | Qt | The date the group was created. |
Esri | Qt | The description of the group. |
Esri | Qt | The group's I |
Esri | Qt | Whether the group membership is invitation-only. |
Esri | Qt | The date on which the group was last modified. |
Esri | Qt | The username of the owner of the group. |
Esri | Qt | The telephone number of the group. |
Esri | Qt | The group summary. |
Esri | Qt | The field that items in the group are sorted by. |
Esri | Qt | The sort order for items in this group. |
Esri | Qt | The user-defined tags that describe the group. |
Esri | Qt | The UR |
Esri | Qt | The title of the group. |
Esri | Qt | The users of the group. |
Esri | Qt | 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::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] void PortalGroupListModel::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.
[override virtual] PortalGroupListModel::~PortalGroupListModel ()
Destructor.
[override virtual] Esri::ArcGISRuntime::PortalGroup *PortalGroupListModel::at(int index) const
Returns the PortalGroup at the specified index.
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.