-
Notifications
You must be signed in to change notification settings - Fork 1
/
axisgroupbox.cpp
71 lines (60 loc) · 1.72 KB
/
axisgroupbox.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
// Copyright (c) 2014 Andranik Abrahamyan
#include <QtGui/QtGui>
#include "axisgroupbox.h"
#include "axisglwidget.h"
AxisGroupBox::AxisGroupBox(QWidget *parent)
: QGroupBox(tr("World Coordinate System"), parent) {
QGridLayout *layout2 = new QGridLayout;
// Write labels and values
layout2->addWidget(new QLabel("X:"), 0, 0);
xRot = new QLabel("");
xRot->setAlignment(Qt::AlignLeft);
layout2->addWidget(xRot, 0, 1);
layout2->addWidget(new QLabel("Y:"), 1, 0);
yRot = new QLabel("");
yRot->setAlignment(Qt::AlignLeft);
layout2->addWidget(yRot, 1, 1);
layout2->addWidget(new QLabel("Z:"), 2, 0);
zRot = new QLabel("");
zRot->setAlignment(Qt::AlignLeft);
layout2->addWidget(zRot, 2, 1);
axisGLWidget = new AxisGLWidget(this);
QGridLayout *layout1 = new QGridLayout;
QWidget *wi = new QWidget;
wi->setLayout(layout2);
layout1->addWidget(wi, 0, 0);
layout1->addWidget(axisGLWidget, 0, 1);
setLayout(layout1);
}
AxisGroupBox::~AxisGroupBox() {}
void AxisGroupBox::reset() {
// Reset values
xRot->setText("");
yRot->setText("");
zRot->setText("");
axisGLWidget->reset();
}
void AxisGroupBox::setXRotation(const int angle) {
QString data;
// Display angle value
data.setNum(angle / 16);
xRot->setText(data + "°");
// Update angle value
axisGLWidget->setXRotation(angle);
}
void AxisGroupBox::setYRotation(const int angle) {
QString data;
// Display angle value
data.setNum(angle / 16);
yRot->setText(data + "°");
// Update angle value
axisGLWidget->setYRotation(angle);
}
void AxisGroupBox::setZRotation(const int angle) {
QString data;
// Display angle value
data.setNum(angle / 16);
zRot->setText(data + "°");
// Update angle value
axisGLWidget->setZRotation(angle);
}