Added support for binding QDecimal values.

This commit is contained in:
2016-02-19 15:34:52 +01:00
parent 046c64b312
commit 8e999c7818
12 changed files with 70 additions and 17 deletions
+5 -4
View File
@@ -1,4 +1,5 @@
#include "accservice.h"
#include <define.h>
AccService::AccService()
{
@@ -14,14 +15,14 @@ void AccService::setId(int id)
{
m_id = id;
}
int AccService::price() const
QDecDouble AccService::price() const
{
return m_price;
return QDecDouble((double)m_price / DEC_MULTIPLE);
}
void AccService::setPrice(int price)
void AccService::setPrice(QDecDouble price)
{
m_price = price;
m_price = price.toDouble() * DEC_MULTIPLE;
}
bool AccService::active() const
{
+4 -3
View File
@@ -3,6 +3,7 @@
#include <QObject>
#include <QString>
#include <QDecDouble.hh>
#include <odb/core.hxx>
@@ -15,7 +16,7 @@ class AccService : public QObject
Q_PROPERTY(QString accServiceName READ accServiceName WRITE setAccServiceName)
Q_PROPERTY(QString accServiceCode READ accServiceCode WRITE setAccServiceCode)
Q_PROPERTY(int price READ price WRITE setPrice)
Q_PROPERTY(QDecDouble price READ price WRITE setPrice)
Q_PROPERTY(bool active READ active WRITE setActive)
Q_PROPERTY(bool salePossible READ salePossible WRITE setSalePossible)
Q_PROPERTY(ServiceType serviceType READ serviceType WRITE setServiceType)
@@ -32,8 +33,8 @@ public:
int id() const;
void setId(int id);
int price() const;
void setPrice(int price);
QDecDouble price() const;
void setPrice(QDecDouble price);
bool active() const;
void setActive(bool active);