File indexing completed on 2024-09-15 10:31:37
0001 // SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org> 0002 // SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 #pragma once 0005 0006 #include <QAbstractListModel> 0007 #include <QSortFilterProxyModel> 0008 0009 class FontListModel : public QAbstractListModel { 0010 Q_OBJECT 0011 0012 public: 0013 static FontListModel *self(); 0014 0015 explicit FontListModel(QObject *parent = nullptr); 0016 0017 enum Roles { 0018 NameRole = Qt::DisplayRole 0019 }; 0020 0021 int rowCount(const QModelIndex &parent) const override; 0022 QVariant data(const QModelIndex &index, int role) const override; 0023 QHash<int, QByteArray> roleNames() const override; 0024 0025 private: 0026 QStringList m_fontList; 0027 }; 0028 0029 class FontListSearchModel : public QSortFilterProxyModel { 0030 Q_OBJECT 0031 0032 public: 0033 static FontListSearchModel *self(); 0034 0035 explicit FontListSearchModel(QObject *parent = nullptr); 0036 };