Warning, file /frameworks/knewstuff/src/qtquick/categoriesmodel.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2019 Dan Leinir Turthra Jensen <admin@leinir.dk>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef CATEGORIESMODEL_H
0008 #define CATEGORIESMODEL_H
0009 
0010 #include <QAbstractListModel>
0011 
0012 #include "provider.h"
0013 #include "quickengine.h"
0014 
0015 class CategoriesModelPrivate;
0016 
0017 /**
0018  * @short A model which shows the categories found in an Engine
0019  * @since 5.63
0020  */
0021 class CategoriesModel : public QAbstractListModel
0022 {
0023     Q_OBJECT
0024 public:
0025     explicit CategoriesModel(Engine *parent = nullptr);
0026     ~CategoriesModel() override;
0027 
0028     enum Roles {
0029         NameRole = Qt::UserRole + 1,
0030         IdRole,
0031         DisplayNameRole,
0032     };
0033     Q_ENUMS(Roles)
0034 
0035     QHash<int, QByteArray> roleNames() const override;
0036     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
0037     int rowCount(const QModelIndex &parent = QModelIndex()) const override;
0038 
0039     /**
0040      * Get the display name for the category with the id passed to the function
0041      *
0042      * @param id The ID of the category you want to get the display name for
0043      * @return The display name (or the translated string "Unknown Category" for the requested category
0044      */
0045     Q_INVOKABLE QString idToDisplayName(const QString &id) const;
0046 
0047 private:
0048     const std::unique_ptr<CategoriesModelPrivate> d;
0049 };
0050 
0051 #endif // CATEGORIESMODEL_H