File indexing completed on 2024-05-05 17:33:56
0001 /* 0002 * SPDX-FileCopyrightText: 2012 Reza Fatahilah Shah <rshah0385@kireihana.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef ACTIVE_COMIC_MODEL_H 0008 #define ACTIVE_COMIC_MODEL_H 0009 0010 #include <QStandardItemModel> 0011 0012 class ActiveComicModel : public QStandardItemModel 0013 { 0014 Q_OBJECT 0015 Q_PROPERTY(int count READ count NOTIFY countChanged) 0016 0017 public: 0018 enum Roles { 0019 ComicKeyRole = Qt::UserRole + 1, 0020 ComicTitleRole = Qt::UserRole + 2, 0021 ComicIconRole = Qt::UserRole + 3, 0022 ComicHighlightRole = Qt::UserRole + 4, 0023 }; 0024 0025 explicit ActiveComicModel(QObject *parent = nullptr); 0026 0027 QHash<int, QByteArray> roleNames() const override; 0028 0029 void addComic(const QString &key, const QString &title, const QIcon &icon, bool highlight = true); 0030 0031 int count() 0032 { 0033 return rowCount(QModelIndex()); 0034 } 0035 0036 Q_INVOKABLE QVariantHash get(int i) const; 0037 0038 Q_SIGNALS: 0039 void countChanged(); 0040 }; 0041 0042 #endif