File indexing completed on 2024-04-21 15:02:26
0001 /* 0002 SPDX-FileCopyrightText: 2021 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef SEARCHPRESETMODEL_H 0008 #define SEARCHPRESETMODEL_H 0009 0010 #include "provider.h" 0011 #include "quickengine.h" 0012 #include <QAbstractListModel> 0013 0014 #include <memory> 0015 0016 class SearchPresetModelPrivate; 0017 0018 /** 0019 * @brief The SearchPresetModel class 0020 * 0021 * this class handles search presets. 0022 * @since 5.83 0023 */ 0024 class SearchPresetModel : public QAbstractListModel 0025 { 0026 Q_OBJECT 0027 public: 0028 explicit SearchPresetModel(Engine *parent = nullptr); 0029 ~SearchPresetModel() override; 0030 0031 enum Roles { 0032 DisplayNameRole = Qt::UserRole + 1, 0033 IconRole, 0034 }; 0035 Q_ENUMS(Roles) 0036 0037 QHash<int, QByteArray> roleNames() const override; 0038 0039 QVariant data(const QModelIndex &index, int role = DisplayNameRole) const override; 0040 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0041 0042 Q_INVOKABLE void loadSearch(const QModelIndex &index); 0043 0044 private: 0045 const std::unique_ptr<SearchPresetModelPrivate> d; 0046 }; 0047 0048 #endif // SEARCHPRESETMODEL_H