You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prodejna/shop/directsaleform.cpp

47 lines
1.1 KiB
C++

#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<DirectSaleItem>(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<ComboData> 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<IShopItem> DirectSaleForm::shopItem() const
{
return m_shopItem;
}
void DirectSaleForm::on_buttonBox_rejected()
{
this->reject();
}
void DirectSaleForm::on_buttonBox_accepted()
{
m_binder.bindToData();
this->accept();
}