Rests view was added
This commit is contained in:
35
viewmodels/restsviewmodel.h
Normal file
35
viewmodels/restsviewmodel.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef RESTSVIEWMODEL_H
|
||||
#define RESTSVIEWMODEL_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "services/modelsregister.h"
|
||||
|
||||
class SettingsService;
|
||||
class RestsViewModel : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QVariantList products READ products NOTIFY productsChanged)
|
||||
|
||||
public:
|
||||
explicit RestsViewModel(QObject *parent = nullptr);
|
||||
|
||||
QVariantList products() const;
|
||||
|
||||
Q_INVOKABLE void setProductRest(const QString &productId, float rest);
|
||||
|
||||
signals:
|
||||
void productsChanged();
|
||||
|
||||
private:
|
||||
SettingsService *settings() const;
|
||||
void reloadRests();
|
||||
|
||||
BaseModel *m_productsModel = ModelsRegister::model("products");
|
||||
BaseModel *m_restsModel = ModelsRegister::model("rests");
|
||||
|
||||
QMap<QString, QVariantMap> m_rests;
|
||||
};
|
||||
|
||||
#endif // RESTSVIEWMODEL_H
|
||||
Reference in New Issue
Block a user