From bf67dadaeb92f82720902741a1c601351834f660 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Tue, 21 Mar 2017 14:31:45 +0100 Subject: [PATCH] Voucher item grid now scrolls to bottom on add new item. closes #288 --- shop/receiptloadform.cpp | 5 +++-- shop/receiptsaveform.cpp | 5 +++-- shop/shopform.cpp | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/shop/receiptloadform.cpp b/shop/receiptloadform.cpp index dc26833..2096c6e 100644 --- a/shop/receiptloadform.cpp +++ b/shop/receiptloadform.cpp @@ -67,12 +67,13 @@ void ReceiptLoadForm::on_lineEdit_textChanged(const QString &text) { QSortFilterProxyModel proxy; proxy.setSourceModel(m_voucherModel); - proxy.setFilterKeyColumn(2); + proxy.setFilterKeyColumn(3); + proxy.setFilterCaseSensitivity(Qt::CaseInsensitive); proxy.setFilterFixedString(text); QModelIndex matchingIndex = proxy.mapToSource(proxy.index(0,0)); if(matchingIndex.isValid()){ - ui->tabVouchers->scrollTo(matchingIndex,QAbstractItemView::EnsureVisible); + ui->tabVouchers->scrollTo(matchingIndex, QAbstractItemView::EnsureVisible); ui->tabVouchers->setCurrentIndex(matchingIndex); } } diff --git a/shop/receiptsaveform.cpp b/shop/receiptsaveform.cpp index 028ce51..e8cb47c 100644 --- a/shop/receiptsaveform.cpp +++ b/shop/receiptsaveform.cpp @@ -92,12 +92,13 @@ void ReceiptSaveForm::on_lineEdit_textChanged(const QString &text) { QSortFilterProxyModel proxy; proxy.setSourceModel(m_voucherModel); - proxy.setFilterKeyColumn(0); + proxy.setFilterKeyColumn(3); + proxy.setFilterCaseSensitivity(Qt::CaseInsensitive); proxy.setFilterFixedString(text); QModelIndex matchingIndex = proxy.mapToSource(proxy.index(0,0)); if(matchingIndex.isValid()){ - ui->tabVouchers->scrollTo(matchingIndex,QAbstractItemView::EnsureVisible); + ui->tabVouchers->scrollTo(matchingIndex, QAbstractItemView::EnsureVisible); ui->tabVouchers->setCurrentIndex(matchingIndex); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); } diff --git a/shop/shopform.cpp b/shop/shopform.cpp index b4e7385..11216f6 100644 --- a/shop/shopform.cpp +++ b/shop/shopform.cpp @@ -311,6 +311,8 @@ void ShopForm::addItem(QSharedPointer item, int 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(); + + ui->actualReceipt->scrollToBottom(); } void ShopForm::on_receiptCombo_currentIndexChanged(int)