PortalGroupListModel Class

  • PortalGroupListModel
  • class Esri::ArcGISRuntime::PortalGroupListModel

    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

    Public Types

    enum PortalGroupRoles { PortalGroupAccessRole, PortalGroupAdminsRole, PortalGroupCreatedRole, PortalGroupGroupDescriptionRole, PortalGroupGroupIdRole, …, PortalGroupViewOnlyRole }

    Public Functions

    virtual ~PortalGroupListModel() override
    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(const Esri::ArcGISRuntime::Error &error)
    void itemAdded(int index)
    void itemRemoved(int index)

    Detailed Description

    This model type is returned by:

    The model returns data for the following roles:

    RoleTypeDescriptionPortalGroupRoles
    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

    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.

    ConstantValueDescription
    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

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

    [signal] void PortalGroupListModel::errorOccurred(const Esri::ArcGISRuntime::Error &error)

    Signal emitted when an error occurs.

    • error - Details about the error.

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

    [signal, since Esri::ArcGISRuntime 100.15] 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, since Esri::ArcGISRuntime 100.15] 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.

    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.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.