File indexing completed on 2024-09-08 07:55:50
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 { 0011 Q_OBJECT 0012 0013 public: 0014 static FontListModel *self(); 0015 0016 explicit FontListModel(QObject *parent = nullptr); 0017 0018 enum Roles { NameRole = Qt::DisplayRole }; 0019 0020 int rowCount(const QModelIndex &parent) const override; 0021 QVariant data(const QModelIndex &index, int role) const override; 0022 QHash<int, QByteArray> roleNames() const override; 0023 0024 private: 0025 QStringList m_fontList; 0026 }; 0027 0028 class FontListSearchModel : public QSortFilterProxyModel 0029 { 0030 Q_OBJECT 0031 0032 public: 0033 static FontListSearchModel *self(); 0034 0035 explicit FontListSearchModel(QObject *parent = nullptr); 0036 };