1/*
2 SPDX-FileCopyrightText: 2021 Kai Uwe Broulik <kde@broulik.de>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KICONDIALOGMODEL_P_H
8#define KICONDIALOGMODEL_P_H
9
10#include <QAbstractListModel>
11#include <QList>
12#include <QPixmap>
13#include <QSize>
14#include <QString>
15#include <QStringList>
16
17class KIconLoader;
18
19struct KIconDialogModelData {
20 QString name;
21 QString path;
22 QPixmap pixmap;
23};
24Q_DECLARE_TYPEINFO(KIconDialogModelData, Q_RELOCATABLE_TYPE);
25
26class KIconDialogModel : public QAbstractListModel
27{
28 Q_OBJECT
29
30public:
31 KIconDialogModel(KIconLoader *loader, QObject *parent);
32 ~KIconDialogModel() override;
33
34 enum Roles { PathRole = Qt::UserRole };
35
36 qreal devicePixelRatio() const;
37 void setDevicePixelRatio(qreal dpr);
38
39 QSize iconSize() const;
40 void setIconSize(const QSize &iconSize);
41
42 static QLatin1String symbolicSuffix();
43 bool hasSymbolicIcon() const;
44
45 void load(const QStringList &paths);
46
47 int rowCount(const QModelIndex &parent) const override;
48 QVariant data(const QModelIndex &index, int role) const override;
49
50Q_SIGNALS:
51 void hasSymbolicIconChanged(bool hasSymbolicIcon);
52
53private:
54 void loadPixmap(const QModelIndex &index);
55
56 QList<KIconDialogModelData> m_data;
57
58 KIconLoader *m_loader;
59 qreal m_dpr = 1;
60 QSize m_iconSize;
61 bool m_hasSymbolicIcon = false;
62};
63
64#endif // KICONDIALOGMODEL_P_H
65

source code of kiconthemes/src/widgets/kicondialogmodel_p.h