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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the QtDataVisualization module.
**
** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
**
****************************************************************************/
#include "volumetrictest.h"
#include <QtWidgets/QApplication>
#include <QtWidgets/QWidget>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QRadioButton>
#include <QtWidgets/QSlider>
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QLabel>
#include <QtGui/QScreen>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
Q3DScatter *graph = new Q3DScatter();
QWidget *container = QWidget::createWindowContainer(graph);
QSize screenSize = graph->screen()->size();
container->setMinimumSize(QSize(screenSize.width() / 4, screenSize.height() / 4));
container->setMaximumSize(screenSize);
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
container->setFocusPolicy(Qt::StrongFocus);
QWidget *widget = new QWidget;
QHBoxLayout *hLayout = new QHBoxLayout(widget);
QVBoxLayout *vLayout = new QVBoxLayout();
hLayout->addWidget(container, 1);
hLayout->addLayout(vLayout);
widget->setWindowTitle(QStringLiteral("Volumetric TEST"));
widget->resize(QSize(screenSize.width() / 1.5, screenSize.height() / 1.5));
QCheckBox *sliceXCheckBox = new QCheckBox(widget);
sliceXCheckBox->setText(QStringLiteral("Slice volume on X axis"));
sliceXCheckBox->setChecked(false);
QCheckBox *sliceYCheckBox = new QCheckBox(widget);
sliceYCheckBox->setText(QStringLiteral("Slice volume on Y axis"));
sliceYCheckBox->setChecked(false);
QCheckBox *sliceZCheckBox = new QCheckBox(widget);
sliceZCheckBox->setText(QStringLiteral("Slice volume on Z axis"));
sliceZCheckBox->setChecked(false);
QSlider *sliceXSlider = new QSlider(Qt::Horizontal, widget);
sliceXSlider->setMinimum(0);
sliceXSlider->setMaximum(1024);
sliceXSlider->setValue(512);
sliceXSlider->setEnabled(true);
QSlider *sliceYSlider = new QSlider(Qt::Horizontal, widget);
sliceYSlider->setMinimum(0);
sliceYSlider->setMaximum(1024);
sliceYSlider->setValue(512);
sliceYSlider->setEnabled(true);
QSlider *sliceZSlider = new QSlider(Qt::Horizontal, widget);
sliceZSlider->setMinimum(0);
sliceZSlider->setMaximum(1024);
sliceZSlider->setValue(512);
sliceZSlider->setEnabled(true);
QLabel *fpsLabel = new QLabel(QStringLiteral("Fps: "), widget);
QLabel *sliceImageXLabel = new QLabel(widget);
QLabel *sliceImageYLabel = new QLabel(widget);
QLabel *sliceImageZLabel = new QLabel(widget);
sliceImageXLabel->setMinimumSize(QSize(200, 100));
sliceImageYLabel->setMinimumSize(QSize(200, 200));
sliceImageZLabel->setMinimumSize(QSize(200, 100));
sliceImageXLabel->setMaximumSize(QSize(200, 100));
sliceImageYLabel->setMaximumSize(QSize(200, 200));
sliceImageZLabel->setMaximumSize(QSize(200, 100));
sliceImageXLabel->setFrameShape(QFrame::Box);
sliceImageYLabel->setFrameShape(QFrame::Box);
sliceImageZLabel->setFrameShape(QFrame::Box);
sliceImageXLabel->setScaledContents(true);
sliceImageYLabel->setScaledContents(true);
sliceImageZLabel->setScaledContents(true);
vLayout->addWidget(fpsLabel);
vLayout->addWidget(sliceXCheckBox);
vLayout->addWidget(sliceXSlider);
vLayout->addWidget(sliceImageXLabel);
vLayout->addWidget(sliceYCheckBox);
vLayout->addWidget(sliceYSlider);
vLayout->addWidget(sliceImageYLabel);
vLayout->addWidget(sliceZCheckBox);
vLayout->addWidget(sliceZSlider);
vLayout->addWidget(sliceImageZLabel, 1, Qt::AlignTop);
VolumetricModifier *modifier = new VolumetricModifier(graph);
modifier->setFpsLabel(fpsLabel);
modifier->setSliceLabels(sliceImageXLabel, sliceImageYLabel, sliceImageZLabel);
QObject::connect(sliceXCheckBox, &QCheckBox::stateChanged, modifier,
&VolumetricModifier::sliceX);
QObject::connect(sliceYCheckBox, &QCheckBox::stateChanged, modifier,
&VolumetricModifier::sliceY);
QObject::connect(sliceZCheckBox, &QCheckBox::stateChanged, modifier,
&VolumetricModifier::sliceZ);
QObject::connect(sliceXSlider, &QSlider::valueChanged, modifier,
&VolumetricModifier::adjustSliceX);
QObject::connect(sliceYSlider, &QSlider::valueChanged, modifier,
&VolumetricModifier::adjustSliceY);
QObject::connect(sliceZSlider, &QSlider::valueChanged, modifier,
&VolumetricModifier::adjustSliceZ);
widget->show();
return app.exec();
}
|