-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreportselectionwidget.cpp
More file actions
105 lines (80 loc) · 2.82 KB
/
reportselectionwidget.cpp
File metadata and controls
105 lines (80 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#include "reportselectionwidget.h"
#include <QMessageBox>
#include <QInputDialog>
#include "separator.h"
ReportSelectionWidget::ReportSelectionWidget(QList<Report *>* reports, QWidget *parent) :
QWidget(parent)
,m_Layout(NULL)
,m_LabelSelect(NULL)
,m_NodeComboBoxSelectReport(NULL)
,m_ComboBoxItemNone("None")
,m_ComboBoxItemRename("Rename current Report")
,m_ComboBoxItemCreate("Create new Report")
,m_ComboBoxItemDelete("Delete current Report")
,m_ComboBoxSplitter("_______________________________________")
{
m_ReportsPtr = reports;
this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
this->InitializeWidget();
}
ReportSelectionWidget::~ReportSelectionWidget()
{
}
void ReportSelectionWidget::InitializeWidget()
{
static bool initialized = false;
if(initialized == false)
{
this->GetLayout()->addWidget(this->GetLabelSelect(),0,0);
this->GetLayout()->addWidget(this->GetNodeComboBoxSelectReport(),0,1);
this->GetLayout()->setColumnStretch(1,2);
this->setLayout(this->GetLayout());
initialized = true;
}
}
void ReportSelectionWidget::UpdateReportSelectorNodeComboBox(Report* currentReport)
{
this->UpdateListReportNames();
if(currentReport)
this->GetNodeComboBoxSelectReport()->Update(currentReport->GetReportName());
else
this->GetNodeComboBoxSelectReport()->Update();
}
QGridLayout* ReportSelectionWidget::GetLayout()
{
if(m_Layout == NULL)
{
m_Layout = new QGridLayout(this);
}
return m_Layout;
}
QLabel* ReportSelectionWidget::GetLabelSelect()
{
if(m_LabelSelect == NULL)
{
m_LabelSelect = new QLabel("Select Report:", this);
}
return m_LabelSelect;
}
NodeComboBox* ReportSelectionWidget::GetNodeComboBoxSelectReport()
{
if(m_NodeComboBoxSelectReport == NULL)
{
m_NodeComboBoxSelectReport = new NodeComboBox("Report",this->UpdateListReportNames(),this);
connect(m_NodeComboBoxSelectReport, SIGNAL(SignalCreate(QString)), this, SIGNAL(SignalCreateNewReport(QString)) );
connect(m_NodeComboBoxSelectReport, SIGNAL(SignalDelete(QString)), this, SIGNAL(SignalDeleteReport(QString)) );
connect(m_NodeComboBoxSelectReport, SIGNAL(SignalRename(QString,QString)), this, SIGNAL(SignalRenameReport(QString,QString)) );
connect(m_NodeComboBoxSelectReport, SIGNAL(SignalSelected(QString)), this, SIGNAL(SignalChangeReport(QString)) );
m_NodeComboBoxSelectReport->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
}
return m_NodeComboBoxSelectReport;
}
QList<QString>* ReportSelectionWidget::UpdateListReportNames()
{
m_ListReportNames.clear();
for(int i=0; i < m_ReportsPtr->size(); ++i)
{
m_ListReportNames.append(m_ReportsPtr->at(i)->GetReportName());
}
return &m_ListReportNames;
}