You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

44 lines
1.5 KiB

#include "ReportsManagerDialog.h"
guiReportsManagerDialog::guiReportsManagerDialog(QWidget *parent) : QDialog(parent){
m_pCalendarWidget = new QCalendarWidget( this );
m_pSystemReport = objectEventReport::getInstance();
m_pCalendarWidget->setGridVisible(true);
connect(m_pCalendarWidget, &QCalendarWidget::selectionChanged, this, &guiReportsManagerWindow::selectReportDate);
m_pListView = new QListView( this );
m_pListModel = new QStringListModel( m_pListView );
m_pListView->setGeometry(200, 20, 300, 400);
m_pListView->setModel(m_pListModel);
};
guiReportsManagerDialog::~guiReportsManagerDialog(){
};
void guiReportsManagerDialog::selectReportDate() {
QDate sd;
struct tm STM;
sd = m_pCalendarWidget->selectedDate();
memset(&STM, 0, sizeof(struct tm));
STM.tm_year = sd.year() - 1900;
STM.tm_mon = sd.month() - 1;
STM.tm_mday = sd.day();
if (m_pSystemReport->loadReportList(&STM)) {
Rere* list;
list = m_pSystemReport->getLoaddedReports();
if (list) {
QStringList lst;
m_pListModel->removeRows(0, m_pListModel->rowCount());
for (Rere::iterator index = list->begin(); index < list->end(); index++) {
lst.append(QString(*index));
};
m_pListModel->setStringList(lst);
};
} else {
QMessageBox msgBox;
msgBox.setText("No Data");
msgBox.setInformativeText("We do not have reports to selected date.");
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Discard | QMessageBox::Cancel );
msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec();
};
};