#include "directsaleform.h" #include "ui_directsaleform.h" DirectSaleForm::DirectSaleForm(QWidget *parent, Enums::VatType defaultVat) : QDialog(parent), ui(new Ui::DirectSaleForm) { ui->setupUi(this); m_shopItem = QSharedPointer(new DirectSaleItem); m_shopItem->setVatType(defaultVat); m_binder.setData(m_shopItem.data()); m_binder.registerBinding(ui->name); m_binder.registerBinding(ui->unitPrice); m_binder.registerBinding(ui->count); QList vt; vt << ComboData(Enums::NONE,tr("None")) << ComboData(Enums::HIGH,tr("High")) << ComboData(Enums::FIRST_LOWER,tr("First Lower")) << ComboData(Enums::SECOND_LOWER,tr("Second Lower")); m_binder.registerBinding(ui->vatType, vt); m_binder.bindToUi(); } DirectSaleForm::~DirectSaleForm() { delete ui; } QSharedPointer DirectSaleForm::shopItem() const { return m_shopItem; } void DirectSaleForm::on_buttonBox_rejected() { this->reject(); } void DirectSaleForm::on_buttonBox_accepted() { m_binder.bindToData(); this->accept(); }