diff --git a/shop/paydialog.cpp b/shop/paydialog.cpp index 7e61370..7a90a9f 100644 --- a/shop/paydialog.cpp +++ b/shop/paydialog.cpp @@ -32,12 +32,10 @@ void PayDialog::on_recieved_valueChanged(double value) { if (value >= m_total.toDouble()) { - ui->buttonBox->setEnabled(true); ui->labelReturn->setText(QString::number(value - m_total.toDouble(), 'f', 2)); } else { - ui->buttonBox->setEnabled(false); ui->labelReturn->setText(QString::number(0, 'f', 2)); } } diff --git a/shop/paydialog.ui b/shop/paydialog.ui index 25db67f..b9624d5 100644 --- a/shop/paydialog.ui +++ b/shop/paydialog.ui @@ -108,7 +108,7 @@ - false + true Qt::Horizontal diff --git a/shop/settings/shopsettingsform.cpp b/shop/settings/shopsettingsform.cpp index 0e94462..b25fdf1 100644 --- a/shop/settings/shopsettingsform.cpp +++ b/shop/settings/shopsettingsform.cpp @@ -102,7 +102,7 @@ void ShopSettingsForm::loadEntity() ui->tableItems->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch); ui->tableItems->setColumnHidden(0, true); ui->tableItems->setColumnHidden(2, true); - ui->tableItems->setColumnHidden(3, true); + ui->tableItems->setColumnHidden(4, true); Service srvFav; diff --git a/shop/shop.cpp b/shop/shop.cpp index 4f6ae67..bc2c7b7 100644 --- a/shop/shop.cpp +++ b/shop/shop.cpp @@ -26,6 +26,7 @@ QWidget *Shop::ui() QWidget *uiWidget = IPlugin::ui(); qobject_cast(uiWidget)->loadLast(); qobject_cast(uiWidget)->fillRaceiptCombo(); + qobject_cast(uiWidget)->loadButtons(); return uiWidget; } diff --git a/shop/shopform.cpp b/shop/shopform.cpp index b8a4743..23c6a8d 100644 --- a/shop/shopform.cpp +++ b/shop/shopform.cpp @@ -25,6 +25,7 @@ ShopForm::ShopForm(QWidget *parent) : ui->setupUi(this); m_itemsModel = NULL; m_commodityModel = NULL; + m_itemFound = false; ui->temporarySaveButton->setEnabled(false); ui->saveButton->setEnabled(false); @@ -38,8 +39,6 @@ ShopForm::~ShopForm() void ShopForm::loadLast() { - loadButtons(); - if (m_itemsModel == NULL) { m_itemsModel = new AutoTableModel(this); @@ -82,7 +81,7 @@ void ShopForm::loadLast() m_commodityModel->setData(srv.allSellableItems()); ui->commodityTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch); - ui->commodityTable->setColumnHidden(3, true); + ui->commodityTable->setColumnHidden(4, true); ui->commodityTable->setColumnHidden(2, true); if (srv.isEetEnabled()) @@ -141,6 +140,8 @@ void ShopForm::loadButtons() } } } + + ui->commoditySearch->setFocus(); } void ShopForm::fillRaceiptCombo() @@ -365,6 +366,8 @@ void ShopForm::addItem(QSharedPointer item, int count) onCountChanged(); ui->actualReceipt->scrollToBottom(); + ui->commoditySearch->setFocus(); + ui->commoditySearch->setText(""); } void ShopForm::on_receiptCombo_currentIndexChanged(int) @@ -464,6 +467,7 @@ void ShopForm::on_commoditySearch_textChanged(const QString &text) QModelIndex matchingIndex = proxy.mapToSource(proxy.index(0,0)); if(matchingIndex.isValid()) { moveToIndex(matchingIndex); + m_itemFound = true; } else { @@ -473,6 +477,11 @@ void ShopForm::on_commoditySearch_textChanged(const QString &text) if (matchingIndex.isValid()) { moveToIndex(matchingIndex); + m_itemFound = true; + } + else + { + m_itemFound = false; } } } @@ -484,3 +493,12 @@ void ShopForm::on_lblEetState_linkActivated(const QString &) ui->lblEetState->setText(srv.isEetOnline() ? tr("Online") : tr("Offline")); } + +void ShopForm::on_commoditySearch_returnPressed() +{ + if (m_itemFound) + { + ShopItemPtr item = m_commodityModel->itemFromIndex(ui->commodityTable->currentIndex()); + addItem(item, ui->spnCount->value()); + } +} diff --git a/shop/shopform.h b/shop/shopform.h index 42ac1f8..9cf0cee 100644 --- a/shop/shopform.h +++ b/shop/shopform.h @@ -47,11 +47,14 @@ private slots: void on_lblEetState_linkActivated(const QString &link); + void on_commoditySearch_returnPressed(); + private: Ui::ShopForm *ui; QSharedPointer m_voucher; AutoTableModel *m_itemsModel; AutoTableModel *m_commodityModel; + bool m_itemFound; void createVoucher(); void doTempSave(bool comboChanged);