Optimized loading of vouchers for Paid Vouchers Dialog.

master
Josef Rokos 6 years ago
parent 2f1250e61d
commit bb5b136aea

@ -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 &current, const QModelIndex &) {
QSharedPointer<Voucher> voucher = m_voucherModel->itemFromIndex(current);

Loading…
Cancel
Save