File indexing completed on 2024-12-15 03:45:01

0001 /*
0002     SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: MIT
0005 */
0006 
0007 #ifndef KUSERFEEDBACK_CONSOLE_SCHEMAMODEL_H
0008 #define KUSERFEEDBACK_CONSOLE_SCHEMAMODEL_H
0009 
0010 #include <core/product.h>
0011 
0012 #include <QAbstractTableModel>
0013 
0014 namespace KUserFeedback {
0015 namespace Console {
0016 
0017 class Product;
0018 
0019 class SchemaModel : public QAbstractItemModel
0020 {
0021     Q_OBJECT
0022 public:
0023     explicit SchemaModel(QObject *parent = nullptr);
0024     ~SchemaModel() override;
0025 
0026     Product product() const;
0027     void setProduct(const Product &product);
0028 
0029     void addEntry(const QString &name);
0030     void addEntry(const SchemaEntry &entry);
0031     void addElement(const QModelIndex &parent, const QString &name);
0032     void deleteRow(const QModelIndex &idx);
0033 
0034     int rowCount(const QModelIndex &parent = QModelIndex()) const override;
0035     int columnCount(const QModelIndex &parent) const override;
0036     QVariant data(const QModelIndex &index, int role) const override;
0037     QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
0038     Qt::ItemFlags flags(const QModelIndex &index) const override;
0039     bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
0040 
0041     QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
0042     QModelIndex parent(const QModelIndex &index) const override;
0043 
0044 private:
0045     Product m_product;
0046 };
0047 
0048 }
0049 }
0050 
0051 #endif // KUSERFEEDBACK_CONSOLE_SCHEMAMODEL_H