PortalFolderListModel Class

  • PortalFolderListModel
  • class Esri::ArcGISRuntime::PortalFolderListModel

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

    Header: #include <PortalFolderListModel.h>
    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

    Signals

    void errorOccurred(Esri::ArcGISRuntime::Error error)
    void itemAdded(int index)
    void itemRemoved(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:

    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

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

    Signal emitted when an error occurs.

    • error - Details about the error.

    [signal] void PortalFolderListModel::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 PortalFolderListModel::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] PortalFolderListModel::~PortalFolderListModel()

    Destructor.

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

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