KNewStuff

itemsmodel.h
1 /*
2  knewstuff3/ui/itemsmodel.h.
3  SPDX-FileCopyrightText: 2008 Jeremy Whiting <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7 
8 #ifndef KNEWSTUFF3_ITEMSMODEL_P_H
9 #define KNEWSTUFF3_ITEMSMODEL_P_H
10 
11 #include <QAbstractListModel>
12 
13 #include "entryinternal.h"
14 #include "knewstuffcore_export.h"
15 
16 class KJob;
17 
18 namespace KNSCore
19 {
20 class Engine;
21 
22 class KNEWSTUFFCORE_EXPORT ItemsModel: public QAbstractListModel
23 {
24  Q_OBJECT
25 public:
26  explicit ItemsModel(Engine *engine, QObject *parent = nullptr);
27  ~ItemsModel() override;
28 
29  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
30  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
36  int row(const EntryInternal &entry) const;
37 
38  void addEntry(const EntryInternal &entry);
39  void removeEntry(const EntryInternal &entry);
40 
41  bool hasPreviewImages() const;
42  bool hasWebService() const;
43 
44 Q_SIGNALS:
45  void jobStarted(KJob *, const QString &label);
46 
47 public Q_SLOTS:
48  void slotEntryChanged(const KNSCore::EntryInternal &entry);
49  void slotEntriesLoaded(const KNSCore::EntryInternal::List &entries);
50  void clearEntries();
51  void slotEntryPreviewLoaded(const KNSCore::EntryInternal &entry, KNSCore::EntryInternal::PreviewType type);
52 
53 private:
54  Engine *const m_engine;
55  // the list of entries
56  QList<EntryInternal> m_entries;
57  bool m_hasPreviewImages = false;
58 };
59 
60 } // end KNS namespace
61 
62 Q_DECLARE_METATYPE(KNSCore::EntryInternal)
63 
64 #endif
Contains the core functionality for handling interaction with NewStuff providers. ...
Encapsulates a KNSCore::Engine for use in Qt Quick.
Definition: quickengine.h:23
DisplayRole
A model which shows the contents found in an Engine.
KNewStuff data entry container.
Definition: entryinternal.h:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 18 2021 22:43:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.