Choice model settings was added
This commit is contained in:
38
viewmodels/productsviewmodel.h
Normal file
38
viewmodels/productsviewmodel.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef PRODUCTSVIEWMODEL_H
|
||||
#define PRODUCTSVIEWMODEL_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "models/basemodel.h"
|
||||
|
||||
class SettingsService;
|
||||
class ProductsViewModel : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QVariantList products READ products NOTIFY productsChanged)
|
||||
Q_PROPERTY(QVariantList order READ order NOTIFY orderChanged)
|
||||
Q_PROPERTY(float orderSum READ orderSum NOTIFY orderChanged)
|
||||
|
||||
public:
|
||||
explicit ProductsViewModel(QObject *parent = nullptr);
|
||||
|
||||
QVariantList products() const;
|
||||
QVariantList order() const;
|
||||
float orderSum() const;
|
||||
|
||||
Q_INVOKABLE void setOrderValue(const QString &productId, float value);
|
||||
Q_INVOKABLE void submitOrder();
|
||||
|
||||
signals:
|
||||
void productsChanged();
|
||||
void orderChanged();
|
||||
|
||||
private:
|
||||
SettingsService *settings() const;
|
||||
|
||||
BaseModel m_productsModel = BaseModel("products", this);
|
||||
QVariantMap m_order;
|
||||
};
|
||||
|
||||
#endif // PRODUCTSVIEWMODEL_H
|
||||
Reference in New Issue
Block a user