Skip To Content ArcGIS for Developers Sign In Dashboard

PortalFolderListModel 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 Iterable<PortalFolder>

Public Types

enum PortalFolderRoles { PortalFolderCreatedRole, PortalFolderFolderIdRole, PortalFolderTitleRole }

Public Functions

~PortalFolderListModel()
PortalFolder at(int index) const
bool contains(const PortalFolder &portalFolder) const
PortalFolder first() const
int indexOf(const PortalFolder &portalFolder) const
bool isEmpty() const
PortalFolder last() const
int size() const

Reimplemented Public Functions

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

Signals

void errorOccurred(Esri::ArcGISRuntime::Error error)
void portalFolderAdded(int index)
void portalFolderRemoved(int index)

Additional Inherited Members

Detailed Description

Represents the folders in the root folder of a user.

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:

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

Example:

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)
{
  if(!success)
    return;

  PortalFolderListModel* folders = portalUser.folders();
  Q_CHECK_PTR(folders);

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

portalUser.fetchContent();

See also PortalUser and PortalFolder.

Member Type Documentation

enum PortalFolderListModel::PortalFolderRoles

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

ConstantValueDescription
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

PortalFolderListModel::~PortalFolderListModel()

Destructor.

PortalFolder PortalFolderListModel::at(int index) const

Returns the PortalFolder at the specified index.

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

Returns true if the list model contains the PortalFolder portalFolder.

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

Reimplemented from QAbstractItemModel::data().

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.

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

Signal emitted when an error occurs.

  • error - Details about the error.

PortalFolder PortalFolderListModel::first() const

Returns the first PortalFolder in the list model.

int PortalFolderListModel::indexOf(const 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).

PortalFolder PortalFolderListModel::last() const

Returns the last PortalFolder in the list model.

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

int PortalFolderListModel::size() const

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


Feedback on this topic?