ArcGIS Developers

PortalFolderListModel Class

class Esri::ArcGISRuntime::PortalFolderListModel

Represents the folders in the root folder of a user. More...

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

This class was introduced in Esri::ArcGISRuntime 100.0.

Public Types

enum PortalFolderRoles { PortalFolderCreatedRole, PortalFolderFolderIdRole, PortalFolderTitleRole }

Public Functions

virtual ~PortalFolderListModel() override
bool contains(const Esri::ArcGISRuntime::PortalFolder &portalFolder) const
Esri::ArcGISRuntime::PortalFolder first() const
int indexOf(const Esri::ArcGISRuntime::PortalFolder &portalFolder) const
bool isEmpty() const
Esri::ArcGISRuntime::PortalFolder last() const

Reimplemented Public Functions

virtual Esri::ArcGISRuntime::PortalFolder 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 portalFolderAdded(int index)
void portalFolderRemoved(int index)

Detailed Description

Folders are used to organize content in a portal. The list of PortalFolder objects is retrieved by calling fetchContent and if the operation is succesful, this model is returned by the portalUser's folders method.

Multilevel folders are not supported in a portal.

The model returns data for the following roles:

createdQDateTimeThe date the folder was created.PortalFolderCreatedRole
folderIdQStringThe ID of the folder.PortalFolderFolderIdRole
titleQStringThe title of the folder.PortalFolderTitleRole


Retrieve the model representing a user's folders:

// fetch the portal user's folders
QMap<QString, QString> folderTitles; // folderId and folderTitle

connect(&portalUser, &PortalUser::fetchContentCompleted, this, [&portalUser, &folderTitles](bool success)

  PortalFolderListModel* folders = portalUser.folders();

  for (int i = 0; i < folders->size(); ++i)
    PortalFolder folder = folders->at(i);
    folderTitles[folder.folderId()] = folder.title();
    qDebug() << folder.title();


See also PortalUser and PortalFolder.

Member Type Documentation

enum PortalFolderListModel::PortalFolderRoles

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

Esri::ArcGISRuntime::PortalFolderListModel::PortalFolderCreatedRoleQt::UserRole + 1The date the folder was created.
Esri::ArcGISRuntime::PortalFolderListModel::PortalFolderFolderIdRoleQt::UserRole + 2The ID of the folder.
Esri::ArcGISRuntime::PortalFolderListModel::PortalFolderTitleRoleQt::UserRole + 3The title of the folder.

Member Function Documentation

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

Signal emitted when an error occurs.

  • error - Details about the error.

[signal] void PortalFolderListModel::portalFolderAdded(int index)

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

index is the index of the added PortalFolder.

[signal] void PortalFolderListModel::portalFolderRemoved(int index)

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

index is the index of the removed PortalFolder.

[override virtual] PortalFolderListModel::~PortalFolderListModel()


[override virtual] Esri::ArcGISRuntime::PortalFolder PortalFolderListModel::at(int index) const

Returns the PortalFolder at the specified index.

bool PortalFolderListModel::contains(const Esri::ArcGISRuntime::PortalFolder &portalFolder) const

Returns true if the list model contains the PortalFolder portalFolder.

[override virtual] QVariant PortalFolderListModel::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 folder 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::PortalFolder PortalFolderListModel::first() const

Returns the first PortalFolder in the list model.

int PortalFolderListModel::indexOf(const Esri::ArcGISRuntime::PortalFolder &portalFolder) const

Returns the index of the PortalFolder portalFolder.

bool PortalFolderListModel::isEmpty() const

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

Esri::ArcGISRuntime::PortalFolder PortalFolderListModel::last() const

Returns the last PortalFolder in the list model.

[override virtual] int PortalFolderListModel::size() const

Returns the number of PortalFolder objects contained in the list model.

Feedback on this topic?