-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDispInTable.cpp
More file actions
64 lines (56 loc) · 1.66 KB
/
DispInTable.cpp
File metadata and controls
64 lines (56 loc) · 1.66 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
#include "DispInTable.h"
#include "ui_DispInTable.h"
DispInTable::DispInTable(QWidget *parent) :
QDialog(parent),
ui(new Ui::DispInTable)
{
ui->setupUi(this);
criteriaList.clear();
weightByCritAndSymp = 0;
inputPath = "C:/Lidia/AMRR/symptoms.txt";
}
DispInTable::~DispInTable()
{
delete ui;
}
void DispInTable::recieveItogCritAndSympt(QVector<QHash<QString, QHash<QString, double> > > itsItogCritAndSympt)
{
itogCritAndSympt = itsItogCritAndSympt;
//itogSymptAndVal = itogCritAndSympt[0].value(criteriaList[0]);
//double val;
//val = itogSymptAndVal.value(symptList[0]);
header << "";
for (int i = 0; i < criteriaList.size(); i++)
{
header << criteriaList[i];
}
ui->symptWidget->setColumnCount(itogCritAndSympt.size()+1);
ui->symptWidget->setRowCount(symptList.size());
ui->symptWidget->setHorizontalHeaderLabels(header);
for (int i = 0; i < (symptList.size()); i++)
{
setItem(i,0,symptList[i]);
}
for (int j = 1; j < (criteriaList.size() + 1); j++)
{
for (int i = 0; i < symptList.size(); i++)
{
itogSymptAndVal = itogCritAndSympt[j-1].value(criteriaList[j-1]);
setItem(i,j,QString::number(itogSymptAndVal.value(symptList[i])));
}
}
}
void DispInTable::receiveSympt(QVector<QString> itsSympt)
{
symptList = itsSympt;
}
void DispInTable::receiveCriteriaList(QString itsCriteria)
{
criteriaList.push_back(itsCriteria);
}
void DispInTable::setItem(int indRow, int indCol, QString data)
{
QTableWidgetItem *itm =
new QTableWidgetItem(tr("%1").arg(data));
ui->symptWidget->setItem(indRow,indCol,itm);
}