diff --git a/core/autotablemodel.h b/core/autotablemodel.h index 1fd9aed..a45046e 100644 --- a/core/autotablemodel.h +++ b/core/autotablemodel.h @@ -221,6 +221,24 @@ public: return ret; } + void setSelectAll(bool select) { + if (!m_checkboxSelect) { + return; + } + + beginResetModel(); + m_selectedRows.clear(); + + if (select) + { + for (int i = 0; i < rowCount(); i++) + { + m_selectedRows << i; + } + } + endResetModel(); + } + protected: void handleFilter(const QString &filter) override { diff --git a/shop/receiptloadform.cpp b/shop/receiptloadform.cpp index 2096c6e..9b9eba9 100644 --- a/shop/receiptloadform.cpp +++ b/shop/receiptloadform.cpp @@ -77,3 +77,8 @@ void ReceiptLoadForm::on_lineEdit_textChanged(const QString &text) ui->tabVouchers->setCurrentIndex(matchingIndex); } } + +void ReceiptLoadForm::on_selectAllCheck_clicked(bool checked) +{ + m_itemModel->setSelectAll(checked); +} diff --git a/shop/receiptloadform.h b/shop/receiptloadform.h index f49954d..8fb8462 100644 --- a/shop/receiptloadform.h +++ b/shop/receiptloadform.h @@ -22,6 +22,8 @@ public: private slots: void on_lineEdit_textChanged(const QString &text); + void on_selectAllCheck_clicked(bool checked); + private: Ui::ReceiptLoadForm *ui; AutoTableModel *m_voucherModel; diff --git a/shop/receiptloadform.ui b/shop/receiptloadform.ui index 697bec1..983c09c 100644 --- a/shop/receiptloadform.ui +++ b/shop/receiptloadform.ui @@ -50,7 +50,21 @@ - + + + Select &all + + + + + + + QAbstractItemView::ExtendedSelection + + + QAbstractItemView::SelectRows + +