Added possibility to add custom widget to GridForm. Small fix in ReportDialog.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class ReportDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ReportDialog(QWidget *parent = 0);
|
||||
explicit ReportDialog(bool recordSelected = false, QWidget *parent = 0);
|
||||
~ReportDialog();
|
||||
|
||||
void setReports(ReportList reports);
|
||||
@@ -28,6 +28,7 @@ private slots:
|
||||
private:
|
||||
Ui::ReportDialog *ui;
|
||||
ReportList m_reports;
|
||||
bool m_recordSelected;
|
||||
};
|
||||
|
||||
#endif // REPORTDIALOG_H
|
||||
|
||||
Reference in New Issue
Block a user