PortalItemCommentListModel Class

  • PortalItemCommentListModel
  • class Esri::ArcGISRuntime::PortalItemCommentListModel

    Represents the list of comments relating to a PortalItem. More...

    Header: #include <PortalItemCommentListModel>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: QAbstractListModel and Esri::ArcGISRuntime::Iterable (private)

    This class was introduced in Esri::ArcGISRuntime 100.0.

    Public Types

    enum PortalItemCommentRoles { PortalItemCommentCommentRole, PortalItemCommentCommentIdRole, PortalItemCommentCreatedRole, PortalItemCommentOwnerRole }

    Public Functions

    virtual ~PortalItemCommentListModel() override
    bool contains(Esri::ArcGISRuntime::PortalItemComment *portalItemComment) const
    Esri::ArcGISRuntime::PortalItemComment *first() const
    int indexOf(Esri::ArcGISRuntime::PortalItemComment *portalItemComment) const
    bool isEmpty() const
    Esri::ArcGISRuntime::PortalItemComment *last() const

    Reimplemented Public Functions

    virtual Esri::ArcGISRuntime::PortalItemComment *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 portalItemCommentAdded(int index)
    void portalItemCommentRemoved(int index)

    Detailed Description

    Comments can be retrieved by calling fetchComments on a PortalItem and accessed via the {PortalItem::comments} {comments} method after the task is complete.

    The model returns data for the following roles:

    commentQStringThe text of the comment.PortalItemCommentCommentRole
    commentIdQStringThe ID of the comment.PortalItemCommentCommentIdRole
    createdQDateTimeThe date the comment was created.PortalItemCommentCreatedRole
    ownerQStringThe username of the user that added the comment.PortalItemCommentOwnerRole


    Accessing various roles of the model from within a QML delegate:

        anchors.fill: parent
        // acccess the comment, commentId, created and owner roles of the model
        text: "comment:" + comment + "; ID:" + commentId + "; created:" + created + "; owner: " + owner
        wrapMode: Text.WrapAnywhere

    See also PortalUser, PortalItemComment, and PortalItem.

    Member Type Documentation

    enum PortalItemCommentListModel::PortalItemCommentRoles

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

    Esri::ArcGISRuntime::PortalItemCommentListModel::PortalItemCommentCommentRoleQt::UserRole + 1The text of the comment.
    Esri::ArcGISRuntime::PortalItemCommentListModel::PortalItemCommentCommentIdRoleQt::UserRole + 2The ID of the comment.
    Esri::ArcGISRuntime::PortalItemCommentListModel::PortalItemCommentCreatedRoleQt::UserRole + 3The date the comment was created.
    Esri::ArcGISRuntime::PortalItemCommentListModel::PortalItemCommentOwnerRoleQt::UserRole + 4The username of the user that added the comment.

    Member Function Documentation

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

    Signal emitted when an error occurs.

    • error - Details about the error.

    [signal] void PortalItemCommentListModel::portalItemCommentAdded(int index)

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

    index is the index of the added PortalItemComment.

    [signal] void PortalItemCommentListModel::portalItemCommentRemoved(int index)

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

    index is the index of the removed PortalItemComment.

    [override virtual] PortalItemCommentListModel::~PortalItemCommentListModel()


    [override virtual] Esri::ArcGISRuntime::PortalItemComment *PortalItemCommentListModel::at(int index) const

    Returns the PortalItemComment at the specified index.

    bool PortalItemCommentListModel::contains(Esri::ArcGISRuntime::PortalItemComment *portalItemComment) const

    Returns true if the list model contains the PortalItemComment portalItemComment.

    [override virtual] QVariant PortalItemCommentListModel::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 comment 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::PortalItemComment *PortalItemCommentListModel::first() const

    Returns the first PortalItemComment in the list model.

    int PortalItemCommentListModel::indexOf(Esri::ArcGISRuntime::PortalItemComment *portalItemComment) const

    Returns the index of the PortalItemComment portalItemComment.

    bool PortalItemCommentListModel::isEmpty() const

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

    Esri::ArcGISRuntime::PortalItemComment *PortalItemCommentListModel::last() const

    Returns the last PortalItemComment in the list model.

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

    Returns the number of comments 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.