|
|
|
@ -6,11 +6,12 @@
|
|
|
|
|
|
|
|
|
|
#include "reportviewer.h"
|
|
|
|
|
|
|
|
|
|
ReportDialog::ReportDialog(QWidget *parent) :
|
|
|
|
|
ReportDialog::ReportDialog(bool recordSelected, QWidget *parent) :
|
|
|
|
|
QDialog(parent),
|
|
|
|
|
ui(new Ui::ReportDialog)
|
|
|
|
|
{
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
m_recordSelected = recordSelected;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReportDialog::~ReportDialog()
|
|
|
|
@ -33,6 +34,7 @@ void ReportDialog::setReports(ReportList reports)
|
|
|
|
|
|
|
|
|
|
foreach (ReportPtr report, reports) {
|
|
|
|
|
QStandardItem *item = new QStandardItem((report->listReport() ? QIcon(":/icons/list.svg") : QIcon(":/icons/report.svg")), report->name());
|
|
|
|
|
item->setEnabled(report->listReport() || m_recordSelected);
|
|
|
|
|
model->appendRow(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -41,14 +43,13 @@ void ReportDialog::setReports(ReportList reports)
|
|
|
|
|
|
|
|
|
|
connect(ui->listReports->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](const QModelIndex, QModelIndex){
|
|
|
|
|
ui->textDescription->setText(m_reports[ui->listReports->currentIndex().row()]->description());
|
|
|
|
|
ui->btnPreview->setEnabled(ui->listReports->currentIndex().isValid());
|
|
|
|
|
ui->btnPrint->setEnabled(ui->listReports->currentIndex().isValid());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!reports.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
ui->btnPreview->setEnabled(true);
|
|
|
|
|
ui->btnPrint->setEnabled(true);
|
|
|
|
|
|
|
|
|
|
ui->listReports->setCurrentIndex(model->index(0, 0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|