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
24class KNEWSTUFFCORE_EXPORT ItemsModel : public QAbstractListModel
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
45Q_SIGNALS:
46 void jobStarted(KJob *, const QString &label);
47 void loadPreview(const KNSCore::Entry &entry, KNSCore::Entry::PreviewType type);
48
49public Q_SLOTS:
50 void slotEntryChanged(const KNSCore::Entry &entry);
51 void slotEntriesLoaded(const KNSCore::Entry::List &entries);
52 void clearEntries();
53 void slotEntryPreviewLoaded(const KNSCore::Entry &entry, KNSCore::Entry::PreviewType type);
54
55private:
56 const std::unique_ptr<ItemsModelPrivate> d;
57};
58
59} // end KNS namespace
60
61#endif
KNewStuff engine.
Definition enginebase.h:56
DisplayRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:50:44 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.