#include "directsaleform.h" #include "ui_directsaleform.h" DirectSaleForm::DirectSaleForm(QWidget *parent) : QDialog(parent), ui(new Ui::DirectSaleForm) { ui->setupUi(this); m_shopItem = QSharedPointer(new DirectSaleItem); m_binder.setData(m_shopItem.data()); m_binder.registerBinding(ui->name); m_binder.registerBinding(ui->unitPrice); m_binder.registerBinding(ui->count); 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(); }