Optimized loading of vouchers for Paid Vouchers Dialog.
This commit is contained in:
+5
-1
@@ -9,6 +9,7 @@
|
||||
#include <season.h>
|
||||
#include <odb/core.hxx>
|
||||
#include <odb/qt/list.hxx>
|
||||
#include <odb/section.hxx>
|
||||
|
||||
#include "voucheritem.h"
|
||||
|
||||
@@ -171,6 +172,9 @@ public:
|
||||
QDateTime updated() const;
|
||||
void setUpdated(const QDateTime &updated);
|
||||
|
||||
#pragma db load(lazy)
|
||||
odb::section m_itemsSection;
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
@@ -198,7 +202,7 @@ private:
|
||||
QString m_eetPkp;
|
||||
QString m_eetBkp;
|
||||
QString m_eetFik;
|
||||
#pragma db value_not_null inverse(m_voucher)
|
||||
#pragma db value_not_null inverse(m_voucher) section(m_itemsSection)
|
||||
QOdbList<QSharedPointer<VoucherItem> > m_items;
|
||||
VoucherStatus m_status;
|
||||
SeasonPtr m_season;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "ui_paydvouchersdialog.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QScroller>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "receiptgenerator.h"
|
||||
#include "shopservice.h"
|
||||
@@ -47,13 +47,12 @@ PaydVouchersDialog::PaydVouchersDialog(QWidget *parent) :
|
||||
|
||||
ui->tableItems->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
|
||||
ui->tableItems->setColumnHidden(0, true);
|
||||
ui->tableItems->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 30px; }");
|
||||
|
||||
ShopService srv;
|
||||
m_voucherModel->setData(srv.paiedVouchers());
|
||||
ui->tableVouchers->sortByColumn(0,Qt::AscendingOrder);
|
||||
|
||||
QScroller::grabGesture(ui->tableVouchers, QScroller::LeftMouseButtonGesture);
|
||||
QScroller::grabGesture(ui->tableItems, QScroller::LeftMouseButtonGesture);
|
||||
ui->tableVouchers->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 30px; }");
|
||||
|
||||
connect(ui->tableVouchers->selectionModel(), &QItemSelectionModel::currentRowChanged, [this, &srv](const QModelIndex ¤t, const QModelIndex &) {
|
||||
QSharedPointer<Voucher> voucher = m_voucherModel->itemFromIndex(current);
|
||||
|
||||
Reference in New Issue
Block a user