KNewStuff

itemsmodel.h
1/*
2 knewstuff3/ui/itemsmodel.h.
3 SPDX-FileCopyrightText: 2008 Jeremy Whiting <jpwhiting@kde.org>
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#include <memory>
13
14#include "entry.h"
15#include "knewstuffcore_export.h"
16
17class KJob;
18
19namespace KNSCore
20{
21class EngineBase;
22class ItemsModelPrivate;
23
25{
26 Q_OBJECT
27public:
28 explicit ItemsModel(EngineBase *engine, QObject *parent = nullptr);
29 ~ItemsModel() override;
30
31 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
32 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
33 /**
34 * The row of the entry passed to the function, or -1 if the entry is not contained
35 * within the model.
36 * @since 5.63
37 */
38 int row(const Entry &entry) const;
39
40 void addEntry(const Entry &entry);
41 void removeEntry(const Entry &entry);
42
43 bool hasPreviewImages() const;
44 bool hasWebService() const;
45
46Q_SIGNALS:
47 void jobStarted(KJob *, const QString &label);
48 void loadPreview(const KNSCore::Entry &entry, KNSCore::Entry::PreviewType type);
49
50public Q_SLOTS:
51 void slotEntryChanged(const KNSCore::Entry &entry);
52 void slotEntriesLoaded(const KNSCore::Entry::List &entries);
53 void clearEntries();
54 void slotEntryPreviewLoaded(const KNSCore::Entry &entry, KNSCore::Entry::PreviewType type);
55
56private:
57 const std::unique_ptr<ItemsModelPrivate> d;
58};
59
60} // end KNS namespace
61
62#endif
A model which shows the contents found in an Engine.
KNewStuff data entry container.
Definition entry.h:48
DisplayRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:54:38 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.