-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalysiswidget.cpp
More file actions
135 lines (107 loc) · 3.5 KB
/
analysiswidget.cpp
File metadata and controls
135 lines (107 loc) · 3.5 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#include "analysiswidget.h"
#include "separator.h"
AnalysisWidget::AnalysisWidget(QWidget *parent) :
QWidget(parent)
,m_Layout(NULL)
,m_LabelSelectStudy(NULL)
,m_ButtonReportSummary(NULL)
,m_RadioButtonQualitative(NULL)
,m_RadioButtonQuantitative(NULL)
{
this->InitializeWidget();
}
AnalysisWidget::~AnalysisWidget()
{
if(m_HBoxLayoutAnalysisTypeBoxes)
m_HBoxLayoutAnalysisTypeBoxes->deleteLater();
}
void AnalysisWidget::InitializeWidget()
{
static bool initialized = false;
if(initialized == false)
{
m_HBoxLayoutAnalysisTypeBoxes = new QHBoxLayout();
m_HBoxLayoutAnalysisTypeBoxes->addWidget(this->GetRadioButtonQualitative(),1,Qt::AlignCenter);
m_HBoxLayoutAnalysisTypeBoxes->addWidget(this->GetRadioButtonQuantitative(),1,Qt::AlignCenter);
this->GetLayout()->addLayout(m_HBoxLayoutAnalysisTypeBoxes,1);
this->GetLayout()->addWidget(new Separator(this));
this->GetLayout()->addWidget(this->GetLabelSelectStudy());
this->GetLayout()->addWidget(new Separator(this));
this->GetLayout()->addWidget(this->GetButtonReportSummary());
this->setLayout(this->GetLayout());
initialized = true;
}
}
void AnalysisWidget::SlotStudyCheckboxToggled(bool toggled)
{
QCheckBox* sender = (QCheckBox*) QObject::sender();
int idx = m_StudySelectCheckBoxes.indexOf(sender);
if(idx != -1)
{
if(toggled)
emit SignalAddStudyToView(idx);
else
emit SignalRemoveStudyFromView(idx);
}
}
QVBoxLayout* AnalysisWidget::GetLayout()
{
if(m_Layout == NULL)
{
m_Layout = new QVBoxLayout(this);
}
return m_Layout;
}
QLabel* AnalysisWidget::GetLabelSelectStudy()
{
if(m_LabelSelectStudy == NULL)
{
m_LabelSelectStudy = new QLabel("Select studies for comparison:",this);
}
return m_LabelSelectStudy;
}
QPushButton* AnalysisWidget::GetButtonReportSummary()
{
if(m_ButtonReportSummary == NULL)
{
m_ButtonReportSummary = new QPushButton("Show Summary Report",this);
connect(m_ButtonReportSummary, SIGNAL(clicked()), this, SIGNAL(SignalShowReportSummaryDialog()) );
}
return m_ButtonReportSummary;
}
QRadioButton* AnalysisWidget::GetRadioButtonQualitative()
{
if(m_RadioButtonQualitative == NULL)
{
m_RadioButtonQualitative = new QRadioButton("Qualitative",this);
connect(m_RadioButtonQualitative,SIGNAL(clicked()), this, SIGNAL(SignalQualitativeSelected()));
}
return m_RadioButtonQualitative;
}
QRadioButton* AnalysisWidget::GetRadioButtonQuantitative()
{
if(m_RadioButtonQuantitative == NULL)
{
m_RadioButtonQuantitative = new QRadioButton("Quantitative",this);
connect(m_RadioButtonQuantitative,SIGNAL(clicked()), this, SIGNAL(SignalQuantitativeSelected()));
}
return m_RadioButtonQuantitative;
}
void AnalysisWidget::UpdateStudiesList(QStringList input)
{
for(int i=0; i < m_StudySelectCheckBoxes.size(); ++i)
{
this->GetLayout()->removeWidget(m_StudySelectCheckBoxes.at(i));
m_StudySelectCheckBoxes.value(i)->deleteLater();
}
m_StudySelectCheckBoxes.clear();
for(int j=0; j < input.size(); ++j)
{
QCheckBox* cb = new QCheckBox(input.at(j), this);
cb->setChecked(true);
cb->setStyleSheet("margin-left: 30px");
connect(cb,SIGNAL(toggled(bool)),this,SLOT(SlotStudyCheckboxToggled(bool)) );
this->GetLayout()->insertWidget(3+j,cb);
m_StudySelectCheckBoxes.append(cb);
}
}