Merge branch 'master' of https://git.bukova.info/repos/git/prodejna
This commit is contained in:
+22
-2
@@ -62,6 +62,7 @@ void ShopForm::loadLast()
|
||||
if (m_commodityModel == NULL)
|
||||
{
|
||||
m_commodityModel = new AutoTableModel<ShopItem>(this);
|
||||
m_commodityModel->setTranslations(Context::instance().plugin("SHOP")->translations());
|
||||
ui->commodityTable->setModel(m_commodityModel);
|
||||
|
||||
connect(ui->commodityTable->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](const QModelIndex ¤t, const QModelIndex &){
|
||||
@@ -70,6 +71,8 @@ void ShopForm::loadLast()
|
||||
}
|
||||
|
||||
m_commodityModel->setData(srv.allSellableItems());
|
||||
ui->commodityTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
|
||||
ui->commodityTable->setColumnHidden(3, true);
|
||||
}
|
||||
|
||||
void ShopForm::fillRaceiptCombo()
|
||||
@@ -132,10 +135,27 @@ void ShopForm::on_loadButton_clicked()
|
||||
{
|
||||
ReceiptLoadForm *form = new ReceiptLoadForm(this);
|
||||
form->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
connect(form, &QDialog::accepted, [this, form](){
|
||||
ShopService srv;
|
||||
|
||||
if (m_voucher.isNull())
|
||||
{
|
||||
m_voucher = srv.createVoucher();
|
||||
}
|
||||
|
||||
srv.moveItems(form->selectedItems(), form->selectedVoucher(), this->m_voucher);
|
||||
|
||||
m_itemsModel->setData(m_voucher->items());
|
||||
|
||||
connectItemSignals();
|
||||
onCountChanged();
|
||||
});
|
||||
|
||||
form->show();
|
||||
}
|
||||
|
||||
void ShopForm::onCountChanged(int oldCount)
|
||||
void ShopForm::onCountChanged(int oldCount/* = 0*/)
|
||||
{
|
||||
VoucherItem *item = qobject_cast<VoucherItem*>(sender());
|
||||
if (item != NULL && item->count() == 0)
|
||||
@@ -253,7 +273,7 @@ void ShopForm::addItem(QSharedPointer<IShopItem> item, int count)
|
||||
srv.addShopItem(m_voucher, item, count);
|
||||
this->m_itemsModel->addRow(m_voucher->items()[m_voucher->items().count() - 1]);
|
||||
connect(m_voucher->items()[m_voucher->items().count() - 1].data(), SIGNAL(countChanged(int)), this, SLOT(onCountChanged(int)));
|
||||
onCountChanged(0);
|
||||
onCountChanged();
|
||||
}
|
||||
|
||||
void ShopForm::on_receiptCombo_currentIndexChanged(int)
|
||||
|
||||
Reference in New Issue
Block a user