diff options
Diffstat (limited to 'examples/widget')
-rw-r--r-- | examples/widget/chart.cpp | 289 | ||||
-rw-r--r-- | examples/widget/chart.h | 94 | ||||
-rw-r--r-- | examples/widget/main.cpp | 248 | ||||
-rw-r--r-- | examples/widget/widget.pro | 7 |
4 files changed, 638 insertions, 0 deletions
diff --git a/examples/widget/chart.cpp b/examples/widget/chart.cpp new file mode 100644 index 00000000..012e287d --- /dev/null +++ b/examples/widget/chart.cpp @@ -0,0 +1,289 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of QtDataVis3D module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "chart.h" + +using namespace QtDataVis3D; + +const QString celsiusString = QString(QChar(0xB0)) + "C"; + +ChartModifier::ChartModifier(Q3DBars *barchart) + : m_chart(barchart), + m_columnCount(21), + m_rowCount(21), + m_xRotation(0.0f), + m_yRotation(0.0f), + m_static(true), + m_barWidth(1.0f), + m_barDepth(1.0f), + m_barSpacingX(0.1f), + m_barSpacingZ(0.1f), + m_fontSize(20) +{ + // Don't set any styles or specifications, start from defaults +} + +ChartModifier::~ChartModifier() +{ + delete m_chart; +} + +void ChartModifier::start() +{ + if (m_static) + addDataSet(); +} + +void ChartModifier::restart(bool dynamicData) +{ + m_static = !dynamicData; + + if (m_static) { + start(); + // Set selection mode to zoom row + m_chart->setSelectionMode(ModeZoomRow); + m_chart->setFont(QFont("Times Roman", 20)); + } else { + // Set up sample space; make it as deep as it's wide + m_chart->setupSampleSpace(m_columnCount, m_rowCount); + // Set selection mode to full + m_chart->setSelectionMode(ModeBarRowAndColumn); + } +} + +void ChartModifier::addDataSet() +{ + // Prepare data to be visualized + // Use QDataSet adder + + // Set window title + m_chart->setWindowTitle(QStringLiteral("Average temperatures in Oulu, Finland (2006-2012)")); + + // Set up row and column names + QVector<QString> months; + months << "January" << "February" << "March" << "April" << "May" << "June" << "July" << "August" << "September" << "October" << "November" << "December"; + QVector<QString> years; + years << "2006" << "2007" << "2008" << "2009" << "2010" << "2011" << "2012"; + + // Set up data + float temp[7][12] = {{-6.7f, -11.7f, -9.7f, 3.3f, 9.2f, 14.0f, 16.3f, 17.8f, 10.2f, 2.1f, -2.6f, -0.3f}, // 2006 + {-6.8f, -13.3f, 0.2f, 1.5f, 7.9f, 13.4f, 16.1f, 15.5f, 8.2f, 5.4f, -2.6f, -0.8f}, // 2007 + {-4.2f, -4.0f, -4.6f, 1.9f, 7.3f, 12.5f, 15.0f, 12.8f, 7.6f, 5.1f, -0.9f, -1.3f}, // 2008 + {-7.8f, -8.8f, -4.2f, 0.7f, 9.3f, 13.2f, 15.8f, 15.5f, 11.2f, 0.6f, 0.7f, -8.4f}, // 2009 + {-14.4f, -12.1f, -7.0f, 2.3f, 11.0f, 12.6f, 18.8f, 13.8f, 9.4f, 3.9f, -5.6f, -13.0f}, // 2010 + {-9.0f, -15.2f, -3.8f, 2.6f, 8.3f, 15.9f, 18.6f, 14.9f, 11.1f, 5.3f, 1.8f, -0.2f}, // 2011 + {-8.7f, -11.3f, -2.3f, 0.4f, 7.5f, 12.2f, 16.4f, 14.1f, 9.2f, 3.1f, 0.3f, -12.1f}}; // 2012 + + // Create data set + QDataSet *dataSet = new QDataSet(); + + // Add labels + dataSet->setLabels("Year", "Month", "Average temperature (" + celsiusString + ")", + years, months); + + // Create data rows + QDataRow *dataRow; + for (int year = 0; year < years.size(); year++) { + dataRow = new QDataRow(years.at(year)); + // Create data items + for (int month = 0; month < months.size(); month++) { + // Add data to rows + dataRow->addItem(new QDataItem(temp[year][month], celsiusString)); + } + // Add row to set + dataSet->addRow(dataRow); + // Get next pointer + dataRow++; + } + + // Set up sample space based on prepared data + m_chart->setupSampleSpace(months.size(), years.size()); + + // Add data to chart + m_chart->addDataSet(dataSet); +} + +void ChartModifier::addBars() +{ + QVector<float> data; + for (float i = 0; i < m_columnCount; i++) + data.append(((i + 1) / (float)m_columnCount) * (float)(rand() % 100)); + m_chart->addDataRow(data); +} + +void ChartModifier::changeStyle() +{ + static int model = 0; + switch (model) { + case 0: + m_chart->setBarType(Cylinders, false); + break; + case 1: + m_chart->setBarType(Cylinders, true); + break; + case 2: + m_chart->setBarType(Cones, false); + break; + case 3: + m_chart->setBarType(Cones, true); + break; + case 4: + m_chart->setBarType(Bars, false); + break; + case 5: + m_chart->setBarType(Bars, true); + break; + case 6: + m_chart->setBarType(Pyramids, false); + break; + case 7: + m_chart->setBarType(Pyramids, true); + break; + } + model++; + if (model > 7) + model = 0; +} + +void ChartModifier::changePresetCamera() +{ + static int preset = PresetFrontLow; + + m_chart->setCameraPreset((CameraPreset)preset); + + if (++preset > PresetDirectlyAboveCCW45) + preset = PresetFrontLow; +} + +void ChartModifier::changeTheme() +{ + static int theme = ThemeSystem; + + m_chart->setTheme((ColorTheme)theme); + + if (++theme > ThemeLight) + theme = ThemeSystem; +} + +void ChartModifier::changeTransparency() +{ + static int transparency = TransparencyFromTheme; + + m_chart->setLabelTransparency((LabelTransparency)transparency); + + if (++transparency > TransparencyNoBackground) + transparency = TransparencyNone; +} + +void ChartModifier::changeSelectionMode() +{ + static int selectionMode = ModeNone; + + m_chart->setSelectionMode((SelectionMode)selectionMode); + + if (++selectionMode > ModeZoomColumn) + selectionMode = ModeNone; +} + +void ChartModifier::changeFont(const QFont &font) +{ + QFont newFont = font; + newFont.setPixelSize(m_fontSize); + m_chart->setFont(newFont); +} + +void ChartModifier::changeFontSize(int fontsize) +{ + m_fontSize = fontsize; + m_chart->setFontSize((GLfloat)m_fontSize); +} + +void ChartModifier::setGridEnabled(int enabled) +{ + m_chart->setGridEnabled((bool)enabled); +} + +void ChartModifier::rotateX(int rotation) +{ + m_xRotation = rotation; + m_chart->setCameraPosition(m_xRotation, m_yRotation); +} + +void ChartModifier::rotateY(int rotation) +{ + m_yRotation = rotation; + m_chart->setCameraPosition(m_xRotation, m_yRotation); +} + +void ChartModifier::setSpecsX(int barwidth) +{ + m_barWidth = (float)barwidth / 100.0f; + m_chart->setBarSpecs(QSizeF(m_barWidth, m_barDepth), QSizeF(m_barSpacingX, m_barSpacingZ)); +} + +void ChartModifier::setSpecsZ(int bardepth) +{ + m_barDepth = (float)bardepth / 100.0f; + m_chart->setBarSpecs(QSizeF(m_barWidth, m_barDepth), QSizeF(m_barSpacingX, m_barSpacingZ)); +} + +void ChartModifier::setSpacingSpecsX(int spacing) +{ + m_barSpacingX = (float)spacing / 100.0f; + m_chart->setBarSpecs(QSizeF(m_barWidth, m_barDepth), QSizeF(m_barSpacingX, m_barSpacingZ)); +} + +void ChartModifier::setSpacingSpecsZ(int spacing) +{ + m_barSpacingZ = (float)spacing / 100.0f; + m_chart->setBarSpecs(QSizeF(m_barWidth, m_barDepth), QSizeF(m_barSpacingX, m_barSpacingZ)); +} + +void ChartModifier::setSampleCountX(int samples) +{ + m_columnCount = samples; + m_chart->setupSampleSpace(m_columnCount, m_rowCount); +} + +void ChartModifier::setSampleCountZ(int samples) +{ + m_rowCount = samples; + m_chart->setupSampleSpace(m_columnCount, m_rowCount); +} diff --git a/examples/widget/chart.h b/examples/widget/chart.h new file mode 100644 index 00000000..87ee93ac --- /dev/null +++ b/examples/widget/chart.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of QtDataVis3D module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CHARTMODIFIER_H +#define CHARTMODIFIER_H + +#include "q3dbars.h" +#include "qdataset.h" + +#include <QFont> +#include <QDebug> + +using namespace QtDataVis3D; + +class ChartModifier : public QObject +{ + Q_OBJECT +public: + explicit ChartModifier(Q3DBars *barchart); + ~ChartModifier(); + + void addDataSet(); + void addBars(); + void changeStyle(); + void changePresetCamera(); + void changeTheme(); + void changeTransparency(); + void changeSelectionMode(); + void changeFont(const QFont &font); + void changeFontSize(int fontsize); + void rotateX(int rotation); + void rotateY(int rotation); + void setGridEnabled(int enabled); + void setSpecsX(int barwidth); + void setSpecsZ(int bardepth); + void setSpacingSpecsX(int spacing); + void setSpacingSpecsZ(int spacing); + void setSampleCountX(int samples); + void setSampleCountZ(int samples); + void start(); + void restart(bool dynamicData); + +private: + Q3DBars *m_chart; + int m_columnCount; + int m_rowCount; + float m_xRotation; + float m_yRotation; + bool m_static; + float m_barWidth; + float m_barDepth; + float m_barSpacingX; + float m_barSpacingZ; + int m_fontSize; +}; + +#endif diff --git a/examples/widget/main.cpp b/examples/widget/main.cpp new file mode 100644 index 00000000..286a2d33 --- /dev/null +++ b/examples/widget/main.cpp @@ -0,0 +1,248 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of QtDataVis3D module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "chart.h" + +#include <QApplication> +#include <QWidget> +#include <QHBoxLayout> +#include <QVBoxLayout> +#include <QPushButton> +#include <QCheckBox> +#include <QSlider> +#include <QFontComboBox> +#include <QLabel> +#include <QScreen> +#include <QFontDatabase> + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + QWidget *widget = new QWidget; + QHBoxLayout *hLayout = new QHBoxLayout(widget); + QVBoxLayout *vLayout = new QVBoxLayout(widget); + + Q3DBars *widgetchart = new Q3DBars(); + QSize screenSize = widgetchart->screen()->size(); + + QWidget *container = QWidget::createWindowContainer(widgetchart); + container->setMinimumSize(QSize(screenSize.width() / 2, screenSize.height() / 2)); + container->setMaximumSize(screenSize); + container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + container->setFocusPolicy(Qt::StrongFocus); + + widget->setWindowTitle(QStringLiteral("Average temperatures in Oulu, Finland (2006-2012)")); + + hLayout->addWidget(container); + hLayout->addLayout(vLayout); + + QPushButton *dataButton = new QPushButton(widget); + dataButton->setText(QStringLiteral("Add a row of random data")); + dataButton->setEnabled(false); + + QPushButton *themeButton = new QPushButton(widget); + themeButton->setText(QStringLiteral("Change theme")); + + QPushButton *labelButton = new QPushButton(widget); + labelButton->setText(QStringLiteral("Change label style")); + + QPushButton *styleButton = new QPushButton(widget); + styleButton->setText(QStringLiteral("Change bar style")); + + QPushButton *cameraButton = new QPushButton(widget); + cameraButton->setText(QStringLiteral("Change camera preset")); + + QPushButton *selectionButton = new QPushButton(widget); + selectionButton->setText(QStringLiteral("Change selection mode")); + + QCheckBox *gridCheckBox = new QCheckBox(widget); + gridCheckBox->setText(QStringLiteral("Show grid")); + gridCheckBox->setChecked(true); + + QCheckBox *rotationCheckBox = new QCheckBox(widget); + rotationCheckBox->setText("Rotate with slider"); + + QCheckBox *staticCheckBox = new QCheckBox(widget); + staticCheckBox->setText("Use dynamic data"); + staticCheckBox->setChecked(false); + + QSlider *rotationSliderX = new QSlider(Qt::Horizontal, widget); + rotationSliderX->setTickInterval(1); + rotationSliderX->setMinimum(-180); + rotationSliderX->setValue(0); + rotationSliderX->setMaximum(180); + rotationSliderX->setEnabled(false); + QSlider *rotationSliderY = new QSlider(Qt::Horizontal, widget); + rotationSliderY->setTickInterval(1); + rotationSliderY->setMinimum(0); + rotationSliderY->setValue(0); + rotationSliderY->setMaximum(90); + rotationSliderY->setEnabled(false); + + QSlider *sizeSliderX = new QSlider(Qt::Horizontal, widget); + sizeSliderX->setTickInterval(1); + sizeSliderX->setMinimum(1); + sizeSliderX->setValue(100); + sizeSliderX->setMaximum(100); + QSlider *sizeSliderZ = new QSlider(Qt::Horizontal, widget); + sizeSliderZ->setTickInterval(1); + sizeSliderZ->setMinimum(1); + sizeSliderZ->setValue(100); + sizeSliderZ->setMaximum(100); + + QSlider *spacingSliderX = new QSlider(Qt::Horizontal, widget); + spacingSliderX->setTickInterval(1); + spacingSliderX->setMinimum(0); + spacingSliderX->setValue(10); + spacingSliderX->setMaximum(200); + QSlider *spacingSliderZ = new QSlider(Qt::Horizontal, widget); + spacingSliderZ->setTickInterval(1); + spacingSliderZ->setMinimum(0); + spacingSliderZ->setValue(10); + spacingSliderZ->setMaximum(200); + + QSlider *sampleSliderX = new QSlider(Qt::Horizontal, widget); + sampleSliderX->setTickInterval(1); + sampleSliderX->setMinimum(2); + sampleSliderX->setValue(10); + sampleSliderX->setMaximum(100); + sampleSliderX->setEnabled(false); + QSlider *sampleSliderZ = new QSlider(Qt::Horizontal, widget); + sampleSliderZ->setTickInterval(1); + sampleSliderZ->setMinimum(2); + sampleSliderZ->setValue(10); + sampleSliderZ->setMaximum(100); + sampleSliderZ->setEnabled(false); + + QSlider *fontSizeSlider = new QSlider(Qt::Horizontal, widget); + fontSizeSlider->setTickInterval(1); + fontSizeSlider->setMinimum(1); + fontSizeSlider->setValue(20); + fontSizeSlider->setMaximum(100); + + QFontComboBox *fontList = new QFontComboBox(widget); + + vLayout->addWidget(staticCheckBox, 0, Qt::AlignTop); + vLayout->addWidget(rotationCheckBox, 0, Qt::AlignTop); + vLayout->addWidget(rotationSliderX, 0, Qt::AlignTop); + vLayout->addWidget(rotationSliderY, 0, Qt::AlignTop); + vLayout->addWidget(new QLabel(QStringLiteral("Adjust relative bar size"))); + vLayout->addWidget(sizeSliderX, 0, Qt::AlignTop); + vLayout->addWidget(sizeSliderZ, 0, Qt::AlignTop); + vLayout->addWidget(new QLabel(QStringLiteral("Adjust relative bar spacing"))); + vLayout->addWidget(spacingSliderX, 0, Qt::AlignTop); + vLayout->addWidget(spacingSliderZ, 0, Qt::AlignTop); + vLayout->addWidget(new QLabel(QStringLiteral("Adjust sample count"))); + vLayout->addWidget(sampleSliderX, 0, Qt::AlignTop); + vLayout->addWidget(sampleSliderZ, 1, Qt::AlignTop); + vLayout->addWidget(dataButton, 0, Qt::AlignTop); + vLayout->addWidget(themeButton, 0, Qt::AlignTop); + vLayout->addWidget(labelButton, 0, Qt::AlignTop); + vLayout->addWidget(styleButton, 0, Qt::AlignTop); + vLayout->addWidget(cameraButton, 0, Qt::AlignTop); + vLayout->addWidget(selectionButton, 0, Qt::AlignTop); + vLayout->addWidget(gridCheckBox); + vLayout->addWidget(new QLabel(QStringLiteral("Change font"))); + vLayout->addWidget(fontList); + vLayout->addWidget(new QLabel(QStringLiteral("Adjust font size"))); + vLayout->addWidget(fontSizeSlider, 0, Qt::AlignTop); + // TODO: Add example for setMeshFileName + + widget->show(); + + ChartModifier *modifier = new ChartModifier(widgetchart); + + QObject::connect(rotationSliderX, &QSlider::valueChanged, modifier, &ChartModifier::rotateX); + QObject::connect(rotationSliderY, &QSlider::valueChanged, modifier, &ChartModifier::rotateY); + + QObject::connect(sizeSliderX, &QSlider::valueChanged, modifier, &ChartModifier::setSpecsX); + QObject::connect(sizeSliderZ, &QSlider::valueChanged, modifier, &ChartModifier::setSpecsZ); + + QObject::connect(spacingSliderX, &QSlider::valueChanged, modifier, + &ChartModifier::setSpacingSpecsX); + QObject::connect(spacingSliderZ, &QSlider::valueChanged, modifier, + &ChartModifier::setSpacingSpecsZ); + + QObject::connect(sampleSliderX, &QSlider::valueChanged, modifier, + &ChartModifier::setSampleCountX); + QObject::connect(sampleSliderZ, &QSlider::valueChanged, modifier, + &ChartModifier::setSampleCountZ); + + QObject::connect(fontSizeSlider, &QSlider::valueChanged, modifier, + &ChartModifier::changeFontSize); + + QObject::connect(styleButton, &QPushButton::clicked, modifier, &ChartModifier::changeStyle); + QObject::connect(cameraButton, &QPushButton::clicked, modifier, + &ChartModifier::changePresetCamera); + QObject::connect(themeButton, &QPushButton::clicked, modifier, &ChartModifier::changeTheme); + QObject::connect(labelButton, &QPushButton::clicked, modifier, + &ChartModifier::changeTransparency); + QObject::connect(dataButton, &QPushButton::clicked, modifier, &ChartModifier::addBars); + QObject::connect(selectionButton, &QPushButton::clicked, modifier, + &ChartModifier::changeSelectionMode); + + QObject::connect(fontList, &QFontComboBox::currentFontChanged, modifier, + &ChartModifier::changeFont); + + QObject::connect(gridCheckBox, &QCheckBox::stateChanged, modifier, + &ChartModifier::setGridEnabled); + + QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderX, + &QSlider::setEnabled); + QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderX, + &QSlider::setValue); + QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderY, + &QSlider::setEnabled); + QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderY, + &QSlider::setValue); + + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, dataButton, + &QPushButton::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderX, + &QSlider::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderZ, + &QSlider::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, modifier, &ChartModifier::restart); + + modifier->start(); + + return app.exec(); +} diff --git a/examples/widget/widget.pro b/examples/widget/widget.pro new file mode 100644 index 00000000..ceff6f17 --- /dev/null +++ b/examples/widget/widget.pro @@ -0,0 +1,7 @@ +SOURCES += main.cpp chart.cpp +HEADERS += chart.h + +QT += datavis3d + +target.path = $$[QT_INSTALL_EXAMPLES]/datavis3d/widget +INSTALLS += target |