-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
61 lines (48 loc) · 1.37 KB
/
main.cpp
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
#include <iostream>
#include <QtWidgets/QApplication>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QTableWidget>
#include <QtWidgets/qheaderview.h>
#include "Cell.h"
#include "Sum.h"
#include "Maximum.h"
#include "Minimum.h"
#include "Mean.h"
int main(int argc, char **argv) {
QApplication app(argc, argv);
auto *table = new QTableWidget(3, 5);
table->resize(530, 130);
table->setHorizontalHeaderLabels(QString("Values; SUM; MIN; MAX; MEAN").split(";"));
auto *c1 = new Cell(45.99);
auto *c2 = new Cell(87);
auto *c3 = new Cell(1233.928);
table->setItem(0, 0, c1);
table->setItem(1, 0, c2);
table->setItem(2, 0, c3);
auto *sumC = new Cell();
auto *sumOp = new Sum(sumC);
sumOp->addCell(c1);
sumOp->addCell(c2);
sumOp->addCell(c3);
table->setItem(0, 1, sumC);
auto *minC = new Cell();
auto *minOp = new Minimum(minC);
minOp->addCell(c1);
minOp->addCell(c2);
minOp->addCell(c3);
table->setItem(0, 2, minC);
auto *maxC = new Cell();
auto *maxOp = new Maximum(maxC);
maxOp->addCell(c1);
maxOp->addCell(c2);
maxOp->addCell(c3);
table->setItem(0, 3, maxC);
auto *meanC = new Cell();
auto *meanOp = new Mean(meanC);
meanOp->addCell(c1);
meanOp->addCell(c2);
meanOp->addCell(c3);
table->setItem(0, 4, meanC);
table->show();
QApplication::exec();
}