KNewStuff

qtquick/commentsmodel.h
1 /*
2  SPDX-FileCopyrightText: 2019 Dan Leinir Turthra Jensen <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 
7 #ifndef KNSQUICK_COMMENTSMODEL_H
8 #define KNSQUICK_COMMENTSMODEL_H
9 
10 #include <QSortFilterProxyModel>
11 #include <QQmlParserStatus>
12 #include <entryinternal.h>
13 
14 namespace KNewStuffQuick
15 {
25 {
26  Q_OBJECT
31  Q_PROPERTY(QObject *itemsModel READ itemsModel WRITE setItemsModel NOTIFY itemsModelChanged)
35  Q_PROPERTY(int entryIndex READ entryIndex WRITE setEntryIndex NOTIFY entryIndexChanged)
42 public:
48  IncludeAllComments = 0, //< All comments should be included
49  IncludeOnlyReviews = 1, //< Only comments which have a rating (and thus is considered a review) should be included
50  IncludeReviewsAndReplies = 2, //< Reviews (as OnlyReviews), except child comments are also included
51  };
53 
54  explicit CommentsModel(QObject *parent = nullptr);
55  ~CommentsModel() override;
56  void classBegin() override;
57  void componentComplete() override;
58 
59  QObject *itemsModel() const;
60  void setItemsModel(QObject *newItemsModel);
61  Q_SIGNAL void itemsModelChanged();
62 
63  int entryIndex() const;
64  void setEntryIndex(int entryIndex);
65  Q_SIGNAL void entryIndexChanged();
66 
82 
83  bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
84 
85 private:
86  class Private;
87  Private *d;
88 };
89 }
91 #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-2021 The KDE developers.
Generated on Mon Jan 18 2021 22:43:49 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.