This commit is contained in:
2017-04-25 21:40:03 +02:00
3 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -151,7 +151,7 @@ public:
const char *prop = rawEntity->metaObject()->property(column + 1).name();
std::sort(ALL(m_list), [prop, order](QSharedPointer<T> entA, QSharedPointer<T> entB) -> bool {
if (order == Qt::AscendingOrder) {
if (order == Qt::DescendingOrder) {
return ((QObject*)entA.data())->property(prop) < ((QObject*)entB.data())->property(prop);
} else {
return ((QObject*)entB.data())->property(prop) < ((QObject*)entA.data())->property(prop);
+3 -1
View File
@@ -16,11 +16,12 @@ PaydVouchersDialog::PaydVouchersDialog(QWidget *parent) :
m_voucherModel = new AutoTableModel<Voucher>(this);
m_itemModel = new AutoTableModel<VoucherItem>(this);
m_voucherModel->setTranslations(Context::instance().plugin("SHOP")->translations());
m_itemModel->setTranslations(Context::instance().plugin("SHOP")->translations());
ui->tableVouchers->setModel(m_voucherModel);
ui->tableItems->setModel(m_itemModel);
ui->tableVouchers->setSortingEnabled(true);
ui->tableVouchers->setColumnHidden(2, true);
ui->tableVouchers->setColumnHidden(6, true);
ui->tableVouchers->setColumnHidden(7, true);
@@ -43,6 +44,7 @@ PaydVouchersDialog::PaydVouchersDialog(QWidget *parent) :
ShopService srv;
m_voucherModel->setData(srv.paiedVouchers());
ui->tableVouchers->sortByColumn(0,Qt::AscendingOrder);
connect(ui->tableVouchers->selectionModel(), &QItemSelectionModel::currentRowChanged, [this, &srv](const QModelIndex &current, const QModelIndex &) {
QSharedPointer<Voucher> voucher = m_voucherModel->itemFromIndex(current);
+1
View File
@@ -512,4 +512,5 @@ void ShopForm::on_commoditySearch_returnPressed()
ShopItemPtr item = m_commodityModel->itemFromIndex(ui->commodityTable->currentIndex());
addItem(item, ui->spnCount->value());
}
ui->commoditySearch->clear();
}