mirror of https://github.com/qt/qtgraphs.git
Clang-format examples
Task-number: QTBUG-117669 Change-Id: Ia093d45deb65d7e2767fa11a80b3e26ff1a29c8e Reviewed-by: Kwanghyo Park <kwanghyo.park@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
This commit is contained in:
parent
8c431d527a
commit
0296adf15e
|
|
@ -7,15 +7,13 @@
|
|||
|
||||
static const qreal oneDayMs = 60.0 * 60.0 * 24.0 * 1000.0;
|
||||
|
||||
CustomFormatter::CustomFormatter(QObject *parent) :
|
||||
QValue3DAxisFormatter(parent)
|
||||
CustomFormatter::CustomFormatter(QObject *parent)
|
||||
: QValue3DAxisFormatter(parent)
|
||||
{
|
||||
qRegisterMetaType<QValue3DAxisFormatter *>();
|
||||
}
|
||||
|
||||
CustomFormatter::~CustomFormatter()
|
||||
{
|
||||
}
|
||||
CustomFormatter::~CustomFormatter() {}
|
||||
|
||||
//! [1]
|
||||
QValue3DAxisFormatter *CustomFormatter::createNewInstance() const
|
||||
|
|
@ -86,9 +84,9 @@ void CustomFormatter::recalculate()
|
|||
for (int j = 0; j < subGridCount; j++) {
|
||||
float position;
|
||||
if (i)
|
||||
position = gridPositions.at(i - 1) + subSegmentStep * (j + 1);
|
||||
position = gridPositions.at(i - 1) + subSegmentStep * (j + 1);
|
||||
else
|
||||
position = gridPositions.at(0) - segmentStep + subSegmentStep * (j + 1);
|
||||
position = gridPositions.at(0) - segmentStep + subSegmentStep * (j + 1);
|
||||
if (position > 1.0f || position < 0.0f)
|
||||
position = gridPositions.at(0);
|
||||
subGridPositions[i * subGridCount + j] = position;
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
#ifndef CUSTOMFORMATTER_H
|
||||
#define CUSTOMFORMATTER_H
|
||||
|
||||
#include <QtGraphs/qvalue3daxisformatter.h>
|
||||
#include <QtCore/qdatetime.h>
|
||||
#include <QtGraphs/qvalue3daxisformatter.h>
|
||||
#include <QtQml/qqmlregistration.h>
|
||||
|
||||
//! [2]
|
||||
|
|
@ -19,7 +19,8 @@ class CustomFormatter : public QValue3DAxisFormatter
|
|||
Q_PROPERTY(QDate originDate READ originDate WRITE setOriginDate NOTIFY originDateChanged)
|
||||
//! [1]
|
||||
//! [3]
|
||||
Q_PROPERTY(QString selectionFormat READ selectionFormat WRITE setSelectionFormat NOTIFY selectionFormatChanged)
|
||||
Q_PROPERTY(QString selectionFormat READ selectionFormat WRITE setSelectionFormat NOTIFY
|
||||
selectionFormatChanged)
|
||||
//! [3]
|
||||
public:
|
||||
explicit CustomFormatter(QObject *parent = 0);
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include <QtGui/qguiapplication.h>
|
||||
#include <QtQuick/qquickview.h>
|
||||
#include <QtQml/qqmlengine.h>
|
||||
#include <QtQml>
|
||||
#include <QtQuick/qquickview.h>
|
||||
|
||||
#ifdef QMAKE_BUILD
|
||||
#include "customformatter.h"
|
||||
|
|
@ -21,15 +21,15 @@ int main(int argc, char *argv[])
|
|||
|
||||
QQuickView viewer;
|
||||
|
||||
// The following are needed to make examples run without having to install the module
|
||||
// in desktop environments.
|
||||
// The following are needed to make examples run without having to install the
|
||||
// module in desktop environments.
|
||||
#ifdef Q_OS_WIN
|
||||
QString extraImportPath(QStringLiteral("%1/../../../../%2"));
|
||||
#else
|
||||
QString extraImportPath(QStringLiteral("%1/../../../%2"));
|
||||
#endif
|
||||
viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
|
||||
QString::fromLatin1("qml")));
|
||||
viewer.engine()->addImportPath(
|
||||
extraImportPath.arg(QGuiApplication::applicationDirPath(), QString::fromLatin1("qml")));
|
||||
QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
|
||||
|
||||
viewer.setTitle(QStringLiteral("Axis Handling"));
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include <QtGui/qguiapplication.h>
|
||||
#include <QtQuick/qquickview.h>
|
||||
#include <QtQml/qqmlengine.h>
|
||||
#include <QtQuick/qquickview.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
|
@ -11,15 +11,15 @@ int main(int argc, char *argv[])
|
|||
|
||||
QQuickView viewer;
|
||||
|
||||
// The following are needed to make examples run without having to install the module
|
||||
// in desktop environments.
|
||||
// The following are needed to make examples run without having to install the
|
||||
// module in desktop environments.
|
||||
#ifdef Q_OS_WIN
|
||||
QString extraImportPath(QStringLiteral("%1/../../../../%2"));
|
||||
#else
|
||||
QString extraImportPath(QStringLiteral("%1/../../../%2"));
|
||||
#endif
|
||||
viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
|
||||
QString::fromLatin1("qml")));
|
||||
viewer.engine()->addImportPath(
|
||||
extraImportPath.arg(QGuiApplication::applicationDirPath(), QString::fromLatin1("qml")));
|
||||
|
||||
viewer.setTitle(QStringLiteral("Monthly income / expenses"));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtQuick/QQuickView>
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtQml/QQmlEngine>
|
||||
#include <QtQuick/QQuickView>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
|
@ -12,15 +12,15 @@ int main(int argc, char *argv[])
|
|||
|
||||
QQuickView viewer;
|
||||
|
||||
// The following are needed to make examples run without having to install the module
|
||||
// in desktop environments.
|
||||
// The following are needed to make examples run without having to install the
|
||||
// module in desktop environments.
|
||||
#ifdef Q_OS_WIN
|
||||
QString extraImportPath(QStringLiteral("%1/../../../../%2"));
|
||||
#else
|
||||
QString extraImportPath(QStringLiteral("%1/../../../%2"));
|
||||
#endif
|
||||
viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
|
||||
QString::fromLatin1("qml")));
|
||||
viewer.engine()->addImportPath(
|
||||
extraImportPath.arg(QGuiApplication::applicationDirPath(), QString::fromLatin1("qml")));
|
||||
//! [4]
|
||||
QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
|
||||
//! [4]
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
#include <QtCore/qmath.h>
|
||||
#include <QtCore/qrandom.h>
|
||||
|
||||
DataSource::DataSource(QObject *parent) :
|
||||
QObject(parent),
|
||||
m_index(-1)
|
||||
DataSource::DataSource(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_index(-1)
|
||||
{
|
||||
//! [3]
|
||||
qRegisterMetaType<QSurface3DSeries *>();
|
||||
|
|
@ -19,10 +19,15 @@ DataSource::~DataSource()
|
|||
clearData();
|
||||
}
|
||||
|
||||
void DataSource::generateData(int cacheCount, int rowCount, int columnCount,
|
||||
float xMin, float xMax,
|
||||
float yMin, float yMax,
|
||||
float zMin, float zMax)
|
||||
void DataSource::generateData(int cacheCount,
|
||||
int rowCount,
|
||||
int columnCount,
|
||||
float xMin,
|
||||
float xMax,
|
||||
float yMin,
|
||||
float yMax,
|
||||
float zMin,
|
||||
float zMax)
|
||||
{
|
||||
if (!cacheCount || !rowCount || !columnCount)
|
||||
return;
|
||||
|
|
@ -56,16 +61,15 @@ void DataSource::generateData(int cacheCount, int rowCount, int columnCount,
|
|||
float yRangeMod = yRange * rowMod;
|
||||
float zRangeMod = zRange * rowMod;
|
||||
float z = zRangeMod + zMin;
|
||||
qreal rowColWaveAngleMul = M_PI * M_PI * rowMod;
|
||||
float rowColWaveMul = yRangeMod * 0.2f;
|
||||
qreal waveAngleMul = M_PI * M_PI * rowMod;
|
||||
float waveMul = yRangeMod * 0.2f;
|
||||
for (int k = 0; k < columnCount; k++) {
|
||||
float colMod = (float(k)) / float(columnCount);
|
||||
float xRangeMod = xRange * colMod;
|
||||
float x = xRangeMod + xMin + cacheXAdjustment;
|
||||
float colWave = float(qSin((2.0 * M_PI * colMod) - (1.0 / 2.0 * M_PI)) + 1.0);
|
||||
float y = (colWave * ((float(qSin(rowColWaveAngleMul * colMod) + 1.0))))
|
||||
* rowColWaveMul
|
||||
+ QRandomGenerator::global()->bounded(0.15f) * yRangeMod;
|
||||
float y = (colWave * ((float(qSin(waveAngleMul * colMod) + 1.0)))) * waveMul
|
||||
+ QRandomGenerator::global()->bounded(0.15f) * yRangeMod;
|
||||
|
||||
int index = k + cacheIndexAdjustment;
|
||||
if (index >= columnCount) {
|
||||
|
|
@ -96,7 +100,7 @@ void DataSource::update(QSurface3DSeries *series)
|
|||
// If the first time or the dimensions of the cache array have changed,
|
||||
// reconstruct the reset array
|
||||
if (m_resetArray.isEmpty() || series->dataProxy()->rowCount() != newRowCount
|
||||
|| series->dataProxy()->columnCount() != newColumnCount) {
|
||||
|| series->dataProxy()->columnCount() != newColumnCount) {
|
||||
m_resetArray.clear();
|
||||
m_resetArray.reserve(newRowCount);
|
||||
for (int i = 0; i < newRowCount; i++)
|
||||
|
|
|
|||
|
|
@ -20,10 +20,15 @@ public:
|
|||
virtual ~DataSource();
|
||||
|
||||
//! [1]
|
||||
Q_INVOKABLE void generateData(int cacheCount, int rowCount, int columnCount,
|
||||
float xMin, float xMax,
|
||||
float yMin, float yMax,
|
||||
float zMin, float zMax);
|
||||
Q_INVOKABLE void generateData(int cacheCount,
|
||||
int rowCount,
|
||||
int columnCount,
|
||||
float xMin,
|
||||
float xMax,
|
||||
float yMin,
|
||||
float yMax,
|
||||
float zMin,
|
||||
float zMax);
|
||||
|
||||
Q_INVOKABLE void update(QSurface3DSeries *series);
|
||||
//! [1]
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
//! [0]
|
||||
|
||||
#include <QtGui/qguiapplication.h>
|
||||
#include <QtQuick/qquickview.h>
|
||||
#include <QtQml/qqmlengine.h>
|
||||
#include <QtQuick/qquickview.h>
|
||||
|
||||
#ifdef QMAKE_BUILD
|
||||
#include "datasource.h"
|
||||
|
|
@ -28,15 +28,15 @@ int main(int argc, char *argv[])
|
|||
viewer.setFormat(qDefaultSurfaceFormat(true));
|
||||
//! [1]
|
||||
|
||||
// The following are needed to make examples run without having to install the module
|
||||
// in desktop environments.
|
||||
// The following are needed to make examples run without having to install the
|
||||
// module in desktop environments.
|
||||
#ifdef Q_OS_WIN
|
||||
QString extraImportPath(QStringLiteral("%1/../../../../%2"));
|
||||
#else
|
||||
QString extraImportPath(QStringLiteral("%1/../../../%2"));
|
||||
#endif
|
||||
viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
|
||||
QString::fromLatin1("qml")));
|
||||
viewer.engine()->addImportPath(
|
||||
extraImportPath.arg(QGuiApplication::applicationDirPath(), QString::fromLatin1("qml")));
|
||||
QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
|
||||
|
||||
viewer.setTitle(QStringLiteral("Surface Graph Gallery"));
|
||||
|
|
|
|||
|
|
@ -4,12 +4,14 @@
|
|||
#include "axesinputhandler.h"
|
||||
#include <QtCore/qmath.h>
|
||||
|
||||
AxesInputHandler::AxesInputHandler(QAbstract3DGraph *graph, QObject *parent) :
|
||||
Q3DInputHandler(parent)
|
||||
AxesInputHandler::AxesInputHandler(QAbstract3DGraph *graph, QObject *parent)
|
||||
: Q3DInputHandler(parent)
|
||||
{
|
||||
//! [3]
|
||||
// Connect to the item selection signal from graph
|
||||
connect(graph, &QAbstract3DGraph::selectedElementChanged, this,
|
||||
connect(graph,
|
||||
&QAbstract3DGraph::selectedElementChanged,
|
||||
this,
|
||||
&AxesInputHandler::handleElementSelected);
|
||||
//! [3]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,17 +14,13 @@ class AxesInputHandler : public Q3DInputHandler
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
enum InputState {
|
||||
StateNormal = 0,
|
||||
StateDraggingX,
|
||||
StateDraggingZ,
|
||||
StateDraggingY
|
||||
};
|
||||
enum InputState { StateNormal = 0, StateDraggingX, StateDraggingZ, StateDraggingY };
|
||||
|
||||
public:
|
||||
explicit AxesInputHandler(QAbstract3DGraph *graph, QObject *parent = 0);
|
||||
|
||||
inline void setAxes(QValue3DAxis *axisX, QValue3DAxis *axisZ, QValue3DAxis *axisY) {
|
||||
inline void setAxes(QValue3DAxis *axisX, QValue3DAxis *axisZ, QValue3DAxis *axisY)
|
||||
{
|
||||
m_axisX = axisX;
|
||||
m_axisZ = axisZ;
|
||||
m_axisY = axisY;
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@
|
|||
|
||||
#include "bargraph.h"
|
||||
|
||||
#include <QtGui/qfontdatabase.h>
|
||||
#include <QtWidgets/qboxlayout.h>
|
||||
#include <QtWidgets/qpushbutton.h>
|
||||
#include <QtWidgets/qbuttongroup.h>
|
||||
#include <QtWidgets/qcheckbox.h>
|
||||
#include <QtWidgets/qslider.h>
|
||||
#include <QtWidgets/qfontcombobox.h>
|
||||
#include <QtWidgets/qlabel.h>
|
||||
#include <QtWidgets/qpushbutton.h>
|
||||
#include <QtWidgets/qradiobutton.h>
|
||||
#include <QtWidgets/qbuttongroup.h>
|
||||
#include <QtGui/qfontdatabase.h>
|
||||
#include <QtWidgets/qslider.h>
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
|
|
@ -62,12 +62,18 @@ void BarGraph::initialize()
|
|||
int index = metaObj.indexOfEnumerator("Mesh");
|
||||
QMetaEnum metaEnum = metaObj.enumerator(index);
|
||||
barStyleList->addItem(u"Bar"_s, metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Bar)));
|
||||
barStyleList->addItem(u"Pyramid"_s, metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Pyramid)));
|
||||
barStyleList->addItem(u"Cone"_s, metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Cone)));
|
||||
barStyleList->addItem(u"Cylinder"_s, metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Cylinder)));
|
||||
barStyleList->addItem(u"Bevel bar"_s, metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::BevelBar)));
|
||||
barStyleList->addItem(u"Sphere"_s, metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Sphere)));
|
||||
barStyleList->addItem(u"UserDefined"_s, metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::UserDefined)));
|
||||
barStyleList->addItem(u"Pyramid"_s,
|
||||
metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Pyramid)));
|
||||
barStyleList->addItem(u"Cone"_s,
|
||||
metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Cone)));
|
||||
barStyleList->addItem(u"Cylinder"_s,
|
||||
metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Cylinder)));
|
||||
barStyleList->addItem(u"Bevel bar"_s,
|
||||
metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::BevelBar)));
|
||||
barStyleList->addItem(u"Sphere"_s,
|
||||
metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Sphere)));
|
||||
barStyleList->addItem(u"UserDefined"_s,
|
||||
metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::UserDefined)));
|
||||
barStyleList->setCurrentIndex(4);
|
||||
|
||||
auto *cameraButton = new QPushButton(m_barsWidget);
|
||||
|
|
@ -77,38 +83,37 @@ void BarGraph::initialize()
|
|||
zoomToSelectedButton->setText(u"Zoom to selected bar"_s);
|
||||
|
||||
auto *selectionModeList = new QComboBox(m_barsWidget);
|
||||
selectionModeList->addItem(u"None"_s,
|
||||
int(QAbstract3DGraph::SelectionNone));
|
||||
selectionModeList->addItem(u"Bar"_s,
|
||||
int(QAbstract3DGraph::SelectionItem));
|
||||
selectionModeList->addItem(u"Row"_s,
|
||||
int(QAbstract3DGraph::SelectionRow));
|
||||
selectionModeList->addItem(u"Bar and Row"_s,
|
||||
int(QAbstract3DGraph::SelectionItemAndRow));
|
||||
selectionModeList->addItem(u"Column"_s,
|
||||
int(QAbstract3DGraph::SelectionColumn));
|
||||
selectionModeList->addItem(u"Bar and Column"_s,
|
||||
int(QAbstract3DGraph::SelectionItemAndColumn));
|
||||
selectionModeList->addItem(u"Row and Column"_s,
|
||||
int(QAbstract3DGraph::SelectionRowAndColumn));
|
||||
selectionModeList->addItem(u"None"_s, int(QAbstract3DGraph::SelectionNone));
|
||||
selectionModeList->addItem(u"Bar"_s, int(QAbstract3DGraph::SelectionItem));
|
||||
selectionModeList->addItem(u"Row"_s, int(QAbstract3DGraph::SelectionRow));
|
||||
selectionModeList->addItem(u"Bar and Row"_s, int(QAbstract3DGraph::SelectionItemAndRow));
|
||||
selectionModeList->addItem(u"Column"_s, int(QAbstract3DGraph::SelectionColumn));
|
||||
selectionModeList->addItem(u"Bar and Column"_s, int(QAbstract3DGraph::SelectionItemAndColumn));
|
||||
selectionModeList->addItem(u"Row and Column"_s, int(QAbstract3DGraph::SelectionRowAndColumn));
|
||||
selectionModeList->addItem(u"Bar, Row and Column"_s,
|
||||
int(QAbstract3DGraph::SelectionItemRowAndColumn));
|
||||
selectionModeList->addItem(u"Slice into Row"_s,
|
||||
int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionRow));
|
||||
int(QAbstract3DGraph::SelectionSlice
|
||||
| QAbstract3DGraph::SelectionRow));
|
||||
selectionModeList->addItem(u"Slice into Row and Item"_s,
|
||||
int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndRow));
|
||||
int(QAbstract3DGraph::SelectionSlice
|
||||
| QAbstract3DGraph::SelectionItemAndRow));
|
||||
selectionModeList->addItem(u"Slice into Column"_s,
|
||||
int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionColumn));
|
||||
int(QAbstract3DGraph::SelectionSlice
|
||||
| QAbstract3DGraph::SelectionColumn));
|
||||
selectionModeList->addItem(u"Slice into Column and Item"_s,
|
||||
int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndColumn));
|
||||
int(QAbstract3DGraph::SelectionSlice
|
||||
| QAbstract3DGraph::SelectionItemAndColumn));
|
||||
selectionModeList->addItem(u"Multi: Bar, Row, Col"_s,
|
||||
int(QAbstract3DGraph::SelectionItemRowAndColumn
|
||||
| QAbstract3DGraph::SelectionMultiSeries));
|
||||
selectionModeList->addItem(u"Multi, Slice: Row, Item"_s,
|
||||
int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndRow
|
||||
int(QAbstract3DGraph::SelectionSlice
|
||||
| QAbstract3DGraph::SelectionItemAndRow
|
||||
| QAbstract3DGraph::SelectionMultiSeries));
|
||||
selectionModeList->addItem(u"Multi, Slice: Col, Item"_s,
|
||||
int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndColumn
|
||||
int(QAbstract3DGraph::SelectionSlice
|
||||
| QAbstract3DGraph::SelectionItemAndColumn
|
||||
| QAbstract3DGraph::SelectionMultiSeries));
|
||||
selectionModeList->setCurrentIndex(1);
|
||||
|
||||
|
|
@ -249,80 +254,135 @@ void BarGraph::initialize()
|
|||
//! [5]
|
||||
QObject::connect(rotationSliderY, &QSlider::valueChanged, m_modifier, &GraphModifier::rotateY);
|
||||
|
||||
QObject::connect(labelButton, &QPushButton::clicked, m_modifier,
|
||||
QObject::connect(labelButton,
|
||||
&QPushButton::clicked,
|
||||
m_modifier,
|
||||
&GraphModifier::changeLabelBackground);
|
||||
QObject::connect(cameraButton, &QPushButton::clicked, m_modifier,
|
||||
QObject::connect(cameraButton,
|
||||
&QPushButton::clicked,
|
||||
m_modifier,
|
||||
&GraphModifier::changePresetCamera);
|
||||
QObject::connect(zoomToSelectedButton, &QPushButton::clicked, m_modifier,
|
||||
QObject::connect(zoomToSelectedButton,
|
||||
&QPushButton::clicked,
|
||||
m_modifier,
|
||||
&GraphModifier::zoomToSelectedBar);
|
||||
|
||||
QObject::connect(backgroundCheckBox, &QCheckBox::stateChanged, m_modifier,
|
||||
QObject::connect(backgroundCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::setBackgroundEnabled);
|
||||
QObject::connect(gridCheckBox, &QCheckBox::stateChanged, m_modifier,
|
||||
QObject::connect(gridCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::setGridEnabled);
|
||||
QObject::connect(smoothCheckBox, &QCheckBox::stateChanged, m_modifier,
|
||||
QObject::connect(smoothCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::setSmoothBars);
|
||||
QObject::connect(seriesCheckBox, &QCheckBox::stateChanged, m_modifier,
|
||||
QObject::connect(seriesCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::setSeriesVisibility);
|
||||
QObject::connect(reverseValueAxisCheckBox, &QCheckBox::stateChanged, m_modifier,
|
||||
QObject::connect(reverseValueAxisCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::setReverseValueAxis);
|
||||
QObject::connect(reflectionCheckBox, &QCheckBox::stateChanged, m_modifier,
|
||||
QObject::connect(reflectionCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::setReflection);
|
||||
|
||||
QObject::connect(m_modifier, &GraphModifier::backgroundEnabledChanged,
|
||||
backgroundCheckBox, &QCheckBox::setChecked);
|
||||
QObject::connect(m_modifier, &GraphModifier::gridEnabledChanged,
|
||||
gridCheckBox, &QCheckBox::setChecked);
|
||||
QObject::connect(m_modifier,
|
||||
&GraphModifier::backgroundEnabledChanged,
|
||||
backgroundCheckBox,
|
||||
&QCheckBox::setChecked);
|
||||
QObject::connect(m_modifier,
|
||||
&GraphModifier::gridEnabledChanged,
|
||||
gridCheckBox,
|
||||
&QCheckBox::setChecked);
|
||||
|
||||
QObject::connect(rangeList, &QComboBox::currentIndexChanged, m_modifier,
|
||||
QObject::connect(rangeList,
|
||||
&QComboBox::currentIndexChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::changeRange);
|
||||
|
||||
QObject::connect(barStyleList, &QComboBox::currentIndexChanged, m_modifier,
|
||||
QObject::connect(barStyleList,
|
||||
&QComboBox::currentIndexChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::changeStyle);
|
||||
|
||||
QObject::connect(selectionModeList, &QComboBox::currentIndexChanged, m_modifier,
|
||||
QObject::connect(selectionModeList,
|
||||
&QComboBox::currentIndexChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::changeSelectionMode);
|
||||
|
||||
QObject::connect(themeList, &QComboBox::currentIndexChanged, m_modifier,
|
||||
QObject::connect(themeList,
|
||||
&QComboBox::currentIndexChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::changeTheme);
|
||||
|
||||
QObject::connect(shadowQuality, &QComboBox::currentIndexChanged, m_modifier,
|
||||
QObject::connect(shadowQuality,
|
||||
&QComboBox::currentIndexChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::changeShadowQuality);
|
||||
|
||||
QObject::connect(m_modifier, &GraphModifier::shadowQualityChanged, shadowQuality,
|
||||
QObject::connect(m_modifier,
|
||||
&GraphModifier::shadowQualityChanged,
|
||||
shadowQuality,
|
||||
&QComboBox::setCurrentIndex);
|
||||
QObject::connect(m_barsGraph, &Q3DBars::shadowQualityChanged, m_modifier,
|
||||
QObject::connect(m_barsGraph,
|
||||
&Q3DBars::shadowQualityChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::shadowQualityUpdatedByVisual);
|
||||
|
||||
QObject::connect(fontSizeSlider, &QSlider::valueChanged, m_modifier,
|
||||
QObject::connect(fontSizeSlider,
|
||||
&QSlider::valueChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::changeFontSize);
|
||||
QObject::connect(fontList, &QFontComboBox::currentFontChanged, m_modifier,
|
||||
QObject::connect(fontList,
|
||||
&QFontComboBox::currentFontChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::changeFont);
|
||||
|
||||
QObject::connect(m_modifier, &GraphModifier::fontSizeChanged, fontSizeSlider,
|
||||
QObject::connect(m_modifier,
|
||||
&GraphModifier::fontSizeChanged,
|
||||
fontSizeSlider,
|
||||
&QSlider::setValue);
|
||||
QObject::connect(m_modifier, &GraphModifier::fontChanged, fontList,
|
||||
QObject::connect(m_modifier,
|
||||
&GraphModifier::fontChanged,
|
||||
fontList,
|
||||
&QFontComboBox::setCurrentFont);
|
||||
|
||||
QObject::connect(axisTitlesVisibleCB, &QCheckBox::stateChanged, m_modifier,
|
||||
QObject::connect(axisTitlesVisibleCB,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::setAxisTitleVisibility);
|
||||
QObject::connect(axisTitlesFixedCB, &QCheckBox::stateChanged, m_modifier,
|
||||
QObject::connect(axisTitlesFixedCB,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::setAxisTitleFixed);
|
||||
QObject::connect(axisLabelRotationSlider, &QSlider::valueChanged, m_modifier,
|
||||
QObject::connect(axisLabelRotationSlider,
|
||||
&QSlider::valueChanged,
|
||||
m_modifier,
|
||||
&GraphModifier::changeLabelRotation);
|
||||
|
||||
QObject::connect(modeWeather, &QRadioButton::toggled, m_modifier,
|
||||
QObject::connect(modeWeather,
|
||||
&QRadioButton::toggled,
|
||||
m_modifier,
|
||||
&GraphModifier::setDataModeToWeather);
|
||||
QObject::connect(modeCustomProxy, &QRadioButton::toggled, m_modifier,
|
||||
QObject::connect(modeCustomProxy,
|
||||
&QRadioButton::toggled,
|
||||
m_modifier,
|
||||
&GraphModifier::setDataModeToCustom);
|
||||
QObject::connect(modeWeather, &QRadioButton::toggled, seriesCheckBox,
|
||||
QObject::connect(modeWeather, &QRadioButton::toggled, seriesCheckBox, &QCheckBox::setEnabled);
|
||||
QObject::connect(modeWeather, &QRadioButton::toggled, rangeList, &QComboBox::setEnabled);
|
||||
QObject::connect(modeWeather,
|
||||
&QRadioButton::toggled,
|
||||
axisTitlesVisibleCB,
|
||||
&QCheckBox::setEnabled);
|
||||
QObject::connect(modeWeather, &QRadioButton::toggled, rangeList,
|
||||
&QComboBox::setEnabled);
|
||||
QObject::connect(modeWeather, &QRadioButton::toggled, axisTitlesVisibleCB,
|
||||
&QCheckBox::setEnabled);
|
||||
QObject::connect(modeWeather, &QRadioButton::toggled, axisTitlesFixedCB,
|
||||
&QCheckBox::setEnabled);
|
||||
QObject::connect(modeWeather, &QRadioButton::toggled, axisLabelRotationSlider,
|
||||
QObject::connect(modeWeather, &QRadioButton::toggled, axisTitlesFixedCB, &QCheckBox::setEnabled);
|
||||
QObject::connect(modeWeather,
|
||||
&QRadioButton::toggled,
|
||||
axisLabelRotationSlider,
|
||||
&QSlider::setEnabled);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
#ifndef BARGRAPH_H
|
||||
#define BARGRAPH_H
|
||||
|
||||
#include <QtGraphs/q3dbars.h>
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtGraphs/q3dbars.h>
|
||||
#include "graphmodifier.h"
|
||||
|
||||
class BarGraph : public QObject
|
||||
|
|
|
|||
|
|
@ -5,11 +5,13 @@
|
|||
|
||||
#include <QtCore/qmath.h>
|
||||
|
||||
CustomInputHandler::CustomInputHandler(QAbstract3DGraph *graph, QObject *parent) :
|
||||
Q3DInputHandler(parent)
|
||||
CustomInputHandler::CustomInputHandler(QAbstract3DGraph *graph, QObject *parent)
|
||||
: Q3DInputHandler(parent)
|
||||
{
|
||||
// Connect to the item selection signal from graph
|
||||
connect(graph, &QAbstract3DGraph::selectedElementChanged, this,
|
||||
connect(graph,
|
||||
&QAbstract3DGraph::selectedElementChanged,
|
||||
this,
|
||||
&CustomInputHandler::handleElementSelected);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,17 +14,13 @@ class CustomInputHandler : public Q3DInputHandler
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
enum InputState {
|
||||
StateNormal = 0,
|
||||
StateDraggingX,
|
||||
StateDraggingZ,
|
||||
StateDraggingY
|
||||
};
|
||||
enum InputState { StateNormal = 0, StateDraggingX, StateDraggingZ, StateDraggingY };
|
||||
|
||||
public:
|
||||
explicit CustomInputHandler(QAbstract3DGraph *graph, QObject *parent = 0);
|
||||
|
||||
inline void setLimits(float min, float max, float minRange) {
|
||||
inline void setLimits(float min, float max, float minRange)
|
||||
{
|
||||
m_areaMinValue = min;
|
||||
m_areaMaxValue = max;
|
||||
m_axisXMinValue = m_areaMinValue;
|
||||
|
|
@ -34,7 +30,8 @@ public:
|
|||
m_axisXMinRange = minRange;
|
||||
m_axisZMinRange = minRange;
|
||||
}
|
||||
inline void setAxes(QValue3DAxis *axisX, QValue3DAxis *axisY, QValue3DAxis *axisZ) {
|
||||
inline void setAxes(QValue3DAxis *axisX, QValue3DAxis *axisY, QValue3DAxis *axisZ)
|
||||
{
|
||||
m_axisX = axisX;
|
||||
m_axisY = axisY;
|
||||
m_axisZ = axisZ;
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@
|
|||
#include "graphmodifier.h"
|
||||
#include "rainfalldata.h"
|
||||
|
||||
#include <QtCore/qmath.h>
|
||||
#include <QtGraphs/q3dscene.h>
|
||||
#include <QtGraphs/q3dtheme.h>
|
||||
#include <QtGraphs/qbar3dseries.h>
|
||||
#include <QtGraphs/qbardataproxy.h>
|
||||
#include <QtGraphs/qcategory3daxis.h>
|
||||
#include <QtGraphs/qvalue3daxis.h>
|
||||
#include <QtGraphs/qbardataproxy.h>
|
||||
#include <QtGraphs/q3dscene.h>
|
||||
#include <QtGraphs/qbar3dseries.h>
|
||||
#include <QtGraphs/q3dtheme.h>
|
||||
#include <QtCore/qmath.h>
|
||||
#include <QtWidgets/qcombobox.h>
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
|
@ -18,18 +18,19 @@ using namespace Qt::StringLiterals;
|
|||
// TODO: Many of the values do not affect custom proxy series now - should be fixed
|
||||
|
||||
//! [0]
|
||||
GraphModifier::GraphModifier(Q3DBars *bargraph, QObject *parent) :
|
||||
QObject(parent),
|
||||
m_graph(bargraph),
|
||||
//! [0]
|
||||
//! [1]
|
||||
m_temperatureAxis(new QValue3DAxis),
|
||||
m_yearAxis(new QCategory3DAxis),
|
||||
m_monthAxis(new QCategory3DAxis),
|
||||
m_primarySeries(new QBar3DSeries),
|
||||
m_secondarySeries(new QBar3DSeries),
|
||||
m_celsiusString(u"°C"_s)
|
||||
GraphModifier::GraphModifier(Q3DBars *bargraph, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_graph(bargraph)
|
||||
,
|
||||
//! [0]
|
||||
//! [1]
|
||||
m_temperatureAxis(new QValue3DAxis)
|
||||
, m_yearAxis(new QCategory3DAxis)
|
||||
, m_monthAxis(new QCategory3DAxis)
|
||||
, m_primarySeries(new QBar3DSeries)
|
||||
, m_secondarySeries(new QBar3DSeries)
|
||||
, m_celsiusString(u"°C"_s)
|
||||
//! [1]
|
||||
{
|
||||
//! [2]
|
||||
m_graph->setShadowQuality(QAbstract3DGraph::ShadowQuality::SoftMedium);
|
||||
|
|
@ -39,8 +40,18 @@ GraphModifier::GraphModifier(Q3DBars *bargraph, QObject *parent) :
|
|||
m_graph->setMultiSeriesUniform(true);
|
||||
//! [2]
|
||||
|
||||
m_months = {"January", "February", "March", "April", "May", "June" , "July",
|
||||
"August", "September", "October" , "November", "December"};
|
||||
m_months = {"January",
|
||||
"February",
|
||||
"March",
|
||||
"April",
|
||||
"May",
|
||||
"June",
|
||||
"July",
|
||||
"August",
|
||||
"September",
|
||||
"October",
|
||||
"November",
|
||||
"December"};
|
||||
m_years = {"2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022"};
|
||||
|
||||
//! [3]
|
||||
|
|
@ -133,26 +144,26 @@ void GraphModifier::resetTemperatureData()
|
|||
//! [9a]
|
||||
// Set up data
|
||||
static const float tempOulu[8][12] = {
|
||||
{-7.4f, -2.4f, 0.0f, 3.0f, 8.2f, 11.6f, 14.7f, 15.4f, 11.4f, 4.2f, 2.1f, -2.3f}, // 2015
|
||||
{-13.4f, -3.9f, -1.8f, 3.1f, 10.6f, 13.7f, 17.8f, 13.6f, 10.7f, 3.5f, -3.1f, -4.2f}, // 2016
|
||||
{-7.4f, -2.4f, 0.0f, 3.0f, 8.2f, 11.6f, 14.7f, 15.4f, 11.4f, 4.2f, 2.1f, -2.3f}, // 2015
|
||||
{-13.4f, -3.9f, -1.8f, 3.1f, 10.6f, 13.7f, 17.8f, 13.6f, 10.7f, 3.5f, -3.1f, -4.2f}, // 2016
|
||||
//! [9a]
|
||||
{-5.7f, -6.7f, -3.0f, -0.1f, 4.7f, 12.4f, 16.1f, 14.1f, 9.4f, 3.0f, -0.3f, -3.2f}, // 2017
|
||||
{-6.4f, -11.9f, -7.4f, 1.9f, 11.4f, 12.4f, 21.5f, 16.1f, 11.0f, 4.4f, 2.1f, -4.1f}, // 2018
|
||||
{-11.7f, -6.1f, -2.4f, 3.9f, 7.2f, 14.5f, 15.6f, 14.4f, 8.5f, 2.0f, -3.0f, -1.5f}, // 2019
|
||||
{-2.1f, -3.4f, -1.8f, 0.6f, 7.0f, 17.1f, 15.6f, 15.4f, 11.1f, 5.6f, 1.9f, -1.7f}, // 2020
|
||||
{-9.6f, -11.6f, -3.2f, 2.4f, 7.8f, 17.3f, 19.4f, 14.2f, 8.0f, 5.2f, -2.2f, -8.6f}, // 2021
|
||||
{-7.3f, -6.4f, -1.8f, 1.3f, 8.1f, 15.5f, 17.6f, 17.6f, 9.1f, 5.4f, -1.5f, -4.4f} // 2022
|
||||
{-5.7f, -6.7f, -3.0f, -0.1f, 4.7f, 12.4f, 16.1f, 14.1f, 9.4f, 3.0f, -0.3f, -3.2f}, // 2017
|
||||
{-6.4f, -11.9f, -7.4f, 1.9f, 11.4f, 12.4f, 21.5f, 16.1f, 11.0f, 4.4f, 2.1f, -4.1f}, // 2018
|
||||
{-11.7f, -6.1f, -2.4f, 3.9f, 7.2f, 14.5f, 15.6f, 14.4f, 8.5f, 2.0f, -3.0f, -1.5f}, // 2019
|
||||
{-2.1f, -3.4f, -1.8f, 0.6f, 7.0f, 17.1f, 15.6f, 15.4f, 11.1f, 5.6f, 1.9f, -1.7f}, // 2020
|
||||
{-9.6f, -11.6f, -3.2f, 2.4f, 7.8f, 17.3f, 19.4f, 14.2f, 8.0f, 5.2f, -2.2f, -8.6f}, // 2021
|
||||
{-7.3f, -6.4f, -1.8f, 1.3f, 8.1f, 15.5f, 17.6f, 17.6f, 9.1f, 5.4f, -1.5f, -4.4f} // 2022
|
||||
};
|
||||
|
||||
static const float tempHelsinki[8][12] = {
|
||||
{-2.0f, -0.1f, 1.8f, 5.1f, 9.7f, 13.7f, 16.3f, 17.3f, 12.7f, 5.4f, 4.6f, 2.1f}, // 2015
|
||||
{-10.3f, -0.6f, 0.0f, 4.9f, 14.3f, 15.7f, 17.7f, 16.0f, 12.7f, 4.6f, -1.0f, -0.9f}, // 2016
|
||||
{-2.9f, -3.3f, 0.7f, 2.3f, 9.9f, 13.8f, 16.1f, 15.9f, 11.4f, 5.0f, 2.7f, 0.7f}, // 2017
|
||||
{-2.2f, -8.4f, -4.7f, 5.0f, 15.3f, 15.8f, 21.2f, 18.2f, 13.3f, 6.7f, 2.8f, -2.0f}, // 2018
|
||||
{-6.2f, -0.5f, -0.3f, 6.8f, 10.6f, 17.9f, 17.5f, 16.8f, 11.3f, 5.2f, 1.8f, 1.4f}, // 2019
|
||||
{1.9f, 0.5f, 1.7f, 4.5f, 9.5f, 18.4f, 16.5f, 16.8f, 13.0f, 8.2f, 4.4f, 0.9f}, // 2020
|
||||
{-4.7f, -8.1f, -0.9f, 4.5f, 10.4f, 19.2f, 20.9f, 15.4f, 9.5f, 8.0f, 1.5f, -6.7f}, // 2021
|
||||
{-3.3f, -2.2f, -0.2f, 3.3f, 9.6f, 16.9f, 18.1f, 18.9f, 9.2f, 7.6f, 2.3f, -3.4f} // 2022
|
||||
{-2.0f, -0.1f, 1.8f, 5.1f, 9.7f, 13.7f, 16.3f, 17.3f, 12.7f, 5.4f, 4.6f, 2.1f}, // 2015
|
||||
{-10.3f, -0.6f, 0.0f, 4.9f, 14.3f, 15.7f, 17.7f, 16.0f, 12.7f, 4.6f, -1.0f, -0.9f}, // 2016
|
||||
{-2.9f, -3.3f, 0.7f, 2.3f, 9.9f, 13.8f, 16.1f, 15.9f, 11.4f, 5.0f, 2.7f, 0.7f}, // 2017
|
||||
{-2.2f, -8.4f, -4.7f, 5.0f, 15.3f, 15.8f, 21.2f, 18.2f, 13.3f, 6.7f, 2.8f, -2.0f}, // 2018
|
||||
{-6.2f, -0.5f, -0.3f, 6.8f, 10.6f, 17.9f, 17.5f, 16.8f, 11.3f, 5.2f, 1.8f, 1.4f}, // 2019
|
||||
{1.9f, 0.5f, 1.7f, 4.5f, 9.5f, 18.4f, 16.5f, 16.8f, 13.0f, 8.2f, 4.4f, 0.9f}, // 2020
|
||||
{-4.7f, -8.1f, -0.9f, 4.5f, 10.4f, 19.2f, 20.9f, 15.4f, 9.5f, 8.0f, 1.5f, -6.7f}, // 2021
|
||||
{-3.3f, -2.2f, -0.2f, 3.3f, 9.6f, 16.9f, 18.1f, 18.9f, 9.2f, 7.6f, 2.3f, -3.4f} // 2022
|
||||
};
|
||||
|
||||
// Create data arrays
|
||||
|
|
@ -218,7 +229,7 @@ void GraphModifier::changePresetCamera()
|
|||
//! [7]
|
||||
static int preset = int(QAbstract3DGraph::CameraPreset::Front);
|
||||
|
||||
m_graph->setCameraPreset((QAbstract3DGraph::CameraPreset)preset);
|
||||
m_graph->setCameraPreset((QAbstract3DGraph::CameraPreset) preset);
|
||||
|
||||
if (++preset > int(QAbstract3DGraph::CameraPreset::DirectlyBelow))
|
||||
preset = int(QAbstract3DGraph::CameraPreset::FrontLow);
|
||||
|
|
@ -237,7 +248,8 @@ void GraphModifier::changeTheme(int theme)
|
|||
|
||||
void GraphModifier::changeLabelBackground()
|
||||
{
|
||||
m_graph->activeTheme()->setLabelBackgroundEnabled(!m_graph->activeTheme()->isLabelBackgroundEnabled());
|
||||
m_graph->activeTheme()->setLabelBackgroundEnabled(
|
||||
!m_graph->activeTheme()->isLabelBackgroundEnabled());
|
||||
}
|
||||
|
||||
void GraphModifier::changeSelectionMode(int selectionMode)
|
||||
|
|
@ -308,9 +320,8 @@ void GraphModifier::zoomToSelectedBar()
|
|||
m_animationCameraZoom.setStartValue(QVariant::fromValue(currentZoom));
|
||||
m_animationCameraTarget.setStartValue(QVariant::fromValue(currentTarget));
|
||||
|
||||
QPoint selectedBar = m_graph->selectedSeries()
|
||||
? m_graph->selectedSeries()->selectedBar()
|
||||
: QBar3DSeries::invalidSelectionPosition();
|
||||
QPoint selectedBar = m_graph->selectedSeries() ? m_graph->selectedSeries()->selectedBar()
|
||||
: QBar3DSeries::invalidSelectionPosition();
|
||||
|
||||
if (selectedBar != QBar3DSeries::invalidSelectionPosition()) {
|
||||
// Normalize selected bar position within axis range to determine target coordinates
|
||||
|
|
@ -329,8 +340,10 @@ void GraphModifier::zoomToSelectedBar()
|
|||
qreal endAngleX = 90.0 - qRadiansToDegrees(qAtan(qreal(endTarget.z() / endTarget.x())));
|
||||
if (endTarget.x() > 0.0f)
|
||||
endAngleX -= 180.0f;
|
||||
float barValue = m_graph->selectedSeries()->dataProxy()->itemAt(selectedBar.x(),
|
||||
selectedBar.y()).value();
|
||||
float barValue = m_graph->selectedSeries()
|
||||
->dataProxy()
|
||||
->itemAt(selectedBar.x(), selectedBar.y())
|
||||
.value();
|
||||
float endAngleY = barValue >= 0.0f ? 30.0f : -30.0f;
|
||||
if (m_graph->valueAxis()->reversed())
|
||||
endAngleY *= -1.0f;
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
#ifndef GRAPHMODIFIER_H
|
||||
#define GRAPHMODIFIER_H
|
||||
|
||||
#include <QtGraphs/q3dbars.h>
|
||||
#include <QtGraphs/qbardataproxy.h>
|
||||
#include <QtGraphs/qabstract3dseries.h>
|
||||
#include <QtCore/qpropertyanimation.h>
|
||||
#include <QtGraphs/q3dbars.h>
|
||||
#include <QtGraphs/qabstract3dseries.h>
|
||||
#include <QtGraphs/qbardataproxy.h>
|
||||
|
||||
class RainfallData;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@ HighlightSeries::HighlightSeries()
|
|||
setVisible(false);
|
||||
}
|
||||
|
||||
HighlightSeries::~HighlightSeries()
|
||||
{
|
||||
}
|
||||
HighlightSeries::~HighlightSeries() {}
|
||||
|
||||
//! [0]
|
||||
void HighlightSeries::setTopographicSeries(TopographicSeries *series)
|
||||
|
|
@ -29,8 +27,10 @@ void HighlightSeries::setTopographicSeries(TopographicSeries *series)
|
|||
m_srcWidth = m_topographicSeries->dataProxy()->array().at(0).size();
|
||||
m_srcHeight = m_topographicSeries->dataProxy()->array().size();
|
||||
|
||||
QObject::connect(m_topographicSeries, &QSurface3DSeries::selectedPointChanged,
|
||||
this, &HighlightSeries::handlePositionChange);
|
||||
QObject::connect(m_topographicSeries,
|
||||
&QSurface3DSeries::selectedPointChanged,
|
||||
this,
|
||||
&HighlightSeries::handlePositionChange);
|
||||
}
|
||||
//! [0]
|
||||
|
||||
|
|
@ -48,13 +48,13 @@ void HighlightSeries::handlePositionChange(const QPoint &position)
|
|||
int halfHeight = m_height / 2;
|
||||
|
||||
int startX = position.x() - halfWidth;
|
||||
if (startX < 0 )
|
||||
if (startX < 0)
|
||||
startX = 0;
|
||||
int endX = position.x() + halfWidth;
|
||||
if (endX > (m_srcWidth - 1))
|
||||
endX = m_srcWidth - 1;
|
||||
int startZ = position.y() - halfHeight;
|
||||
if (startZ < 0 )
|
||||
if (startZ < 0)
|
||||
startZ = 0;
|
||||
int endZ = position.y() + halfHeight;
|
||||
if (endZ > (m_srcHeight - 1))
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
#include "surfacegraph.h"
|
||||
|
||||
#include <QtWidgets/qapplication.h>
|
||||
#include <QtWidgets/qwidget.h>
|
||||
#include <QtWidgets/qtabwidget.h>
|
||||
#include <QtWidgets/qwidget.h>
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include "rainfalldata.h"
|
||||
#include <QtGraphs/q3dscene.h>
|
||||
#include <QtGraphs/qbar3dseries.h>
|
||||
#include <QtGraphs/q3dtheme.h>
|
||||
#include <QtCore/qtextstream.h>
|
||||
#include <QtCore/qfile.h>
|
||||
#include <QtCore/qtextstream.h>
|
||||
#include <QtGraphs/q3dscene.h>
|
||||
#include <QtGraphs/q3dtheme.h>
|
||||
#include <QtGraphs/qbar3dseries.h>
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
|
|
@ -37,9 +37,18 @@ RainfallData::RainfallData()
|
|||
m_valueAxis->setAutoAdjustRange(true);
|
||||
|
||||
// Set axis labels and titles
|
||||
QStringList months{"January", "February", "March", "April",
|
||||
"May", "June", "July", "August", "September", "October",
|
||||
"November","December"};
|
||||
QStringList months{"January",
|
||||
"February",
|
||||
"March",
|
||||
"April",
|
||||
"May",
|
||||
"June",
|
||||
"July",
|
||||
"August",
|
||||
"September",
|
||||
"October",
|
||||
"November",
|
||||
"December"};
|
||||
m_rowAxis->setTitle("Year");
|
||||
m_colAxis->setTitle("Month");
|
||||
m_valueAxis->setTitle("rainfall (mm)");
|
||||
|
|
@ -72,7 +81,7 @@ void RainfallData::updateYearsList(int start, int end)
|
|||
void RainfallData::addDataSet()
|
||||
{
|
||||
// Create a new variant data set and data item list
|
||||
m_dataSet = new VariantDataSet;
|
||||
m_dataSet = new VariantDataSet;
|
||||
auto *itemList = new VariantDataItemList;
|
||||
|
||||
// Read data from a data file into the data item list
|
||||
|
|
|
|||
|
|
@ -2,32 +2,33 @@
|
|||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include "scatterdatamodifier.h"
|
||||
#include <QtGraphs/qscatterdataproxy.h>
|
||||
#include <QtGraphs/qvalue3daxis.h>
|
||||
#include <QtGraphs/q3dscene.h>
|
||||
#include <QtGraphs/qscatter3dseries.h>
|
||||
#include <QtGraphs/q3dtheme.h>
|
||||
#include <QtCore/qmath.h>
|
||||
#include <QtCore/qrandom.h>
|
||||
#include <QtGraphs/q3dscene.h>
|
||||
#include <QtGraphs/q3dtheme.h>
|
||||
#include <QtGraphs/qscatter3dseries.h>
|
||||
#include <QtGraphs/qscatterdataproxy.h>
|
||||
#include <QtGraphs/qvalue3daxis.h>
|
||||
#include <QtWidgets/qcombobox.h>
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
//#define RANDOM_SCATTER // Uncomment this to switch to random scatter
|
||||
// #define RANDOM_SCATTER // Uncomment this to switch to random scatter
|
||||
|
||||
const int numberOfItems = 10000;
|
||||
const float curveDivider = 7.5f;
|
||||
const int lowerNumberOfItems = 900;
|
||||
const float lowerCurveDivider = 0.75f;
|
||||
|
||||
ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter, QObject *parent) :
|
||||
QObject(parent),
|
||||
m_graph(scatter),
|
||||
m_itemCount(lowerNumberOfItems),
|
||||
m_curveDivider(lowerCurveDivider),
|
||||
//! [7]
|
||||
m_inputHandler(new AxesInputHandler(scatter))
|
||||
//! [7]
|
||||
ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_graph(scatter)
|
||||
, m_itemCount(lowerNumberOfItems)
|
||||
, m_curveDivider(lowerCurveDivider)
|
||||
,
|
||||
//! [7]
|
||||
m_inputHandler(new AxesInputHandler(scatter))
|
||||
//! [7]
|
||||
{
|
||||
//! [0]
|
||||
m_graph->activeTheme()->setType(Q3DTheme::Theme::StoneMoss);
|
||||
|
|
@ -59,9 +60,7 @@ ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter, QObject *parent) :
|
|||
//! [2]
|
||||
}
|
||||
|
||||
ScatterDataModifier::~ScatterDataModifier()
|
||||
{
|
||||
}
|
||||
ScatterDataModifier::~ScatterDataModifier() {}
|
||||
|
||||
void ScatterDataModifier::addData()
|
||||
{
|
||||
|
|
@ -128,7 +127,7 @@ void ScatterDataModifier::changePresetCamera()
|
|||
{
|
||||
static int preset = int(QAbstract3DGraph::CameraPreset::FrontLow);
|
||||
|
||||
m_graph->setCameraPreset((QAbstract3DGraph::CameraPreset)preset);
|
||||
m_graph->setCameraPreset((QAbstract3DGraph::CameraPreset) preset);
|
||||
|
||||
if (++preset > int(QAbstract3DGraph::CameraPreset::DirectlyBelow))
|
||||
preset = int(QAbstract3DGraph::CameraPreset::FrontLow);
|
||||
|
|
@ -148,12 +147,12 @@ void ScatterDataModifier::changeShadowQuality(int quality)
|
|||
|
||||
void ScatterDataModifier::setBackgroundEnabled(int enabled)
|
||||
{
|
||||
m_graph->activeTheme()->setBackgroundEnabled((bool)enabled);
|
||||
m_graph->activeTheme()->setBackgroundEnabled((bool) enabled);
|
||||
}
|
||||
|
||||
void ScatterDataModifier::setGridEnabled(int enabled)
|
||||
{
|
||||
m_graph->activeTheme()->setGridEnabled((bool)enabled);
|
||||
m_graph->activeTheme()->setGridEnabled((bool) enabled);
|
||||
}
|
||||
|
||||
void ScatterDataModifier::toggleItemCount()
|
||||
|
|
@ -210,7 +209,8 @@ QVector3D ScatterDataModifier::randVector()
|
|||
{
|
||||
auto *generator = QRandomGenerator::global();
|
||||
const auto x = float(generator->bounded(100)) / 2.0f - float(generator->bounded(100)) / 2.0f;
|
||||
const auto y = float(generator->bounded(100)) / 100.0f - float(generator->bounded(100)) / 100.0f;
|
||||
const auto y = float(generator->bounded(100)) / 100.0f
|
||||
- float(generator->bounded(100)) / 100.0f;
|
||||
const auto z = float(generator->bounded(100)) / 2.0f - float(generator->bounded(100)) / 2.0f;
|
||||
return {x, y, z};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
#include <QtWidgets/qboxlayout.h>
|
||||
#include <QtWidgets/qcheckbox.h>
|
||||
#include <QtWidgets/qcombobox.h>
|
||||
#include <QtWidgets/qlabel.h>
|
||||
#include <QtWidgets/qcommandlinkbutton.h>
|
||||
#include <QtWidgets/qlabel.h>
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
|
|
@ -75,10 +75,14 @@ void ScatterGraph::initialize()
|
|||
const QMetaObject &metaObj = QAbstract3DSeries::staticMetaObject;
|
||||
int index = metaObj.indexOfEnumerator("Mesh");
|
||||
QMetaEnum metaEnum = metaObj.enumerator(index);
|
||||
itemStyleList->addItem(u"Sphere"_s, metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Sphere)));
|
||||
itemStyleList->addItem(u"Cube"_s, metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Cube)));
|
||||
itemStyleList->addItem(u"Minimal"_s, metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Minimal)));
|
||||
itemStyleList->addItem(u"Point"_s, metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Point)));
|
||||
itemStyleList->addItem(u"Sphere"_s,
|
||||
metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Sphere)));
|
||||
itemStyleList->addItem(u"Cube"_s,
|
||||
metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Cube)));
|
||||
itemStyleList->addItem(u"Minimal"_s,
|
||||
metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Minimal)));
|
||||
itemStyleList->addItem(u"Point"_s,
|
||||
metaEnum.value(static_cast<int>(QAbstract3DSeries::Mesh::Point)));
|
||||
itemStyleList->setCurrentIndex(0);
|
||||
|
||||
auto *themeList = new QComboBox(m_scatterWidget);
|
||||
|
|
@ -122,40 +126,70 @@ void ScatterGraph::initialize()
|
|||
|
||||
m_modifier = new ScatterDataModifier(m_scatterGraph, this);
|
||||
|
||||
QObject::connect(cameraButton, &QCommandLinkButton::clicked, m_modifier,
|
||||
QObject::connect(cameraButton,
|
||||
&QCommandLinkButton::clicked,
|
||||
m_modifier,
|
||||
&ScatterDataModifier::changePresetCamera);
|
||||
QObject::connect(itemCountButton, &QCommandLinkButton::clicked, m_modifier,
|
||||
QObject::connect(itemCountButton,
|
||||
&QCommandLinkButton::clicked,
|
||||
m_modifier,
|
||||
&ScatterDataModifier::toggleItemCount);
|
||||
QObject::connect(rangeButton, &QCommandLinkButton::clicked, m_modifier,
|
||||
QObject::connect(rangeButton,
|
||||
&QCommandLinkButton::clicked,
|
||||
m_modifier,
|
||||
&ScatterDataModifier::toggleRanges);
|
||||
|
||||
QObject::connect(rangeMinSlider, &QSlider::valueChanged, m_modifier,
|
||||
QObject::connect(rangeMinSlider,
|
||||
&QSlider::valueChanged,
|
||||
m_modifier,
|
||||
&ScatterDataModifier::adjustMinimumRange);
|
||||
QObject::connect(rangeMaxSlider, &QSlider::valueChanged, m_modifier,
|
||||
QObject::connect(rangeMaxSlider,
|
||||
&QSlider::valueChanged,
|
||||
m_modifier,
|
||||
&ScatterDataModifier::adjustMaximumRange);
|
||||
|
||||
QObject::connect(backgroundCheckBox, &QCheckBox::stateChanged, m_modifier,
|
||||
QObject::connect(backgroundCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&ScatterDataModifier::setBackgroundEnabled);
|
||||
QObject::connect(gridCheckBox, &QCheckBox::stateChanged, m_modifier,
|
||||
QObject::connect(gridCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&ScatterDataModifier::setGridEnabled);
|
||||
QObject::connect(smoothCheckBox, &QCheckBox::stateChanged, m_modifier,
|
||||
QObject::connect(smoothCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&ScatterDataModifier::setSmoothDots);
|
||||
|
||||
QObject::connect(m_modifier, &ScatterDataModifier::backgroundEnabledChanged,
|
||||
backgroundCheckBox, &QCheckBox::setChecked);
|
||||
QObject::connect(m_modifier, &ScatterDataModifier::gridEnabledChanged,
|
||||
gridCheckBox, &QCheckBox::setChecked);
|
||||
QObject::connect(itemStyleList, &QComboBox::currentIndexChanged, m_modifier,
|
||||
QObject::connect(m_modifier,
|
||||
&ScatterDataModifier::backgroundEnabledChanged,
|
||||
backgroundCheckBox,
|
||||
&QCheckBox::setChecked);
|
||||
QObject::connect(m_modifier,
|
||||
&ScatterDataModifier::gridEnabledChanged,
|
||||
gridCheckBox,
|
||||
&QCheckBox::setChecked);
|
||||
QObject::connect(itemStyleList,
|
||||
&QComboBox::currentIndexChanged,
|
||||
m_modifier,
|
||||
&ScatterDataModifier::changeStyle);
|
||||
|
||||
QObject::connect(themeList, &QComboBox::currentIndexChanged, m_modifier,
|
||||
QObject::connect(themeList,
|
||||
&QComboBox::currentIndexChanged,
|
||||
m_modifier,
|
||||
&ScatterDataModifier::changeTheme);
|
||||
|
||||
QObject::connect(shadowQuality, &QComboBox::currentIndexChanged, m_modifier,
|
||||
QObject::connect(shadowQuality,
|
||||
&QComboBox::currentIndexChanged,
|
||||
m_modifier,
|
||||
&ScatterDataModifier::changeShadowQuality);
|
||||
|
||||
QObject::connect(m_modifier, &ScatterDataModifier::shadowQualityChanged, shadowQuality,
|
||||
QObject::connect(m_modifier,
|
||||
&ScatterDataModifier::shadowQualityChanged,
|
||||
shadowQuality,
|
||||
&QComboBox::setCurrentIndex);
|
||||
QObject::connect(m_scatterGraph, &Q3DScatter::shadowQualityChanged, m_modifier,
|
||||
QObject::connect(m_scatterGraph,
|
||||
&Q3DScatter::shadowQualityChanged,
|
||||
m_modifier,
|
||||
&ScatterDataModifier::shadowQualityUpdatedByVisual);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
|
||||
#include "surfacegraph.h"
|
||||
|
||||
#include <QtGui/qpainter.h>
|
||||
#include <QtWidgets/qboxlayout.h>
|
||||
#include <QtWidgets/qcheckbox.h>
|
||||
#include <QtWidgets/qcombobox.h>
|
||||
#include <QtWidgets/qradiobutton.h>
|
||||
#include <QtWidgets/qcommandlinkbutton.h>
|
||||
#include <QtWidgets/qgroupbox.h>
|
||||
#include <QtWidgets/qlabel.h>
|
||||
#include <QtWidgets/qcommandlinkbutton.h>
|
||||
#include <QtGui/qpainter.h>
|
||||
#include <QtWidgets/qradiobutton.h>
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
|
|
@ -267,71 +267,113 @@ void SurfaceGraph::initialize()
|
|||
m_modifier = new SurfaceGraphModifier(m_surfaceGraph, labelSelectedItem, this);
|
||||
|
||||
// Connect widget controls to controller
|
||||
QObject::connect(heightMapModelRB, &QRadioButton::toggled,
|
||||
m_modifier, &SurfaceGraphModifier::enableHeightMapModel);
|
||||
QObject::connect(sqrtSinModelRB, &QRadioButton::toggled,
|
||||
m_modifier, &SurfaceGraphModifier::enableSqrtSinModel);
|
||||
QObject::connect(texturedModelRB, &QRadioButton::toggled,
|
||||
m_modifier, &SurfaceGraphModifier::enableTopographyModel);
|
||||
QObject::connect(heightMapModelRB,
|
||||
&QRadioButton::toggled,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::enableHeightMapModel);
|
||||
QObject::connect(sqrtSinModelRB,
|
||||
&QRadioButton::toggled,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::enableSqrtSinModel);
|
||||
QObject::connect(texturedModelRB,
|
||||
&QRadioButton::toggled,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::enableTopographyModel);
|
||||
|
||||
QObject::connect(modeNoneRB, &QRadioButton::toggled,
|
||||
m_modifier, &SurfaceGraphModifier::toggleModeNone);
|
||||
QObject::connect(modeItemRB, &QRadioButton::toggled,
|
||||
m_modifier, &SurfaceGraphModifier::toggleModeItem);
|
||||
QObject::connect(modeSliceRowRB, &QRadioButton::toggled,
|
||||
m_modifier, &SurfaceGraphModifier::toggleModeSliceRow);
|
||||
QObject::connect(modeSliceColumnRB, &QRadioButton::toggled,
|
||||
m_modifier, &SurfaceGraphModifier::toggleModeSliceColumn);
|
||||
QObject::connect(modeNoneRB,
|
||||
&QRadioButton::toggled,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::toggleModeNone);
|
||||
QObject::connect(modeItemRB,
|
||||
&QRadioButton::toggled,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::toggleModeItem);
|
||||
QObject::connect(modeSliceRowRB,
|
||||
&QRadioButton::toggled,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::toggleModeSliceRow);
|
||||
QObject::connect(modeSliceColumnRB,
|
||||
&QRadioButton::toggled,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::toggleModeSliceColumn);
|
||||
|
||||
QObject::connect(axisMinSliderX, &QSlider::valueChanged,
|
||||
m_modifier, &SurfaceGraphModifier::adjustXMin);
|
||||
QObject::connect(axisMaxSliderX, &QSlider::valueChanged,
|
||||
m_modifier, &SurfaceGraphModifier::adjustXMax);
|
||||
QObject::connect(axisMinSliderZ, &QSlider::valueChanged,
|
||||
m_modifier, &SurfaceGraphModifier::adjustZMin);
|
||||
QObject::connect(axisMaxSliderZ, &QSlider::valueChanged,
|
||||
m_modifier, &SurfaceGraphModifier::adjustZMax);
|
||||
QObject::connect(axisMinSliderX,
|
||||
&QSlider::valueChanged,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::adjustXMin);
|
||||
QObject::connect(axisMaxSliderX,
|
||||
&QSlider::valueChanged,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::adjustXMax);
|
||||
QObject::connect(axisMinSliderZ,
|
||||
&QSlider::valueChanged,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::adjustZMin);
|
||||
QObject::connect(axisMaxSliderZ,
|
||||
&QSlider::valueChanged,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::adjustZMax);
|
||||
|
||||
// Mode dependent connections
|
||||
QObject::connect(gradientBtoYPB, &QPushButton::pressed,
|
||||
m_modifier, &SurfaceGraphModifier::setBlackToYellowGradient);
|
||||
QObject::connect(gradientGtoRPB, &QPushButton::pressed,
|
||||
m_modifier, &SurfaceGraphModifier::setGreenToRedGradient);
|
||||
QObject::connect(gradientBtoYPB,
|
||||
&QPushButton::pressed,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::setBlackToYellowGradient);
|
||||
QObject::connect(gradientGtoRPB,
|
||||
&QPushButton::pressed,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::setGreenToRedGradient);
|
||||
|
||||
QObject::connect(checkboxShowOilRigOne, &QCheckBox::stateChanged,
|
||||
m_modifier, &SurfaceGraphModifier::toggleItemOne);
|
||||
QObject::connect(checkboxShowOilRigTwo, &QCheckBox::stateChanged,
|
||||
m_modifier, &SurfaceGraphModifier::toggleItemTwo);
|
||||
QObject::connect(checkboxShowRefinery, &QCheckBox::stateChanged,
|
||||
m_modifier, &SurfaceGraphModifier::toggleItemThree);
|
||||
QObject::connect(checkboxShowOilRigOne,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::toggleItemOne);
|
||||
QObject::connect(checkboxShowOilRigTwo,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::toggleItemTwo);
|
||||
QObject::connect(checkboxShowRefinery,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::toggleItemThree);
|
||||
|
||||
QObject::connect(checkboxVisualsSeeThrough, &QCheckBox::stateChanged,
|
||||
m_modifier, &SurfaceGraphModifier::toggleSeeThrough);
|
||||
QObject::connect(checkboxHighlightOil, &QCheckBox::stateChanged,
|
||||
m_modifier, &SurfaceGraphModifier::toggleOilHighlight);
|
||||
QObject::connect(checkboxShowShadows, &QCheckBox::stateChanged,
|
||||
m_modifier, &SurfaceGraphModifier::toggleShadows);
|
||||
QObject::connect(checkboxVisualsSeeThrough,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::toggleSeeThrough);
|
||||
QObject::connect(checkboxHighlightOil,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::toggleOilHighlight);
|
||||
QObject::connect(checkboxShowShadows,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::toggleShadows);
|
||||
|
||||
QObject::connect(enableTexture, &QCheckBox::stateChanged,
|
||||
m_modifier, &SurfaceGraphModifier::toggleSurfaceTexture);
|
||||
QObject::connect(enableTexture,
|
||||
&QCheckBox::stateChanged,
|
||||
m_modifier,
|
||||
&SurfaceGraphModifier::toggleSurfaceTexture);
|
||||
|
||||
// Connections to disable features depending on mode
|
||||
QObject::connect(sqrtSinModelRB, &QRadioButton::toggled,
|
||||
colorGroupBox, &QGroupBox::setVisible);
|
||||
QObject::connect(sqrtSinModelRB, &QRadioButton::toggled, colorGroupBox, &QGroupBox::setVisible);
|
||||
|
||||
QObject::connect(heightMapModelRB, &QRadioButton::toggled,
|
||||
showGroupBox, &QGroupBox::setVisible);
|
||||
QObject::connect(heightMapModelRB, &QRadioButton::toggled,
|
||||
visualsGroupBox, &QGroupBox::setVisible);
|
||||
QObject::connect(heightMapModelRB, &QRadioButton::toggled,
|
||||
labelSelection, &QLabel::setVisible);
|
||||
QObject::connect(heightMapModelRB, &QRadioButton::toggled,
|
||||
labelSelectedItem, &QLabel::setVisible);
|
||||
QObject::connect(heightMapModelRB, &QRadioButton::toggled, showGroupBox, &QGroupBox::setVisible);
|
||||
QObject::connect(heightMapModelRB,
|
||||
&QRadioButton::toggled,
|
||||
visualsGroupBox,
|
||||
&QGroupBox::setVisible);
|
||||
QObject::connect(heightMapModelRB, &QRadioButton::toggled, labelSelection, &QLabel::setVisible);
|
||||
QObject::connect(heightMapModelRB,
|
||||
&QRadioButton::toggled,
|
||||
labelSelectedItem,
|
||||
&QLabel::setVisible);
|
||||
|
||||
QObject::connect(texturedModelRB, &QRadioButton::toggled,
|
||||
enableTexture, &QLabel::setVisible);
|
||||
QObject::connect(texturedModelRB, &QRadioButton::toggled,
|
||||
heightMapGroupBox, &QGroupBox::setVisible);
|
||||
QObject::connect(texturedModelRB, &QRadioButton::toggled, enableTexture, &QLabel::setVisible);
|
||||
QObject::connect(texturedModelRB,
|
||||
&QRadioButton::toggled,
|
||||
heightMapGroupBox,
|
||||
&QGroupBox::setVisible);
|
||||
|
||||
m_modifier->setAxisMinSliderX(axisMinSliderX);
|
||||
m_modifier->setAxisMaxSliderX(axisMaxSliderX);
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include "surfacegraphmodifier.h"
|
||||
#include "custominputhandler.h"
|
||||
#include "highlightseries.h"
|
||||
#include "topographicseries.h"
|
||||
#include "custominputhandler.h"
|
||||
|
||||
#include <QtGraphs/qvalue3daxis.h>
|
||||
#include <QtGraphs/q3dtheme.h>
|
||||
#include <QtGui/qimage.h>
|
||||
#include <QtCore/qmath.h>
|
||||
#include <QtGraphs/q3dtheme.h>
|
||||
#include <QtGraphs/qvalue3daxis.h>
|
||||
#include <QtGui/qimage.h>
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
|
|
@ -25,10 +25,10 @@ const float areaHeight = 8000.f;
|
|||
const float aspectRatio = 0.1389f;
|
||||
const float minRange = areaWidth * 0.49f;
|
||||
|
||||
SurfaceGraphModifier::SurfaceGraphModifier(Q3DSurface *surface, QLabel *label, QObject *parent) :
|
||||
QObject(parent),
|
||||
m_graph(surface),
|
||||
m_textField(label)
|
||||
SurfaceGraphModifier::SurfaceGraphModifier(Q3DSurface *surface, QLabel *label, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_graph(surface)
|
||||
, m_textField(label)
|
||||
{
|
||||
m_graph->setCameraZoomLevel(85.f);
|
||||
m_graph->setCameraPreset(QAbstract3DGraph::CameraPreset::IsometricRight);
|
||||
|
|
@ -99,8 +99,10 @@ SurfaceGraphModifier::SurfaceGraphModifier(Q3DSurface *surface, QLabel *label, Q
|
|||
m_heightMapSeriesThree->setColorStyle(Q3DTheme::ColorStyle::RangeGradient);
|
||||
|
||||
// Custom items and label
|
||||
connect(m_graph, &QAbstract3DGraph::selectedElementChanged,
|
||||
this, &SurfaceGraphModifier::handleElementSelected);
|
||||
connect(m_graph,
|
||||
&QAbstract3DGraph::selectedElementChanged,
|
||||
this,
|
||||
&SurfaceGraphModifier::handleElementSelected);
|
||||
|
||||
m_selectionAnimation = new QPropertyAnimation(this);
|
||||
m_selectionAnimation->setPropertyName("scaling");
|
||||
|
|
@ -109,7 +111,8 @@ SurfaceGraphModifier::SurfaceGraphModifier(Q3DSurface *surface, QLabel *label, Q
|
|||
|
||||
QFont titleFont = QFont("Century Gothic", 30);
|
||||
titleFont.setBold(true);
|
||||
m_titleLabel = new QCustom3DLabel("Oil Rigs on Imaginary Sea", titleFont,
|
||||
m_titleLabel = new QCustom3DLabel("Oil Rigs on Imaginary Sea",
|
||||
titleFont,
|
||||
QVector3D(0.f, 1.2f, 0.f),
|
||||
QVector3D(1.f, 1.f, 0.f),
|
||||
QQuaternion());
|
||||
|
|
@ -135,8 +138,10 @@ SurfaceGraphModifier::SurfaceGraphModifier(Q3DSurface *surface, QLabel *label, Q
|
|||
m_highlight->setMinHeight(minRange * aspectRatio);
|
||||
m_highlight->handleGradientChange(areaWidth * aspectRatio);
|
||||
//! [16]
|
||||
QObject::connect(m_graph->axisY(), &QValue3DAxis::maxChanged,
|
||||
m_highlight, &HighlightSeries::handleGradientChange);
|
||||
QObject::connect(m_graph->axisY(),
|
||||
&QValue3DAxis::maxChanged,
|
||||
m_highlight,
|
||||
&HighlightSeries::handleGradientChange);
|
||||
//! [16]
|
||||
|
||||
m_customInputHandler = new CustomInputHandler(m_graph);
|
||||
|
|
@ -146,9 +151,7 @@ SurfaceGraphModifier::SurfaceGraphModifier(Q3DSurface *surface, QLabel *label, Q
|
|||
m_customInputHandler->setAspectRatio(aspectRatio);
|
||||
}
|
||||
|
||||
SurfaceGraphModifier::~SurfaceGraphModifier()
|
||||
{
|
||||
}
|
||||
SurfaceGraphModifier::~SurfaceGraphModifier() {}
|
||||
|
||||
void SurfaceGraphModifier::fillSqrtSinProxy()
|
||||
{
|
||||
|
|
@ -158,11 +161,11 @@ void SurfaceGraphModifier::fillSqrtSinProxy()
|
|||
//! [1]
|
||||
QSurfaceDataArray dataArray;
|
||||
dataArray.reserve(sampleCountZ);
|
||||
for (int i = 0 ; i < sampleCountZ ; ++i) {
|
||||
for (int i = 0; i < sampleCountZ; ++i) {
|
||||
QSurfaceDataRow newRow;
|
||||
newRow.reserve(sampleCountX);
|
||||
// Keep values within range bounds, since just adding step can cause minor drift due
|
||||
// to the rounding errors.
|
||||
// Keep values within range bounds, since just adding step can cause minor
|
||||
// drift due to the rounding errors.
|
||||
float z = qMin(sampleMax, (i * stepZ + sampleMin));
|
||||
for (int j = 0; j < sampleCountX; ++j) {
|
||||
float x = qMin(sampleMax, (j * stepX + sampleMin));
|
||||
|
|
@ -452,15 +455,17 @@ void SurfaceGraphModifier::toggleItemOne(bool show)
|
|||
color.fill(Qt::red);
|
||||
//! [9]
|
||||
//! [11]
|
||||
auto *item = new QCustom3DItem(":/data/oilrig.mesh", positionOne,
|
||||
QVector3D(0.025f, 0.025f, 0.025f),
|
||||
QQuaternion::fromAxisAndAngle(0.f, 1.f, 0.f, 45.f),
|
||||
color);
|
||||
auto *item = new QCustom3DItem(":/data/oilrig.mesh",
|
||||
positionOne,
|
||||
QVector3D(0.025f, 0.025f, 0.025f),
|
||||
QQuaternion::fromAxisAndAngle(0.f, 1.f, 0.f, 45.f),
|
||||
color);
|
||||
//! [11]
|
||||
//! [12]
|
||||
m_graph->addCustomItem(item);
|
||||
//! [12]
|
||||
item = new QCustom3DItem(":/data/pipe.mesh", positionOnePipe,
|
||||
item = new QCustom3DItem(":/data/pipe.mesh",
|
||||
positionOnePipe,
|
||||
QVector3D(0.005f, 0.5f, 0.005f),
|
||||
QQuaternion(),
|
||||
color);
|
||||
|
|
@ -499,7 +504,8 @@ void SurfaceGraphModifier::toggleItemTwo(bool show)
|
|||
item->setRotation(QQuaternion::fromAxisAndAngle(0.f, 1.f, 0.f, 25.f));
|
||||
item->setTextureImage(color);
|
||||
m_graph->addCustomItem(item);
|
||||
item = new QCustom3DItem(":/data/pipe.mesh", positionTwoPipe,
|
||||
item = new QCustom3DItem(":/data/pipe.mesh",
|
||||
positionTwoPipe,
|
||||
QVector3D(0.005f, 0.5f, 0.005f),
|
||||
QQuaternion(),
|
||||
color);
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@
|
|||
#ifndef SURFACEGRAPHMODIFIER_H
|
||||
#define SURFACEGRAPHMODIFIER_H
|
||||
|
||||
#include <QtCore/qpropertyanimation.h>
|
||||
#include <QtGraphs/q3dinputhandler.h>
|
||||
#include <QtGraphs/q3dsurface.h>
|
||||
#include <QtGraphs/qsurfacedataproxy.h>
|
||||
#include <QtGraphs/qheightmapsurfacedataproxy.h>
|
||||
#include <QtGraphs/qsurface3dseries.h>
|
||||
#include <QtGraphs/qcustom3ditem.h>
|
||||
#include <QtGraphs/qcustom3dlabel.h>
|
||||
#include <QtGraphs/q3dinputhandler.h>
|
||||
#include <QtWidgets/qslider.h>
|
||||
#include <QtGraphs/qheightmapsurfacedataproxy.h>
|
||||
#include <QtGraphs/qsurface3dseries.h>
|
||||
#include <QtGraphs/qsurfacedataproxy.h>
|
||||
#include <QtWidgets/qlabel.h>
|
||||
#include <QtCore/qpropertyanimation.h>
|
||||
#include <QtWidgets/qslider.h>
|
||||
|
||||
class TopographicSeries;
|
||||
class HighlightSeries;
|
||||
|
|
@ -29,12 +29,18 @@ public:
|
|||
//! [0]
|
||||
void toggleModeNone() { m_graph->setSelectionMode(QAbstract3DGraph::SelectionNone); }
|
||||
void toggleModeItem() { m_graph->setSelectionMode(QAbstract3DGraph::SelectionItem); }
|
||||
void toggleModeSliceRow() { m_graph->setSelectionMode(QAbstract3DGraph::SelectionItemAndRow
|
||||
| QAbstract3DGraph::SelectionSlice
|
||||
| QAbstract3DGraph::SelectionMultiSeries); }
|
||||
void toggleModeSliceColumn() { m_graph->setSelectionMode(QAbstract3DGraph::SelectionItemAndColumn
|
||||
| QAbstract3DGraph::SelectionSlice
|
||||
| QAbstract3DGraph::SelectionMultiSeries); }
|
||||
void toggleModeSliceRow()
|
||||
{
|
||||
m_graph->setSelectionMode(QAbstract3DGraph::SelectionItemAndRow
|
||||
| QAbstract3DGraph::SelectionSlice
|
||||
| QAbstract3DGraph::SelectionMultiSeries);
|
||||
}
|
||||
void toggleModeSliceColumn()
|
||||
{
|
||||
m_graph->setSelectionMode(QAbstract3DGraph::SelectionItemAndColumn
|
||||
| QAbstract3DGraph::SelectionSlice
|
||||
| QAbstract3DGraph::SelectionMultiSeries);
|
||||
}
|
||||
//! [0]
|
||||
|
||||
void setBlackToYellowGradient();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@
|
|||
|
||||
#include "variantbardatamapping.h"
|
||||
|
||||
VariantBarDataMapping::VariantBarDataMapping(int rowIndex, int columnIndex, int valueIndex,
|
||||
VariantBarDataMapping::VariantBarDataMapping(int rowIndex,
|
||||
int columnIndex,
|
||||
int valueIndex,
|
||||
const QStringList &rowCategories,
|
||||
const QStringList &columnCategories)
|
||||
: QObject(nullptr)
|
||||
|
|
@ -72,7 +74,9 @@ const QStringList &VariantBarDataMapping::columnCategories() const
|
|||
return m_columnCategories;
|
||||
}
|
||||
|
||||
void VariantBarDataMapping::remap(int rowIndex, int columnIndex, int valueIndex,
|
||||
void VariantBarDataMapping::remap(int rowIndex,
|
||||
int columnIndex,
|
||||
int valueIndex,
|
||||
const QStringList &rowCategories,
|
||||
const QStringList &columnCategories)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,12 +14,16 @@ class VariantBarDataMapping : public QObject
|
|||
Q_PROPERTY(int rowIndex READ rowIndex WRITE setRowIndex NOTIFY rowIndexChanged)
|
||||
Q_PROPERTY(int columnIndex READ columnIndex WRITE setColumnIndex NOTIFY columnIndexChanged)
|
||||
Q_PROPERTY(int valueIndex READ valueIndex WRITE setValueIndex NOTIFY valueIndexChanged)
|
||||
Q_PROPERTY(QStringList rowCategories READ rowCategories WRITE setRowCategories NOTIFY rowCategoriesChanged)
|
||||
Q_PROPERTY(QStringList columnCategories READ columnCategories WRITE setColumnCategories NOTIFY columnCategoriesChanged)
|
||||
Q_PROPERTY(QStringList rowCategories READ rowCategories WRITE setRowCategories NOTIFY
|
||||
rowCategoriesChanged)
|
||||
Q_PROPERTY(QStringList columnCategories READ columnCategories WRITE setColumnCategories NOTIFY
|
||||
columnCategoriesChanged)
|
||||
//! [0]
|
||||
public:
|
||||
//! [1]
|
||||
explicit VariantBarDataMapping(int rowIndex, int columnIndex, int valueIndex,
|
||||
explicit VariantBarDataMapping(int rowIndex,
|
||||
int columnIndex,
|
||||
int valueIndex,
|
||||
const QStringList &rowCategories,
|
||||
const QStringList &columnCategories);
|
||||
//! [1]
|
||||
|
|
@ -38,7 +42,9 @@ public:
|
|||
const QStringList &columnCategories() const;
|
||||
|
||||
//! [2]
|
||||
void remap(int rowIndex, int columnIndex, int valueIndex,
|
||||
void remap(int rowIndex,
|
||||
int columnIndex,
|
||||
int valueIndex,
|
||||
const QStringList &rowCategories,
|
||||
const QStringList &columnCategories);
|
||||
//! [2]
|
||||
|
|
@ -58,7 +64,8 @@ private:
|
|||
int m_columnIndex = 1;
|
||||
int m_valueIndex = 2;
|
||||
|
||||
// For row/column items, sort items into these categories. Other categories are ignored.
|
||||
// For row/column items, sort items into these categories. Other categories
|
||||
// are ignored.
|
||||
QStringList m_rowCategories = {};
|
||||
QStringList m_columnCategories = {};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,9 +18,13 @@ void VariantBarDataProxy::setDataSet(VariantDataSet *newSet)
|
|||
m_dataSet = newSet;
|
||||
|
||||
if (!m_dataSet.isNull()) {
|
||||
QObject::connect(m_dataSet.data(), &VariantDataSet::itemsAdded, this,
|
||||
QObject::connect(m_dataSet.data(),
|
||||
&VariantDataSet::itemsAdded,
|
||||
this,
|
||||
&VariantBarDataProxy::handleItemsAdded);
|
||||
QObject::connect(m_dataSet.data(), &VariantDataSet::dataCleared, this,
|
||||
QObject::connect(m_dataSet.data(),
|
||||
&VariantDataSet::dataCleared,
|
||||
this,
|
||||
&VariantBarDataProxy::handleDataCleared);
|
||||
}
|
||||
resolveDataSet();
|
||||
|
|
@ -34,14 +38,18 @@ VariantDataSet *VariantBarDataProxy::dataSet()
|
|||
void VariantBarDataProxy::setMapping(VariantBarDataMapping *mapping)
|
||||
{
|
||||
if (!m_mapping.isNull()) {
|
||||
QObject::disconnect(m_mapping.data(), &VariantBarDataMapping::mappingChanged, this,
|
||||
QObject::disconnect(m_mapping.data(),
|
||||
&VariantBarDataMapping::mappingChanged,
|
||||
this,
|
||||
&VariantBarDataProxy::handleMappingChanged);
|
||||
}
|
||||
|
||||
m_mapping = mapping;
|
||||
|
||||
if (!m_mapping.isNull()) {
|
||||
QObject::connect(m_mapping.data(), &VariantBarDataMapping::mappingChanged, this,
|
||||
QObject::connect(m_mapping.data(),
|
||||
&VariantBarDataMapping::mappingChanged,
|
||||
this,
|
||||
&VariantBarDataProxy::handleMappingChanged);
|
||||
}
|
||||
|
||||
|
|
@ -77,9 +85,10 @@ void VariantBarDataProxy::handleMappingChanged()
|
|||
//! [0]
|
||||
void VariantBarDataProxy::resolveDataSet()
|
||||
{
|
||||
// If we have no data or mapping, or the categories are not defined, simply clear the array
|
||||
// If we have no data or mapping, or the categories are not defined, simply
|
||||
// clear the array
|
||||
if (m_dataSet.isNull() || m_mapping.isNull() || !m_mapping->rowCategories().size()
|
||||
|| !m_mapping->columnCategories().size()) {
|
||||
|| !m_mapping->columnCategories().size()) {
|
||||
resetArray();
|
||||
return;
|
||||
}
|
||||
|
|
@ -93,10 +102,10 @@ void VariantBarDataProxy::resolveDataSet()
|
|||
|
||||
// Sort values into rows and columns
|
||||
using ColumnValueMap = QHash<QString, float>;
|
||||
QHash <QString, ColumnValueMap> itemValueMap;
|
||||
QHash<QString, ColumnValueMap> itemValueMap;
|
||||
for (const VariantDataItem *item : itemList) {
|
||||
itemValueMap[item->at(rowIndex).toString()][item->at(columnIndex).toString()]
|
||||
= item->at(valueIndex).toReal();
|
||||
= item->at(valueIndex).toReal();
|
||||
}
|
||||
|
||||
// Create a new data array in format the parent class understands
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
#ifndef VARIANTBARDATAPROXY_H
|
||||
#define VARIANTBARDATAPROXY_H
|
||||
|
||||
#include "variantdataset.h"
|
||||
#include "variantbardatamapping.h"
|
||||
#include <QtGraphs/qbardataproxy.h>
|
||||
#include <QtCore/qpointer.h>
|
||||
#include <QtGraphs/qbardataproxy.h>
|
||||
#include "variantbardatamapping.h"
|
||||
#include "variantdataset.h"
|
||||
|
||||
//! [0]
|
||||
class VariantBarDataProxy : public QBarDataProxy
|
||||
|
|
@ -20,13 +20,15 @@ public:
|
|||
virtual ~VariantBarDataProxy();
|
||||
|
||||
//! [1]
|
||||
// Doesn't gain ownership of the dataset, but does connect to it to listen for data changes.
|
||||
// Doesn't gain ownership of the dataset, but does connect to it to listen for
|
||||
// data changes.
|
||||
void setDataSet(VariantDataSet *newSet);
|
||||
VariantDataSet *dataSet();
|
||||
|
||||
// Map key (row, column, value) to value index in data item (VariantItem).
|
||||
// Doesn't gain ownership of mapping, but does connect to it to listen for mapping changes.
|
||||
// Modifying mapping that is set to proxy will trigger dataset re-resolving.
|
||||
// Doesn't gain ownership of mapping, but does connect to it to listen for
|
||||
// mapping changes. Modifying mapping that is set to proxy will trigger
|
||||
// dataset re-resolving.
|
||||
void setMapping(VariantBarDataMapping *mapping);
|
||||
VariantBarDataMapping *mapping();
|
||||
//! [1]
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ void VariantDataSet::clear()
|
|||
int VariantDataSet::addItem(VariantDataItem *item)
|
||||
{
|
||||
m_variantData.append(item);
|
||||
int addIndex = m_variantData.size();
|
||||
int addIndex = m_variantData.size();
|
||||
|
||||
emit itemsAdded(addIndex, 1);
|
||||
return addIndex;
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@
|
|||
|
||||
#include "volumetric.h"
|
||||
|
||||
#include <QtGui/qscreen.h>
|
||||
#include <QtWidgets/qapplication.h>
|
||||
#include <QtWidgets/qwidget.h>
|
||||
#include <QtWidgets/qboxlayout.h>
|
||||
#include <QtWidgets/qcheckbox.h>
|
||||
#include <QtWidgets/qgroupbox.h>
|
||||
#include <QtWidgets/qlabel.h>
|
||||
#include <QtWidgets/qmessagebox.h>
|
||||
#include <QtWidgets/qradiobutton.h>
|
||||
#include <QtWidgets/qslider.h>
|
||||
#include <QtWidgets/qcheckbox.h>
|
||||
#include <QtWidgets/qlabel.h>
|
||||
#include <QtWidgets/qgroupbox.h>
|
||||
#include <QtWidgets/qmessagebox.h>
|
||||
#include <QtGui/qscreen.h>
|
||||
#include <QtWidgets/qwidget.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
|
@ -152,9 +152,9 @@ int main(int argc, char **argv)
|
|||
usePerspectiveCamera->setText(QStringLiteral("Use perspective camera"));
|
||||
usePerspectiveCamera->setChecked(false);
|
||||
|
||||
QLabel *performanceNoteLabel =
|
||||
new QLabel(QStringLiteral(
|
||||
"Note: A high end graphics card is\nrecommended with the HD shader\nwhen the volume contains a lot of\ntransparent areas."));
|
||||
QLabel *performanceNoteLabel = new QLabel(
|
||||
QStringLiteral("Note: A high end graphics card is\nrecommended with the HD shader\nwhen "
|
||||
"the volume contains a lot of\ntransparent areas."));
|
||||
performanceNoteLabel->setFrameShape(QFrame::Box);
|
||||
|
||||
QCheckBox *drawSliceFramesCheckBox = new QCheckBox(widget);
|
||||
|
|
@ -193,45 +193,85 @@ int main(int argc, char **argv)
|
|||
modifier->setAlphaMultiplierLabel(alphaMultiplierLabel);
|
||||
modifier->setTransparentGround(transparentGroundCheckBox->isChecked());
|
||||
|
||||
QObject::connect(fpsCheckBox, &QCheckBox::stateChanged, modifier,
|
||||
QObject::connect(fpsCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
modifier,
|
||||
&VolumetricModifier::setFpsMeasurement);
|
||||
QObject::connect(sliceXCheckBox, &QCheckBox::stateChanged, modifier,
|
||||
QObject::connect(sliceXCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
modifier,
|
||||
&VolumetricModifier::sliceX);
|
||||
QObject::connect(sliceYCheckBox, &QCheckBox::stateChanged, modifier,
|
||||
QObject::connect(sliceYCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
modifier,
|
||||
&VolumetricModifier::sliceY);
|
||||
QObject::connect(sliceZCheckBox, &QCheckBox::stateChanged, modifier,
|
||||
QObject::connect(sliceZCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
modifier,
|
||||
&VolumetricModifier::sliceZ);
|
||||
QObject::connect(sliceXSlider, &QSlider::valueChanged, modifier,
|
||||
QObject::connect(sliceXSlider,
|
||||
&QSlider::valueChanged,
|
||||
modifier,
|
||||
&VolumetricModifier::adjustSliceX);
|
||||
QObject::connect(sliceYSlider, &QSlider::valueChanged, modifier,
|
||||
QObject::connect(sliceYSlider,
|
||||
&QSlider::valueChanged,
|
||||
modifier,
|
||||
&VolumetricModifier::adjustSliceY);
|
||||
QObject::connect(sliceZSlider, &QSlider::valueChanged, modifier,
|
||||
QObject::connect(sliceZSlider,
|
||||
&QSlider::valueChanged,
|
||||
modifier,
|
||||
&VolumetricModifier::adjustSliceZ);
|
||||
QObject::connect(lowDetailRB, &QRadioButton::toggled, modifier,
|
||||
QObject::connect(lowDetailRB,
|
||||
&QRadioButton::toggled,
|
||||
modifier,
|
||||
&VolumetricModifier::toggleLowDetail);
|
||||
QObject::connect(mediumDetailRB, &QRadioButton::toggled, modifier,
|
||||
QObject::connect(mediumDetailRB,
|
||||
&QRadioButton::toggled,
|
||||
modifier,
|
||||
&VolumetricModifier::toggleMediumDetail);
|
||||
QObject::connect(highDetailRB, &QRadioButton::toggled, modifier,
|
||||
QObject::connect(highDetailRB,
|
||||
&QRadioButton::toggled,
|
||||
modifier,
|
||||
&VolumetricModifier::toggleHighDetail);
|
||||
QObject::connect(colorTableCheckBox, &QCheckBox::stateChanged, modifier,
|
||||
QObject::connect(colorTableCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
modifier,
|
||||
&VolumetricModifier::changeColorTable);
|
||||
QObject::connect(preserveOpacityCheckBox, &QCheckBox::stateChanged, modifier,
|
||||
QObject::connect(preserveOpacityCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
modifier,
|
||||
&VolumetricModifier::setPreserveOpacity);
|
||||
QObject::connect(transparentGroundCheckBox, &QCheckBox::stateChanged, modifier,
|
||||
QObject::connect(transparentGroundCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
modifier,
|
||||
&VolumetricModifier::setTransparentGround);
|
||||
QObject::connect(useHighDefShaderCheckBox, &QCheckBox::stateChanged, modifier,
|
||||
QObject::connect(useHighDefShaderCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
modifier,
|
||||
&VolumetricModifier::setUseHighDefShader);
|
||||
QObject::connect(usePerspectiveCamera, &QCheckBox::stateChanged, modifier,
|
||||
QObject::connect(usePerspectiveCamera,
|
||||
&QCheckBox::stateChanged,
|
||||
modifier,
|
||||
&VolumetricModifier::setUsePerspectiveCamera);
|
||||
QObject::connect(alphaMultiplierSlider, &QSlider::valueChanged, modifier,
|
||||
QObject::connect(alphaMultiplierSlider,
|
||||
&QSlider::valueChanged,
|
||||
modifier,
|
||||
&VolumetricModifier::adjustAlphaMultiplier);
|
||||
QObject::connect(areaAllRB, &QRadioButton::toggled, modifier,
|
||||
QObject::connect(areaAllRB,
|
||||
&QRadioButton::toggled,
|
||||
modifier,
|
||||
&VolumetricModifier::toggleAreaAll);
|
||||
QObject::connect(areaMineRB, &QRadioButton::toggled, modifier,
|
||||
QObject::connect(areaMineRB,
|
||||
&QRadioButton::toggled,
|
||||
modifier,
|
||||
&VolumetricModifier::toggleAreaMine);
|
||||
QObject::connect(areaMountainRB, &QRadioButton::toggled, modifier,
|
||||
QObject::connect(areaMountainRB,
|
||||
&QRadioButton::toggled,
|
||||
modifier,
|
||||
&VolumetricModifier::toggleAreaMountain);
|
||||
QObject::connect(drawSliceFramesCheckBox, &QCheckBox::stateChanged, modifier,
|
||||
QObject::connect(drawSliceFramesCheckBox,
|
||||
&QCheckBox::stateChanged,
|
||||
modifier,
|
||||
&VolumetricModifier::setDrawSliceFrames);
|
||||
|
||||
widget->show();
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@
|
|||
#ifndef VOLUMETRICMODIFIER_H
|
||||
#define VOLUMETRICMODIFIER_H
|
||||
|
||||
#include <QtCore/qtimer.h>
|
||||
#include <QtGraphs/q3dscatter.h>
|
||||
#include <QtGraphs/qcustom3dvolume.h>
|
||||
#include <QtCore/qtimer.h>
|
||||
#include <QtGui/qrgb.h>
|
||||
#include <QtWidgets/qlabel.h>
|
||||
#include <QtWidgets/qslider.h>
|
||||
#include <QtWidgets/qradiobutton.h>
|
||||
#include <QtWidgets/qslider.h>
|
||||
|
||||
class VolumetricModifier : public QObject
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue