Models registry was added

This commit is contained in:
2023-04-11 09:42:27 +02:00
parent 4a52926be9
commit 4ed4ecd429
17 changed files with 183 additions and 91 deletions

View File

@@ -3,8 +3,7 @@
#include <QAbstractListModel>
#include "models/basemodel.h"
class SettingsService;
class SettingsViewModel : public QAbstractListModel
{
Q_OBJECT
@@ -16,10 +15,14 @@ public:
QVariant data(const QModelIndex &index, int role) const override;
QHash<int, QByteArray> roleNames() const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
private:
enum Roles {
Title = Qt::UserRole + 1,
PropertyName,
Subtitle,
Value,
ControlType,
Model
};
@@ -38,10 +41,11 @@ private:
modelName(modelName) {}
};
SettingsService *settings() const;
QVariant model(const QString &modelName) const;
QVariant subtitle(const QString &propertyName, const QString &modelName) const;
QList<SettingItem> m_items;
QMap<QString, BaseModel *> m_models;
};
#endif // SETTINGSVIEWMODEL_H