KNewStuff

qtquick/commentsmodel.h
1 /*
2  * Copyright (C) 2019 Dan Leinir Turthra Jensen <[email protected]>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) version 3, or any
8  * later version accepted by the membership of KDE e.V. (or its
9  * successor approved by the membership of KDE e.V.), which shall
10  * act as a proxy defined in Section 6 of version 3 of the license.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef KNSQUICK_COMMENTSMODEL_H
23 #define KNSQUICK_COMMENTSMODEL_H
24 
25 #include <QSortFilterProxyModel>
26 #include <QQmlParserStatus>
27 #include <entryinternal.h>
28 
29 namespace KNewStuffQuick
30 {
40 {
41  Q_OBJECT
46  Q_PROPERTY(QObject *itemsModel READ itemsModel WRITE setItemsModel NOTIFY itemsModelChanged)
50  Q_PROPERTY(int entryIndex READ entryIndex WRITE setEntryIndex NOTIFY entryIndexChanged)
57 public:
63  IncludeAllComments = 0, //< All comments should be included
64  IncludeOnlyReviews = 1, //< Only comments which have a rating (and thus is considered a review) should be included
65  IncludeReviewsAndReplies = 2 //< Reviews (as OnlyReviews), except child comments are also included
66  };
68 
69  explicit CommentsModel(QObject *parent = nullptr);
70  ~CommentsModel() override;
71  void classBegin() override;
72  void componentComplete() override;
73 
74  QObject *itemsModel() const;
75  void setItemsModel(QObject *newItemsModel);
76  Q_SIGNAL void itemsModelChanged();
77 
78  int entryIndex() const;
79  void setEntryIndex(int entryIndex);
80  Q_SIGNAL void entryIndexChanged();
81 
97 
98  bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
99 
100 private:
101  class Private;
102  Private *d;
103 };
104 }
106 #endif//KNSQUICK_COMMENTSMODEL_H
Q_ENUM(...)
Encapsulates a KNSCore::CommentsModel for use in Qt Quick.
IncludedComments
The options which can be set for which comments to include.
CommentsModel::IncludedComments includedComments() const
Which comments should be included.
int entryIndex
The index in the model of the entry to fetch comments for.
Q_OBJECTQ_OBJECT
Q_SIGNAL void includedCommentsChanged()
Fired when the value of includedComments changes.
QObject itemsModel
The KNewStufQuick::ItemsModel to interact with servers through.
void setIncludedComments(CommentsModel::IncludedComments includedComments)
Set which comments should be included.
Q_PROPERTY(...)
Q_SIGNALQ_SIGNAL
Q_INTERFACES(...)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Aug 9 2020 22:43:40 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.