1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Data Visualization module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29
30#include "graphmodifier.h"
31#include <QtDataVisualization/q3dtheme.h>
32
33#include <QApplication>
34#include <QWidget>
35#include <QHBoxLayout>
36#include <QVBoxLayout>
37#include <QPushButton>
38#include <QCheckBox>
39#include <QRadioButton>
40#include <QSlider>
41#include <QLabel>
42#include <QScreen>
43#include <QPainter>
44#include <QFontComboBox>
45#include <QFrame>
46#include <QDebug>
47
48using namespace QtDataVisualization;
49
50const int initialTheme = 4;
51
52int main(int argc, char *argv[])
53{
54 QApplication app(argc, argv);
55
56 QWidget *widget = new QWidget;
57 QHBoxLayout *hLayout = new QHBoxLayout(widget);
58 QVBoxLayout *vLayout = new QVBoxLayout();
59 QVBoxLayout *vLayout2 = new QVBoxLayout();
60 QVBoxLayout *vLayout3 = new QVBoxLayout();
61 vLayout->setAlignment(Qt::AlignTop);
62 vLayout2->setAlignment(Qt::AlignTop);
63 vLayout3->setAlignment(Qt::AlignTop);
64
65 Q3DSurface *surfaceGraph = new Q3DSurface();
66 QSize screenSize = surfaceGraph->screen()->size();
67
68 // Set to default, should be same as the initial on themeList
69 surfaceGraph->activeTheme()->setType(Q3DTheme::Theme(initialTheme));
70
71 QWidget *container = QWidget::createWindowContainer(window: surfaceGraph);
72 container->setMinimumSize(QSize(screenSize.width() / 2, screenSize.height() / 4));
73 container->setMaximumSize(screenSize);
74 container->setSizePolicy(hor: QSizePolicy::Expanding, ver: QSizePolicy::Expanding);
75 container->setFocusPolicy(Qt::StrongFocus);
76
77 widget->setWindowTitle(QStringLiteral("Surface tester"));
78
79 hLayout->addWidget(container, stretch: 1);
80 hLayout->addLayout(layout: vLayout);
81 hLayout->addLayout(layout: vLayout2);
82 hLayout->addLayout(layout: vLayout3);
83
84 QCheckBox *smoothCB = new QCheckBox(widget);
85 smoothCB->setText(QStringLiteral("Flat Surface"));
86 smoothCB->setChecked(true);
87
88 QCheckBox *surfaceGridCB = new QCheckBox(widget);
89 surfaceGridCB->setText(QStringLiteral("Surface Grid"));
90 surfaceGridCB->setChecked(true);
91
92 QCheckBox *surfaceCB = new QCheckBox(widget);
93 surfaceCB->setText(QStringLiteral("Surface Visible"));
94 surfaceCB->setChecked(true);
95
96 QCheckBox *seriesVisibleCB = new QCheckBox(widget);
97 seriesVisibleCB->setText(QStringLiteral("Series Visible"));
98 seriesVisibleCB->setChecked(true);
99
100#ifdef MULTI_SERIES
101 smoothCB->setText(QStringLiteral("S1 Flat Surface"));
102 surfaceGridCB->setText(QStringLiteral("S1 Surface Grid"));
103 surfaceCB->setText(QStringLiteral("S1 Surface Visible"));
104 seriesVisibleCB->setText(QStringLiteral("Series 1 Visible"));
105
106 QCheckBox *smoothS2CB = new QCheckBox(widget);
107 smoothS2CB->setText(QStringLiteral("S2 Flat Surface"));
108 smoothS2CB->setChecked(true);
109
110 QCheckBox *surfaceGridS2CB = new QCheckBox(widget);
111 surfaceGridS2CB->setText(QStringLiteral("S2 Surface Grid"));
112 surfaceGridS2CB->setChecked(true);
113
114 QCheckBox *surfaceS2CB = new QCheckBox(widget);
115 surfaceS2CB->setText(QStringLiteral("S2 Surface Visible"));
116 surfaceS2CB->setChecked(true);
117
118 QCheckBox *series2VisibleCB = new QCheckBox(widget);
119 series2VisibleCB->setText(QStringLiteral("Series 2 Visible"));
120 series2VisibleCB->setChecked(true);
121
122 QCheckBox *smoothS3CB = new QCheckBox(widget);
123 smoothS3CB->setText(QStringLiteral("S3 Flat Surface"));
124 smoothS3CB->setChecked(true);
125
126 QCheckBox *surfaceGridS3CB = new QCheckBox(widget);
127 surfaceGridS3CB->setText(QStringLiteral("S3 Surface Grid"));
128 surfaceGridS3CB->setChecked(true);
129
130 QCheckBox *surfaceS3CB = new QCheckBox(widget);
131 surfaceS3CB->setText(QStringLiteral("S3 Surface Visible"));
132 surfaceS3CB->setChecked(true);
133
134 QCheckBox *series3VisibleCB = new QCheckBox(widget);
135 series3VisibleCB->setText(QStringLiteral("Series 3 Visible"));
136 series3VisibleCB->setChecked(true);
137
138 QCheckBox *smoothS4CB = new QCheckBox(widget);
139 smoothS4CB->setText(QStringLiteral("S4 Flat Surface"));
140 smoothS4CB->setChecked(true);
141
142 QCheckBox *surfaceGridS4CB = new QCheckBox(widget);
143 surfaceGridS4CB->setText(QStringLiteral("S4 Surface Grid"));
144 surfaceGridS4CB->setChecked(true);
145
146 QCheckBox *surfaceS4CB = new QCheckBox(widget);
147 surfaceS4CB->setText(QStringLiteral("S4 Surface Visible"));
148 surfaceS4CB->setChecked(true);
149
150 QCheckBox *series4VisibleCB = new QCheckBox(widget);
151 series4VisibleCB->setText(QStringLiteral("Series 4 Visible"));
152 series4VisibleCB->setChecked(true);
153
154 QCheckBox *series1CB = new QCheckBox(widget);
155 series1CB->setText(QStringLiteral("Series 1"));
156
157 QCheckBox *series2CB = new QCheckBox(widget);
158 series2CB->setText(QStringLiteral("Series 2"));
159
160 QCheckBox *series3CB = new QCheckBox(widget);
161 series3CB->setText(QStringLiteral("Series 3"));
162
163 QCheckBox *series4CB = new QCheckBox(widget);
164 series4CB->setText(QStringLiteral("Series 4"));
165#else
166 //QCheckBox *sqrtSinCB = new QCheckBox(widget);
167 QRadioButton *sqrtSinCB = new QRadioButton(widget);
168 sqrtSinCB->setText(QStringLiteral("Sqrt & Sin"));
169 sqrtSinCB->setChecked(false);
170
171 QRadioButton *planeCB = new QRadioButton(widget);
172 planeCB->setText(QStringLiteral("Plane"));
173 planeCB->setChecked(false);
174
175 QRadioButton *heightMapCB = new QRadioButton(widget);
176 heightMapCB->setText(QStringLiteral("Height map"));
177 heightMapCB->setChecked(false);
178
179 QCheckBox *gridSlidersLockCB = new QCheckBox(widget);
180 gridSlidersLockCB->setText(QStringLiteral("Lock"));
181 gridSlidersLockCB->setChecked(false);
182
183 QSlider *gridSliderX = new QSlider(Qt::Horizontal, widget);
184 gridSliderX->setTickInterval(1);
185 gridSliderX->setMinimum(2);
186 gridSliderX->setValue(30);
187 gridSliderX->setMaximum(200);
188 gridSliderX->setEnabled(true);
189 QSlider *gridSliderZ = new QSlider(Qt::Horizontal, widget);
190 gridSliderZ->setTickInterval(1);
191 gridSliderZ->setMinimum(2);
192 gridSliderZ->setValue(30);
193 gridSliderZ->setMaximum(200);
194 gridSliderZ->setEnabled(true);
195#endif
196
197 QSlider *axisRangeSliderX = new QSlider(Qt::Horizontal, widget);
198 axisRangeSliderX->setTickInterval(1);
199 axisRangeSliderX->setMinimum(1);
200 axisRangeSliderX->setValue(34);
201 axisRangeSliderX->setMaximum(100);
202 axisRangeSliderX->setEnabled(true);
203 QSlider *axisRangeSliderY = new QSlider(Qt::Horizontal, widget);
204 axisRangeSliderY->setTickInterval(1);
205 axisRangeSliderY->setMinimum(1);
206 axisRangeSliderY->setValue(16);
207 axisRangeSliderY->setMaximum(100);
208 axisRangeSliderY->setEnabled(true);
209 QSlider *axisRangeSliderZ = new QSlider(Qt::Horizontal, widget);
210 axisRangeSliderZ->setTickInterval(1);
211 axisRangeSliderZ->setMinimum(1);
212 axisRangeSliderZ->setValue(34);
213 axisRangeSliderZ->setMaximum(100);
214 axisRangeSliderZ->setEnabled(true);
215
216 QSlider *axisMinSliderX = new QSlider(Qt::Horizontal, widget);
217 axisMinSliderX->setTickInterval(1);
218 axisMinSliderX->setMinimum(-100);
219 axisMinSliderX->setValue(-17);
220 axisMinSliderX->setMaximum(100);
221 axisMinSliderX->setEnabled(true);
222 QSlider *axisMinSliderY = new QSlider(Qt::Horizontal, widget);
223 axisMinSliderY->setTickInterval(1);
224 axisMinSliderY->setMinimum(-100);
225 axisMinSliderY->setValue(-8);
226 axisMinSliderY->setMaximum(100);
227 axisMinSliderY->setEnabled(true);
228 QSlider *axisMinSliderZ = new QSlider(Qt::Horizontal, widget);
229 axisMinSliderZ->setTickInterval(1);
230 axisMinSliderZ->setMinimum(-100);
231 axisMinSliderZ->setValue(-17);
232 axisMinSliderZ->setMaximum(100);
233 axisMinSliderZ->setEnabled(true);
234
235 QSlider *aspectRatioSlider = new QSlider(Qt::Horizontal, widget);
236 aspectRatioSlider->setMinimum(1);
237 aspectRatioSlider->setValue(20);
238 aspectRatioSlider->setMaximum(100);
239
240 QSlider *horizontalAspectRatioSlider = new QSlider(Qt::Horizontal, widget);
241 horizontalAspectRatioSlider->setMinimum(0);
242 horizontalAspectRatioSlider->setValue(0);
243 horizontalAspectRatioSlider->setMaximum(300);
244
245 QLinearGradient gr(0, 0, 100, 1);
246 gr.setColorAt(pos: 0.0, color: Qt::black);
247 gr.setColorAt(pos: 0.33, color: Qt::blue);
248 gr.setColorAt(pos: 0.67, color: Qt::red);
249 gr.setColorAt(pos: 1.0, color: Qt::yellow);
250 QPixmap pm(100, 24);
251 QPainter pmp(&pm);
252 pmp.setBrush(QBrush(gr));
253 pmp.setPen(Qt::NoPen);
254 pmp.drawRect(x: 0, y: 0, w: 100, h: 24);
255 QPushButton *colorPB = new QPushButton();
256 colorPB->setIcon(QIcon(pm));
257 colorPB->setIconSize(QSize(100, 24));
258
259 QFontComboBox *fontList = new QFontComboBox(widget);
260 fontList->setCurrentFont(QFont("Arial"));
261
262 QPushButton *labelButton = new QPushButton(widget);
263 labelButton->setText(QStringLiteral("Change label style"));
264
265 QPushButton *meshButton = new QPushButton(widget);
266 meshButton->setText(QStringLiteral("Change pointer mesh"));
267
268 QComboBox *themeList = new QComboBox(widget);
269 themeList->addItem(QStringLiteral("Qt"));
270 themeList->addItem(QStringLiteral("Primary Colors"));
271 themeList->addItem(QStringLiteral("Digia"));
272 themeList->addItem(QStringLiteral("Stone Moss"));
273 themeList->addItem(QStringLiteral("Army Blue"));
274 themeList->addItem(QStringLiteral("Retro"));
275 themeList->addItem(QStringLiteral("Ebony"));
276 themeList->addItem(QStringLiteral("Isabelle"));
277 themeList->setCurrentIndex(initialTheme);
278
279 QComboBox *shadowQuality = new QComboBox(widget);
280 shadowQuality->addItem(QStringLiteral("None"));
281 shadowQuality->addItem(QStringLiteral("Low"));
282 shadowQuality->addItem(QStringLiteral("Medium"));
283 shadowQuality->addItem(QStringLiteral("High"));
284 shadowQuality->addItem(QStringLiteral("Low Soft"));
285 shadowQuality->addItem(QStringLiteral("Medium Soft"));
286 shadowQuality->addItem(QStringLiteral("High Soft"));
287 shadowQuality->setCurrentIndex(3);
288
289 QComboBox *selectionMode = new QComboBox(widget);
290 selectionMode->addItem(QStringLiteral("None"),
291 auserData: int(QAbstract3DGraph::SelectionNone));
292 selectionMode->addItem(QStringLiteral("Item"),
293 auserData: int(QAbstract3DGraph::SelectionItem));
294 selectionMode->addItem(QStringLiteral("Multi: Item"),
295 auserData: int(QAbstract3DGraph::SelectionItem | QAbstract3DGraph::SelectionMultiSeries));
296 selectionMode->addItem(QStringLiteral("Row"),
297 auserData: int(QAbstract3DGraph::SelectionRow));
298 selectionMode->addItem(QStringLiteral("Item and Row"),
299 auserData: int(QAbstract3DGraph::SelectionItemAndRow));
300 selectionMode->addItem(QStringLiteral("Column"),
301 auserData: int(QAbstract3DGraph::SelectionColumn));
302 selectionMode->addItem(QStringLiteral("Item and Column"),
303 auserData: int(QAbstract3DGraph::SelectionItemAndColumn));
304 selectionMode->addItem(QStringLiteral("Row and Column"),
305 auserData: int(QAbstract3DGraph::SelectionRowAndColumn));
306 selectionMode->addItem(QStringLiteral("Item, Row and Column"),
307 auserData: int(QAbstract3DGraph::SelectionItemRowAndColumn));
308 selectionMode->addItem(QStringLiteral("Multi: Item, Row and Column"),
309 auserData: int(QAbstract3DGraph::SelectionItemRowAndColumn | QAbstract3DGraph::SelectionMultiSeries));
310 selectionMode->addItem(QStringLiteral("Slice into Row"),
311 auserData: int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionRow));
312 selectionMode->addItem(QStringLiteral("Slice into Row and Item"),
313 auserData: int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndRow));
314 selectionMode->addItem(QStringLiteral("Multi: Slice, Row & Item"),
315 auserData: int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndRow
316 | QAbstract3DGraph::SelectionMultiSeries));
317 selectionMode->addItem(QStringLiteral("Slice into Column"),
318 auserData: int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionColumn));
319 selectionMode->addItem(QStringLiteral("Slice into Column and Item"),
320 auserData: int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndColumn));
321 selectionMode->addItem(QStringLiteral("Multi: Slice, Column & Item"),
322 auserData: int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndColumn
323 | QAbstract3DGraph::SelectionMultiSeries));
324
325#ifndef MULTI_SERIES
326 QPushButton *selectButton = new QPushButton(widget);
327 selectButton->setText(QStringLiteral("Select random point"));
328
329 QPushButton *flipViewsButton = new QPushButton(widget);
330 flipViewsButton->setText(QStringLiteral("Flip Views"));
331
332 QLabel *selectionInfoLabel = new QLabel(widget);
333#endif
334
335 QPushButton *changeRowButton = new QPushButton(widget);
336 changeRowButton->setText(QStringLiteral("Change a row"));
337
338 QPushButton *changeRowsButton = new QPushButton(widget);
339 changeRowsButton->setText(QStringLiteral("Change 3 rows"));
340
341 QPushButton *changeItemButton = new QPushButton(widget);
342 changeItemButton->setText(QStringLiteral("Change item"));
343
344 QPushButton *changeMultipleItemButton = new QPushButton(widget);
345 changeMultipleItemButton->setText(QStringLiteral("Change many items"));
346
347 QPushButton *changeMultipleRowsButton = new QPushButton(widget);
348 changeMultipleRowsButton->setText(QStringLiteral("Change many rows"));
349
350 QPushButton *addRowButton = new QPushButton(widget);
351 addRowButton->setText(QStringLiteral("Add a row"));
352
353 QPushButton *addRowsButton = new QPushButton(widget);
354 addRowsButton->setText(QStringLiteral("Add 3 rows"));
355
356 QPushButton *insertRowButton = new QPushButton(widget);
357 insertRowButton->setText(QStringLiteral("Insert a row"));
358
359 QPushButton *insertRowsButton = new QPushButton(widget);
360 insertRowsButton->setText(QStringLiteral("Insert 3 rows"));
361
362 QPushButton *removeRowButton = new QPushButton(widget);
363 removeRowButton->setText(QStringLiteral("Remove a row"));
364
365 QPushButton *resetArrayButton = new QPushButton(widget);
366 resetArrayButton->setText(QStringLiteral("Reset Series Array to plane"));
367
368 QPushButton *resetArrayEmptyButton = new QPushButton(widget);
369 resetArrayEmptyButton->setText(QStringLiteral("Reset Series Array to empty"));
370
371 QPushButton *massiveDataTestButton = new QPushButton(widget);
372 massiveDataTestButton->setText(QStringLiteral("Massive data test"));
373
374 QPushButton *testReverseButton = new QPushButton(widget);
375 testReverseButton->setText(QStringLiteral("Test Axis Reversing"));
376
377 QPushButton *testDataOrderingButton = new QPushButton(widget);
378 testDataOrderingButton->setText(QStringLiteral("Test data ordering"));
379
380 QFrame* line = new QFrame();
381 line->setFrameShape(QFrame::HLine);
382 line->setFrameShadow(QFrame::Sunken);
383
384 QFrame* line2 = new QFrame();
385 line2->setFrameShape(QFrame::HLine);
386 line2->setFrameShadow(QFrame::Sunken);
387
388 QFrame* line3 = new QFrame();
389 line3->setFrameShape(QFrame::HLine);
390 line3->setFrameShadow(QFrame::Sunken);
391
392 QCheckBox *axisTitlesVisibleCB = new QCheckBox(widget);
393 axisTitlesVisibleCB->setText(QStringLiteral("Axis titles visible"));
394 axisTitlesVisibleCB->setChecked(false);
395
396 QCheckBox *axisTitlesFixedCB = new QCheckBox(widget);
397 axisTitlesFixedCB->setText(QStringLiteral("Axis titles fixed"));
398 axisTitlesFixedCB->setChecked(true);
399
400 QSlider *axisLabelRotationSlider = new QSlider(Qt::Horizontal, widget);
401 axisLabelRotationSlider->setTickInterval(10);
402 axisLabelRotationSlider->setTickPosition(QSlider::TicksBelow);
403 axisLabelRotationSlider->setMinimum(0);
404 axisLabelRotationSlider->setValue(0);
405 axisLabelRotationSlider->setMaximum(90);
406
407 QCheckBox *xAscendingCB = new QCheckBox(widget);
408 xAscendingCB->setText(QStringLiteral("X Ascending"));
409 xAscendingCB->setChecked(true);
410
411 QCheckBox *zAscendingCB = new QCheckBox(widget);
412 zAscendingCB->setText(QStringLiteral("Z Ascending"));
413 zAscendingCB->setChecked(true);
414
415 QCheckBox *polarCB = new QCheckBox(widget);
416 polarCB->setText(QStringLiteral("Polar"));
417 polarCB->setChecked(false);
418
419 QCheckBox *surfaceTextureCB = new QCheckBox(widget);
420 surfaceTextureCB->setText(QStringLiteral("Map texture"));
421 surfaceTextureCB->setChecked(false);
422
423 QSlider *cameraTargetSliderX = new QSlider(Qt::Horizontal, widget);
424 cameraTargetSliderX->setTickInterval(1);
425 cameraTargetSliderX->setMinimum(-100);
426 cameraTargetSliderX->setValue(0);
427 cameraTargetSliderX->setMaximum(100);
428 QSlider *cameraTargetSliderY = new QSlider(Qt::Horizontal, widget);
429 cameraTargetSliderY->setTickInterval(1);
430 cameraTargetSliderY->setMinimum(-100);
431 cameraTargetSliderY->setValue(0);
432 cameraTargetSliderY->setMaximum(100);
433 QSlider *cameraTargetSliderZ = new QSlider(Qt::Horizontal, widget);
434 cameraTargetSliderZ->setTickInterval(1);
435 cameraTargetSliderZ->setMinimum(-100);
436 cameraTargetSliderZ->setValue(0);
437 cameraTargetSliderZ->setMaximum(100);
438
439 QSlider *marginSlider = new QSlider(Qt::Horizontal, widget);
440 marginSlider->setMinimum(-1);
441 marginSlider->setValue(-1);
442 marginSlider->setMaximum(100);
443
444 // Add controls to the layout
445#ifdef MULTI_SERIES
446 vLayout->addWidget(series1CB);
447#endif
448 vLayout->addWidget(smoothCB);
449 vLayout->addWidget(surfaceGridCB);
450 vLayout->addWidget(surfaceCB);
451 vLayout->addWidget(seriesVisibleCB);
452#ifdef MULTI_SERIES
453 vLayout->addWidget(line);
454 vLayout->addWidget(series2CB);
455 vLayout->addWidget(smoothS2CB);
456 vLayout->addWidget(surfaceGridS2CB);
457 vLayout->addWidget(surfaceS2CB);
458 vLayout->addWidget(series2VisibleCB);
459 vLayout->addWidget(line2);
460 vLayout->addWidget(series3CB);
461 vLayout->addWidget(smoothS3CB);
462 vLayout->addWidget(surfaceGridS3CB);
463 vLayout->addWidget(surfaceS3CB);
464 vLayout->addWidget(series3VisibleCB);
465 vLayout->addWidget(line3);
466 vLayout->addWidget(series4CB);
467 vLayout->addWidget(smoothS4CB);
468 vLayout->addWidget(surfaceGridS4CB);
469 vLayout->addWidget(surfaceS4CB);
470 vLayout->addWidget(series4VisibleCB);
471 vLayout->addWidget(surfaceTextureCB, stretch: 1, alignment: Qt::AlignTop);
472#endif
473#ifndef MULTI_SERIES
474 vLayout->addWidget(new QLabel(QStringLiteral("Select surface sample")));
475 vLayout->addWidget(sqrtSinCB);
476 vLayout->addWidget(planeCB);
477 vLayout->addWidget(heightMapCB);
478 vLayout->addWidget(new QLabel(QStringLiteral("Adjust sample count")));
479 vLayout->addWidget(gridSlidersLockCB);
480 vLayout->addWidget(gridSliderX);
481 vLayout->addWidget(gridSliderZ, 1, Qt::AlignTop);
482#endif
483
484 vLayout2->addWidget(new QLabel(QStringLiteral("Adjust vertical aspect ratio")));
485 vLayout2->addWidget(aspectRatioSlider);
486 vLayout2->addWidget(new QLabel(QStringLiteral("Adjust horizontal aspect ratio")));
487 vLayout2->addWidget(horizontalAspectRatioSlider);
488 vLayout2->addWidget(new QLabel(QStringLiteral("Adjust axis range")));
489 vLayout2->addWidget(axisRangeSliderX);
490 vLayout2->addWidget(axisRangeSliderY);
491 vLayout2->addWidget(axisRangeSliderZ);
492 vLayout2->addWidget(new QLabel(QStringLiteral("Adjust axis minimum")));
493 vLayout2->addWidget(axisMinSliderX);
494 vLayout2->addWidget(axisMinSliderY);
495 vLayout2->addWidget(axisMinSliderZ);
496 vLayout2->addWidget(xAscendingCB);
497 vLayout2->addWidget(zAscendingCB);
498 vLayout2->addWidget(polarCB);
499 vLayout2->addWidget(new QLabel(QStringLiteral("Change font")));
500 vLayout2->addWidget(fontList);
501 vLayout2->addWidget(new QLabel(QStringLiteral("Change theme")));
502 vLayout2->addWidget(themeList);
503 vLayout2->addWidget(new QLabel(QStringLiteral("Adjust shadow quality")));
504 vLayout2->addWidget(shadowQuality);
505 vLayout2->addWidget(new QLabel(QStringLiteral("Selection Mode")));
506 vLayout2->addWidget(selectionMode);
507 vLayout2->addWidget(new QLabel(QStringLiteral("Camera target")));
508 vLayout2->addWidget(cameraTargetSliderX);
509 vLayout2->addWidget(cameraTargetSliderY);
510 vLayout2->addWidget(cameraTargetSliderZ);
511 vLayout2->addWidget(new QLabel(QStringLiteral("Adjust margin")), stretch: 0, alignment: Qt::AlignTop);
512 vLayout2->addWidget(marginSlider, stretch: 1, alignment: Qt::AlignTop);
513
514 vLayout3->addWidget(labelButton);
515 vLayout3->addWidget(meshButton);
516#ifndef MULTI_SERIES
517 vLayout3->addWidget(selectButton);
518 vLayout3->addWidget(selectionInfoLabel);
519 vLayout3->addWidget(flipViewsButton);
520#endif
521
522 vLayout3->addWidget(colorPB);
523 vLayout3->addWidget(changeRowButton);
524 vLayout3->addWidget(changeRowsButton);
525 vLayout3->addWidget(changeMultipleRowsButton);
526 vLayout3->addWidget(changeItemButton);
527 vLayout3->addWidget(changeMultipleItemButton);
528 vLayout3->addWidget(addRowButton);
529 vLayout3->addWidget(addRowsButton);
530 vLayout3->addWidget(insertRowButton);
531 vLayout3->addWidget(insertRowsButton);
532 vLayout3->addWidget(removeRowButton);
533 vLayout3->addWidget(resetArrayButton);
534 vLayout3->addWidget(resetArrayEmptyButton);
535 vLayout3->addWidget(massiveDataTestButton);
536 vLayout3->addWidget(testReverseButton);
537 vLayout3->addWidget(testDataOrderingButton);
538 vLayout3->addWidget(axisTitlesVisibleCB);
539 vLayout3->addWidget(axisTitlesFixedCB);
540 vLayout3->addWidget(new QLabel(QStringLiteral("Axis label rotation")));
541 vLayout3->addWidget(axisLabelRotationSlider, stretch: 1, alignment: Qt::AlignTop);
542
543 widget->show();
544
545 GraphModifier *modifier = new GraphModifier(surfaceGraph, container);
546
547 // Connect controls to slots on modifier
548 QObject::connect(sender: smoothCB, signal: &QCheckBox::stateChanged,
549 receiver: modifier, slot: &GraphModifier::toggleSmooth);
550 QObject::connect(sender: surfaceGridCB, signal: &QCheckBox::stateChanged,
551 receiver: modifier, slot: &GraphModifier::toggleSurfaceGrid);
552 QObject::connect(sender: surfaceCB, signal: &QCheckBox::stateChanged,
553 receiver: modifier, slot: &GraphModifier::toggleSurface);
554 QObject::connect(sender: seriesVisibleCB, signal: &QCheckBox::stateChanged,
555 receiver: modifier, slot: &GraphModifier::toggleSeriesVisible);
556#ifdef MULTI_SERIES
557 QObject::connect(sender: smoothS2CB, signal: &QCheckBox::stateChanged,
558 receiver: modifier, slot: &GraphModifier::toggleSmoothS2);
559 QObject::connect(sender: surfaceGridS2CB, signal: &QCheckBox::stateChanged,
560 receiver: modifier, slot: &GraphModifier::toggleSurfaceGridS2);
561 QObject::connect(sender: surfaceS2CB, signal: &QCheckBox::stateChanged,
562 receiver: modifier, slot: &GraphModifier::toggleSurfaceS2);
563 QObject::connect(sender: series2VisibleCB, signal: &QCheckBox::stateChanged,
564 receiver: modifier, slot: &GraphModifier::toggleSeries2Visible);
565
566 QObject::connect(sender: smoothS3CB, signal: &QCheckBox::stateChanged,
567 receiver: modifier, slot: &GraphModifier::toggleSmoothS3);
568 QObject::connect(sender: surfaceGridS3CB, signal: &QCheckBox::stateChanged,
569 receiver: modifier, slot: &GraphModifier::toggleSurfaceGridS3);
570 QObject::connect(sender: surfaceS3CB, signal: &QCheckBox::stateChanged,
571 receiver: modifier, slot: &GraphModifier::toggleSurfaceS3);
572 QObject::connect(sender: series3VisibleCB, signal: &QCheckBox::stateChanged,
573 receiver: modifier, slot: &GraphModifier::toggleSeries3Visible);
574
575 QObject::connect(sender: smoothS4CB, signal: &QCheckBox::stateChanged,
576 receiver: modifier, slot: &GraphModifier::toggleSmoothS4);
577 QObject::connect(sender: surfaceGridS4CB, signal: &QCheckBox::stateChanged,
578 receiver: modifier, slot: &GraphModifier::toggleSurfaceGridS4);
579 QObject::connect(sender: surfaceS4CB, signal: &QCheckBox::stateChanged,
580 receiver: modifier, slot: &GraphModifier::toggleSurfaceS4);
581 QObject::connect(sender: series4VisibleCB, signal: &QCheckBox::stateChanged,
582 receiver: modifier, slot: &GraphModifier::toggleSeries4Visible);
583
584 QObject::connect(sender: series1CB, signal: &QCheckBox::stateChanged,
585 receiver: modifier, slot: &GraphModifier::toggleSeries1);
586 QObject::connect(sender: series1CB, signal: &QCheckBox::stateChanged,
587 receiver: smoothCB, slot: &QPushButton::setEnabled);
588 QObject::connect(sender: series1CB, signal: &QCheckBox::stateChanged,
589 receiver: surfaceGridCB, slot: &QPushButton::setEnabled);
590 QObject::connect(sender: series1CB, signal: &QCheckBox::stateChanged,
591 receiver: surfaceCB, slot: &QPushButton::setEnabled);
592 QObject::connect(sender: series1CB, signal: &QCheckBox::stateChanged,
593 receiver: seriesVisibleCB, slot: &QPushButton::setEnabled);
594
595 QObject::connect(sender: series2CB, signal: &QCheckBox::stateChanged,
596 receiver: modifier, slot: &GraphModifier::toggleSeries2);
597 QObject::connect(sender: series2CB, signal: &QCheckBox::stateChanged,
598 receiver: smoothS2CB, slot: &QPushButton::setEnabled);
599 QObject::connect(sender: series2CB, signal: &QCheckBox::stateChanged,
600 receiver: surfaceGridS2CB, slot: &QPushButton::setEnabled);
601 QObject::connect(sender: series2CB, signal: &QCheckBox::stateChanged,
602 receiver: surfaceS2CB, slot: &QPushButton::setEnabled);
603 QObject::connect(sender: series2CB, signal: &QCheckBox::stateChanged,
604 receiver: series2VisibleCB, slot: &QPushButton::setEnabled);
605
606 QObject::connect(sender: series3CB, signal: &QCheckBox::stateChanged,
607 receiver: modifier, slot: &GraphModifier::toggleSeries3);
608 QObject::connect(sender: series3CB, signal: &QCheckBox::stateChanged,
609 receiver: smoothS3CB, slot: &QPushButton::setEnabled);
610 QObject::connect(sender: series3CB, signal: &QCheckBox::stateChanged,
611 receiver: surfaceGridS3CB, slot: &QPushButton::setEnabled);
612 QObject::connect(sender: series3CB, signal: &QCheckBox::stateChanged,
613 receiver: surfaceS3CB, slot: &QPushButton::setEnabled);
614 QObject::connect(sender: series3CB, signal: &QCheckBox::stateChanged,
615 receiver: series3VisibleCB, slot: &QPushButton::setEnabled);
616
617 QObject::connect(sender: series4CB, signal: &QCheckBox::stateChanged,
618 receiver: modifier, slot: &GraphModifier::toggleSeries4);
619 QObject::connect(sender: series4CB, signal: &QCheckBox::stateChanged,
620 receiver: smoothS4CB, slot: &QPushButton::setEnabled);
621 QObject::connect(sender: series4CB, signal: &QCheckBox::stateChanged,
622 receiver: surfaceGridS4CB, slot: &QPushButton::setEnabled);
623 QObject::connect(sender: series4CB, signal: &QCheckBox::stateChanged,
624 receiver: surfaceS4CB, slot: &QPushButton::setEnabled);
625 QObject::connect(sender: series4CB, signal: &QCheckBox::stateChanged,
626 receiver: series4VisibleCB, slot: &QPushButton::setEnabled);
627#else
628 QObject::connect(sqrtSinCB, &QRadioButton::toggled,
629 modifier, &GraphModifier::toggleSqrtSin);
630 QObject::connect(planeCB, &QCheckBox::toggled,
631 modifier, &GraphModifier::togglePlane);
632 QObject::connect(heightMapCB, &QCheckBox::toggled,
633 modifier, &GraphModifier::setHeightMapData);
634 QObject::connect(gridSlidersLockCB, &QCheckBox::stateChanged,
635 modifier, &GraphModifier::toggleGridSliderLock);
636 QObject::connect(gridSliderX, &QSlider::valueChanged,
637 modifier, &GraphModifier::adjustXCount);
638 QObject::connect(gridSliderZ, &QSlider::valueChanged,
639 modifier, &GraphModifier::adjustZCount);
640#endif
641 QObject::connect(sender: axisRangeSliderX, signal: &QSlider::valueChanged,
642 receiver: modifier, slot: &GraphModifier::adjustXRange);
643 QObject::connect(sender: axisRangeSliderY, signal: &QSlider::valueChanged,
644 receiver: modifier, slot: &GraphModifier::adjustYRange);
645 QObject::connect(sender: axisRangeSliderZ, signal: &QSlider::valueChanged,
646 receiver: modifier, slot: &GraphModifier::adjustZRange);
647 QObject::connect(sender: axisMinSliderX, signal: &QSlider::valueChanged,
648 receiver: modifier, slot: &GraphModifier::adjustXMin);
649 QObject::connect(sender: axisMinSliderY, signal: &QSlider::valueChanged,
650 receiver: modifier, slot: &GraphModifier::adjustYMin);
651 QObject::connect(sender: axisMinSliderZ, signal: &QSlider::valueChanged,
652 receiver: modifier, slot: &GraphModifier::adjustZMin);
653 QObject::connect(sender: colorPB, signal: &QPushButton::pressed,
654 receiver: modifier, slot: &GraphModifier::gradientPressed);
655 QObject::connect(sender: fontList, signal: &QFontComboBox::currentFontChanged,
656 receiver: modifier, slot: &GraphModifier::changeFont);
657 QObject::connect(sender: labelButton, signal: &QPushButton::clicked,
658 receiver: modifier, slot: &GraphModifier::changeStyle);
659 QObject::connect(sender: meshButton, signal: &QPushButton::clicked,
660 receiver: modifier, slot: &GraphModifier::changeMesh);
661 QObject::connect(sender: themeList, SIGNAL(currentIndexChanged(int)),
662 receiver: modifier, SLOT(changeTheme(int)));
663 QObject::connect(sender: shadowQuality, SIGNAL(currentIndexChanged(int)),
664 receiver: modifier, SLOT(changeShadowQuality(int)));
665 QObject::connect(sender: selectionMode, SIGNAL(currentIndexChanged(int)),
666 receiver: modifier, SLOT(changeSelectionMode(int)));
667#ifndef MULTI_SERIES
668 QObject::connect(selectButton, &QPushButton::clicked,
669 modifier, &GraphModifier::selectButtonClicked);
670 QObject::connect(flipViewsButton, &QPushButton::clicked,
671 modifier, &GraphModifier::flipViews);
672#endif
673 QObject::connect(sender: changeRowButton,signal: &QPushButton::clicked,
674 receiver: modifier, slot: &GraphModifier::changeRow);
675 QObject::connect(sender: changeRowsButton,signal: &QPushButton::clicked,
676 receiver: modifier, slot: &GraphModifier::changeRows);
677 QObject::connect(sender: changeItemButton,signal: &QPushButton::clicked,
678 receiver: modifier, slot: &GraphModifier::changeItem);
679 QObject::connect(sender: changeMultipleItemButton,signal: &QPushButton::clicked,
680 receiver: modifier, slot: &GraphModifier::changeMultipleItem);
681 QObject::connect(sender: changeMultipleRowsButton,signal: &QPushButton::clicked,
682 receiver: modifier, slot: &GraphModifier::changeMultipleRows);
683 QObject::connect(sender: addRowButton,signal: &QPushButton::clicked,
684 receiver: modifier, slot: &GraphModifier::addRow);
685 QObject::connect(sender: addRowsButton,signal: &QPushButton::clicked,
686 receiver: modifier, slot: &GraphModifier::addRows);
687 QObject::connect(sender: insertRowButton,signal: &QPushButton::clicked,
688 receiver: modifier, slot: &GraphModifier::insertRow);
689 QObject::connect(sender: insertRowsButton,signal: &QPushButton::clicked,
690 receiver: modifier, slot: &GraphModifier::insertRows);
691 QObject::connect(sender: removeRowButton,signal: &QPushButton::clicked,
692 receiver: modifier, slot: &GraphModifier::removeRow);
693 QObject::connect(sender: resetArrayButton,signal: &QPushButton::clicked,
694 receiver: modifier, slot: &GraphModifier::resetArray);
695 QObject::connect(sender: resetArrayEmptyButton,signal: &QPushButton::clicked,
696 receiver: modifier, slot: &GraphModifier::resetArrayEmpty);
697 QObject::connect(sender: massiveDataTestButton,signal: &QPushButton::clicked,
698 receiver: modifier, slot: &GraphModifier::massiveDataTest);
699 QObject::connect(sender: testReverseButton, signal: &QPushButton::clicked,
700 receiver: modifier, slot: &GraphModifier::testAxisReverse);
701 QObject::connect(sender: testDataOrderingButton, signal: &QPushButton::clicked,
702 receiver: modifier, slot: &GraphModifier::testDataOrdering);
703 QObject::connect(sender: axisTitlesVisibleCB, signal: &QCheckBox::stateChanged,
704 receiver: modifier, slot: &GraphModifier::toggleAxisTitleVisibility);
705 QObject::connect(sender: axisTitlesFixedCB, signal: &QCheckBox::stateChanged,
706 receiver: modifier, slot: &GraphModifier::toggleAxisTitleFixed);
707 QObject::connect(sender: axisLabelRotationSlider, signal: &QSlider::valueChanged, receiver: modifier,
708 slot: &GraphModifier::changeLabelRotation);
709 QObject::connect(sender: xAscendingCB, signal: &QCheckBox::stateChanged,
710 receiver: modifier, slot: &GraphModifier::toggleXAscending);
711 QObject::connect(sender: zAscendingCB, signal: &QCheckBox::stateChanged,
712 receiver: modifier, slot: &GraphModifier::toggleZAscending);
713 QObject::connect(sender: polarCB, signal: &QCheckBox::stateChanged,
714 receiver: modifier, slot: &GraphModifier::togglePolar);
715
716 QObject::connect(sender: aspectRatioSlider, signal: &QSlider::valueChanged,
717 receiver: modifier, slot: &GraphModifier::setAspectRatio);
718 QObject::connect(sender: horizontalAspectRatioSlider, signal: &QSlider::valueChanged,
719 receiver: modifier, slot: &GraphModifier::setHorizontalAspectRatio);
720 QObject::connect(sender: surfaceTextureCB, signal: &QCheckBox::stateChanged,
721 receiver: modifier, slot: &GraphModifier::setSurfaceTexture);
722 QObject::connect(sender: cameraTargetSliderX, signal: &QSlider::valueChanged, receiver: modifier,
723 slot: &GraphModifier::setCameraTargetX);
724 QObject::connect(sender: cameraTargetSliderY, signal: &QSlider::valueChanged, receiver: modifier,
725 slot: &GraphModifier::setCameraTargetY);
726 QObject::connect(sender: cameraTargetSliderZ, signal: &QSlider::valueChanged, receiver: modifier,
727 slot: &GraphModifier::setCameraTargetZ);
728 QObject::connect(sender: marginSlider, signal: &QSlider::valueChanged, receiver: modifier,
729 slot: &GraphModifier::setGraphMargin);
730
731#ifdef MULTI_SERIES
732 modifier->setSeries1CB(series1CB);
733 modifier->setSeries2CB(series2CB);
734 modifier->setSeries3CB(series3CB);
735 modifier->setSeries4CB(series4CB);
736 series1CB->setChecked(true);
737 series2CB->setChecked(true);
738 series3CB->setChecked(true);
739 series4CB->setChecked(true);
740#endif
741 modifier->setAxisRangeSliderX(axisRangeSliderX);
742 modifier->setAxisRangeSliderZ(axisRangeSliderZ);
743 modifier->setAxisMinSliderX(axisMinSliderX);
744 modifier->setAxisMinSliderZ(axisMinSliderZ);
745 selectionMode->setCurrentIndex(1);
746#ifndef MULTI_SERIES
747 modifier->setGridSliderZ(gridSliderZ);
748 modifier->setGridSliderX(gridSliderX);
749 modifier->toggleGridSliderLock(gridSlidersLockCB->checkState());
750 modifier->setSelectionInfoLabel(selectionInfoLabel);
751 sqrtSinCB->setChecked(true);
752#endif
753 shadowQuality->setCurrentIndex(3);
754
755 return app.exec();
756}
757

source code of qtdatavis3d/tests/manual/surfacetest/main.cpp