Fixed crash on add item via favorite button after application start.
Favorite buttons has short name labels. closes #296 refs #293
This commit is contained in:
+7
-11
@@ -83,6 +83,7 @@ void ShopForm::loadLast()
|
||||
m_commodityModel->setData(srv.allSellableItems());
|
||||
ui->commodityTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
|
||||
ui->commodityTable->setColumnHidden(3, true);
|
||||
ui->commodityTable->setColumnHidden(2, true);
|
||||
|
||||
if (srv.isEetEnabled())
|
||||
{
|
||||
@@ -124,7 +125,7 @@ void ShopForm::loadButtons()
|
||||
|
||||
if (btnMap[btnName] != NULL)
|
||||
{
|
||||
btn->setText(btnMap[btnName]->name());
|
||||
btn->setText(btnMap[btnName]->shortName());
|
||||
connect(btn, &FavButton::clicked, [this, btnMap, btn](bool){
|
||||
FavoritItemPtr item = btnMap[btn->objectName()];
|
||||
|
||||
@@ -161,11 +162,6 @@ void ShopForm::fillRaceiptCombo()
|
||||
|
||||
void ShopForm::on_directSale_clicked()
|
||||
{
|
||||
if (m_voucher.isNull())
|
||||
{
|
||||
createVoucher();
|
||||
}
|
||||
|
||||
DirectSaleForm *form = new DirectSaleForm(this);
|
||||
form->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
@@ -357,6 +353,11 @@ void ShopForm::createEmptyVoucher()
|
||||
|
||||
void ShopForm::addItem(QSharedPointer<IShopItem> item, int count)
|
||||
{
|
||||
if (m_voucher.isNull())
|
||||
{
|
||||
createVoucher();
|
||||
}
|
||||
|
||||
ShopService srv;
|
||||
srv.addShopItem(m_voucher, item, count);
|
||||
this->m_itemsModel->addRow(m_voucher->items()[m_voucher->items().count() - 1]);
|
||||
@@ -443,11 +444,6 @@ void ShopForm::on_showPaiedButton_clicked()
|
||||
|
||||
void ShopForm::on_btnAddItem_clicked()
|
||||
{
|
||||
if (m_voucher.isNull())
|
||||
{
|
||||
createVoucher();
|
||||
}
|
||||
|
||||
ShopItemPtr item = m_commodityModel->itemFromIndex(ui->commodityTable->currentIndex());
|
||||
addItem(item, ui->spnCount->value());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user