File indexing completed on 2025-04-27 04:08:14

0001 /*
0002  * This file is part of the KDE project
0003  * SPDX-FileCopyrightText: 2014 Arjen Hiemstra <ahiemstra@heimr.nl>
0004  *
0005  * SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #ifndef COLORMODELMODEL_H
0009 #define COLORMODELMODEL_H
0010 
0011 #include <QAbstractListModel>
0012 
0013 class ColorModelModel : public QAbstractListModel
0014 {
0015     Q_OBJECT
0016 
0017 public:
0018     enum Roles {
0019         TextRole = Qt::UserRole + 1,
0020     };
0021 
0022     ColorModelModel(QObject *parent = nullptr);
0023     ~ColorModelModel() override;
0024     QHash<int, QByteArray> roleNames() const override;
0025     int rowCount(const QModelIndex &parent) const override;
0026     QVariant data(const QModelIndex &index, int role) const override;
0027 
0028     Q_INVOKABLE QString id(int index);
0029     Q_INVOKABLE int indexOf(const QString& id);
0030 
0031 private:
0032     class Private;
0033     Private * const d;
0034 };
0035 
0036 #endif // COLORMODELMODEL_H