-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathresult.cpp
More file actions
55 lines (45 loc) · 1.59 KB
/
result.cpp
File metadata and controls
55 lines (45 loc) · 1.59 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
#include "result.h"
#include "ui_result.h"
#include <QFile>
#include <QTextStream>
#include <QMessageBox>
Result::Result(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Result)
{
ui->setupUi(this);
// QString totalReg;
// QFile file20("C:/DLCF CBTest/SUB/files/system/sling/file/datafile/Registered.dpt");
// if(!file20.open(QFile::ReadOnly | QFile::Text)){
// QMessageBox::warning(this, "WARNING", "Error 200.\nFailed to read data. Contact Technical personnel for help");
// }
// QTextStream out20(&file20);
// totalReg = out20.readAll();
// file20.close();
csvModel = new QStandardItemModel(this);
csvModel->setColumnCount(4);
// csvModel->setHorizontalHeaderLabels(QStringList() /*<< "1st Column" << "2nd Column" << "3rd Column"*/);
ui->tableView->setModel(csvModel);
QFile file("C:/SUB/files/system/sling/file/GENERALRESULT.csv");
if ( !file.open(QFile::ReadOnly | QFile::Text) ) {
QMessageBox::warning(this, "WARNING", "Error 200.\nFailed to read data. Contact Technical personnel for help");
} else {
QTextStream in(&file);
while (!in.atEnd())
{
QString line = in.readLine();
line.replace('"',"");
QList<QStandardItem *> standardItemsList;
for (QString item : line.split(",")) {
standardItemsList.append(new QStandardItem(item));
}
csvModel->insertRow(csvModel->rowCount(), standardItemsList);
}
file.close();
}
}
Result::~Result()
{
delete ui;
delete csvModel;
}