-
Notifications
You must be signed in to change notification settings - Fork 1
/
propertiesgroupbox.cpp
104 lines (84 loc) · 2.86 KB
/
propertiesgroupbox.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
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
// Copyright (c) 2014 Andranik Abrahamyan
#include <QtGui/QtGui>
#include "propertiesgroupbox.h"
PropertiesGroupBox::PropertiesGroupBox(QWidget *parent)
: QGroupBox(tr("Properties"), parent)
{
QGridLayout *layout = new QGridLayout;
// Write labels and values
layout->addWidget(new QLabel("Volume:"), 0, 0);
volume = new QLabel("");
volume->setAlignment(Qt::AlignRight);
layout->addWidget(volume, 0, 1);
layout->addWidget(new QLabel("Surface:"), 1, 0);
surface = new QLabel("");
surface->setAlignment(Qt::AlignRight);
layout->addWidget(surface, 1, 1);
// layout->addWidget(new QLabel("boundingDiameter:"), 2, 0);
// diameter = new QLabel("");
// diameter->setAlignment(Qt::AlignRight);
// layout->addWidget(diameter, 2, 1);
layout->addWidget(new QLabel("Bounding box length:"), 2, 0);
box_length = new QLabel("");
box_length->setAlignment(Qt::AlignRight);
layout->addWidget(box_length, 2, 1);
layout->addWidget(new QLabel("Bounding box width:"), 3, 0);
box_width = new QLabel("");
box_width->setAlignment(Qt::AlignRight);
layout->addWidget(box_width, 3, 1);
layout->addWidget(new QLabel("Bounding box height:"), 4, 0);
box_height = new QLabel("");
box_height->setAlignment(Qt::AlignRight);
layout->addWidget(box_height, 4, 1);
layout->addWidget(new QLabel("average radial:"), 5, 0);
average_radial = new QLabel("");
average_radial->setAlignment(Qt::AlignRight);
layout->addWidget(average_radial, 5, 1);
layout->addWidget(new QLabel("min radial:"), 6, 0);
min_radial = new QLabel("");
min_radial->setAlignment(Qt::AlignRight);
layout->addWidget(min_radial, 6, 1);
layout->addWidget(new QLabel("mm^3"), 0, 2);
layout->addWidget(new QLabel("mm^2"), 1, 2);
layout->addWidget(new QLabel("mm"), 2, 2);
layout->addWidget(new QLabel("mm"), 3, 2);
layout->addWidget(new QLabel("mm"), 4, 2);
layout->addWidget(new QLabel("mm"), 5, 2);
layout->addWidget(new QLabel("mm"), 6, 2);
setLayout(layout);
}
PropertiesGroupBox::~PropertiesGroupBox()
{}
void PropertiesGroupBox::reset()
{
// Reset values
volume->setText("");
surface->setText("");
//diameter->setText("");
box_length->setText("");
box_width->setText("");
box_height->setText("");
average_radial->setText("");
min_radial->setText("");
}
void PropertiesGroupBox::setValues(const StlSphere::UnitStats stats)
{
QString data;
// Write values contained in stats
data.setNum(stats.volume, 'f', 5);
volume->setText(data);
data.setNum(stats.surface, 'f', 5);
surface->setText(data);
// data.setNum(stats.boundingDiameter , 'f', 5);
// diameter->setText(data);
data.setNum(stats.box_length , 'f', 5);
box_length->setText(data);
data.setNum(stats.box_width , 'f', 5);
box_width->setText(data);
data.setNum(stats.box_height , 'f', 5);
box_height->setText(data);
data.setNum(stats.averageRadial , 'f', 5);
average_radial->setText(data);
data.setNum(stats.minRadial , 'f', 5);
min_radial->setText(data);
}