File indexing completed on 2024-04-21 05:54:07

0001 /**
0002  * SPDX-FileCopyrightText: 2021 by Alexander Stippich <a.stippich@gmx.net>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #ifndef FORMAT_MODEL_H
0008 #define FORMAT_MODEL_H
0009 
0010 #include <QAbstractListModel>
0011 
0012 #include <memory>
0013 
0014 class FormatModelPrivate;
0015 
0016 class FormatModel : public QAbstractListModel
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     enum FormatModelRoles { NameRole = Qt::UserRole + 1, SuffixRole, CommentRole, NameFilterRole};
0022 
0023     Q_ENUM(FormatModelRoles)
0024 
0025     explicit FormatModel(QObject *parent = nullptr);
0026 
0027     ~FormatModel();
0028 
0029     QHash<int, QByteArray> roleNames() const override;
0030 
0031     int rowCount(const QModelIndex &parent = QModelIndex()) const override;
0032 
0033     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
0034 
0035     Q_INVOKABLE QVariant getData(int index, int role) const;
0036 
0037     Q_INVOKABLE QVariantList formatFilter() const;
0038 
0039     Q_INVOKABLE QString pdfFormatFilter() const;
0040 
0041 private:
0042     std::unique_ptr<FormatModelPrivate> d;
0043 };
0044 
0045 
0046 #endif // FORMAT_MODEL_H