Added recalculating receipt on item count changed. Some UI changes.
This commit is contained in:
@@ -74,6 +74,11 @@ void Voucher::addItem(QSharedPointer<VoucherItem> item)
|
||||
m_items.append(item);
|
||||
}
|
||||
|
||||
void Voucher::removeItem(QSharedPointer<VoucherItem> item)
|
||||
{
|
||||
m_items.removeOne(item);
|
||||
}
|
||||
|
||||
void Voucher::clearItems()
|
||||
{
|
||||
m_items.clear();
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
void setItems(const QList<QSharedPointer<VoucherItem> > &items);
|
||||
|
||||
void addItem(QSharedPointer<VoucherItem> item);
|
||||
void removeItem(QSharedPointer<VoucherItem> item);
|
||||
void clearItems();
|
||||
|
||||
private:
|
||||
|
||||
@@ -7,6 +7,7 @@ VoucherItem::VoucherItem(QObject *parent) : QObject(parent)
|
||||
m_unitPrice = 0;
|
||||
m_count = 0;
|
||||
m_refId = 0;
|
||||
m_vatType = Enums::HIGH;
|
||||
}
|
||||
|
||||
int VoucherItem::id() const
|
||||
@@ -37,6 +38,7 @@ int VoucherItem::count() const
|
||||
void VoucherItem::setCount(int count)
|
||||
{
|
||||
m_count = count;
|
||||
emit countChanged();
|
||||
}
|
||||
|
||||
QDecDouble VoucherItem::unitPrice() const
|
||||
|
||||
@@ -14,7 +14,7 @@ class VoucherItem : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
Q_PROPERTY(int count READ count WRITE setCount)
|
||||
Q_PROPERTY(int count READ count WRITE setCount NOTIFY countChanged)
|
||||
Q_PROPERTY(QDecDouble unitPrice READ unitPrice WRITE setUnitPrice)
|
||||
Q_PROPERTY(QDecDouble price READ price WRITE setPrice)
|
||||
Q_PROPERTY(Enums::VatType vatType READ vatType WRITE setVatType)
|
||||
@@ -46,6 +46,9 @@ public:
|
||||
Enums::VatType vatType() const;
|
||||
void setVatType(const Enums::VatType &vatType);
|
||||
|
||||
signals:
|
||||
void countChanged();
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
|
||||
Reference in New Issue
Block a user