diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-08-05 08:58:37 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-08-05 10:59:59 +0300 |
commit | bfc8e5e40eafea00bdc481a663e229a23dc8f83b (patch) | |
tree | 58487c4e8cfe60ada257e4e3e2aae3ec1b05586a /examples | |
parent | 2b3dde773f730c7b32268751de42ca8724785553 (diff) |
Q3DScatter: Scene drawing works
+ added an example utilizing sctter chart
- labels still disabled and untested
- QML still missing
Change-Id: I98b3d6701ca6c73305ba3984f60923939e7988e6
Change-Id: I98b3d6701ca6c73305ba3984f60923939e7988e6
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/examples.pro | 3 | ||||
-rw-r--r-- | examples/scatterchart/doc/src/scatterchart.qdoc | 38 | ||||
-rw-r--r-- | examples/scatterchart/main.cpp | 227 | ||||
-rw-r--r-- | examples/scatterchart/scatterchart.cpp | 287 | ||||
-rw-r--r-- | examples/scatterchart/scatterchart.h | 88 | ||||
-rw-r--r-- | examples/scatterchart/scatterchart.pro | 10 |
6 files changed, 652 insertions, 1 deletions
diff --git a/examples/examples.pro b/examples/examples.pro index 348aab53..636d7022 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -5,6 +5,7 @@ SUBDIRS += barchart \ mapdata \ qmlbarchart \ qmlmaps \ - surfacechart + surfacechart \ + scatterchart qtHaveModule(multimedia):!android: SUBDIRS += spectrum diff --git a/examples/scatterchart/doc/src/scatterchart.qdoc b/examples/scatterchart/doc/src/scatterchart.qdoc new file mode 100644 index 00000000..ac3d758a --- /dev/null +++ b/examples/scatterchart/doc/src/scatterchart.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** 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 the QtDataVis3D module. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example scatterchart + \title Scatter Chart Example + + The scatterchart example shows how to make a simple 3D scatter chart using Q3DScatter and + combining the use of widgets for adjusting several adjustable qualities. + + \image scatterchart-example.png + + TODO +*/ diff --git a/examples/scatterchart/main.cpp b/examples/scatterchart/main.cpp new file mode 100644 index 00000000..6cec6988 --- /dev/null +++ b/examples/scatterchart/main.cpp @@ -0,0 +1,227 @@ +/**************************************************************************** +** +** 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 "scatterchart.h" + +#include <QApplication> +#include <QWidget> +#include <QHBoxLayout> +#include <QVBoxLayout> +#include <QPushButton> +#include <QCheckBox> +#include <QSlider> +#include <QComboBox> +#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(); + + Q3DScatter *chart = new Q3DScatter(); + QSize screenSize = chart->screen()->size(); + + QWidget *container = QWidget::createWindowContainer(chart); + 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("values of some things in something")); + + hLayout->addWidget(container, 1); + 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"); + +// 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); + +// QComboBox *valueDimension = new QComboBox(widget); +// valueDimension->addItem(QStringLiteral("Height")); +// valueDimension->addItem(QStringLiteral("Width")); +// valueDimension->addItem(QStringLiteral("Depth")); +// valueDimension->addItem(QStringLiteral("Radius")); +// valueDimension->addItem(QStringLiteral("All")); +// valueDimension->setCurrentIndex(4); + + QComboBox *shadowQuality = new QComboBox(widget); + shadowQuality->addItem(QStringLiteral("None")); + shadowQuality->addItem(QStringLiteral("Low")); + shadowQuality->addItem(QStringLiteral("Medium")); + shadowQuality->addItem(QStringLiteral("High")); + shadowQuality->setCurrentIndex(1); + + QFontComboBox *fontList = new QFontComboBox(widget); + + QSlider *fontSizeSlider = new QSlider(Qt::Horizontal, widget); + fontSizeSlider->setTickInterval(1); + fontSizeSlider->setMinimum(1); + fontSizeSlider->setValue(80); + fontSizeSlider->setMaximum(200); + +// 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(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(new QLabel(QStringLiteral("Apply value to:"))); +// vLayout->addWidget(valueDimension, 0, Qt::AlignTop); +// vLayout->addWidget(selectionButton, 0, Qt::AlignTop); + vLayout->addWidget(gridCheckBox); + vLayout->addWidget(new QLabel(QStringLiteral("Adjust shadow quality"))); + vLayout->addWidget(shadowQuality); + vLayout->addWidget(new QLabel(QStringLiteral("Change font"))); + vLayout->addWidget(fontList); + vLayout->addWidget(new QLabel(QStringLiteral("Adjust font size"))); + vLayout->addWidget(fontSizeSlider, 1, Qt::AlignTop); +// // TODO: Add example for setMeshFileName + + widget->show(); + + ScatterDataModifier *modifier = new ScatterDataModifier(chart); + +// QObject::connect(rotationSliderX, &QSlider::valueChanged, modifier, &MapsModifier::rotateX); +// QObject::connect(rotationSliderY, &QSlider::valueChanged, modifier, &MapsModifier::rotateY); + +// QObject::connect(sizeSliderX, &QSlider::valueChanged, modifier, &MapsModifier::setSpecsX); +// QObject::connect(sizeSliderZ, &QSlider::valueChanged, modifier, &MapsModifier::setSpecsZ); + + QObject::connect(fontSizeSlider, &QSlider::valueChanged, modifier, + &ScatterDataModifier::changeFontSize); + + QObject::connect(styleButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::changeStyle); + QObject::connect(cameraButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::changePresetCamera); + QObject::connect(themeButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::changeTheme); + QObject::connect(labelButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::changeTransparency); +// QObject::connect(dataButton, &QPushButton::clicked, modifier, &MapsModifier::addBars); +// QObject::connect(selectionButton, &QPushButton::clicked, modifier, +// &MapsModifier::changeSelectionMode); + +// QObject::connect(valueDimension, SIGNAL(currentIndexChanged(int)), modifier, +// SLOT(changeValueDimension(int))); + + QObject::connect(shadowQuality, SIGNAL(currentIndexChanged(int)), modifier, + SLOT(changeShadowQuality(int))); + QObject::connect(modifier, &ScatterDataModifier::shadowQualityChanged, shadowQuality, + &QComboBox::setCurrentIndex); + QObject::connect(chart, &Q3DScatter::shadowQualityChanged, modifier, + &ScatterDataModifier::shadowQualityUpdatedByVisual); + + QObject::connect(fontList, &QFontComboBox::currentFontChanged, modifier, + &ScatterDataModifier::changeFont); + + QObject::connect(gridCheckBox, &QCheckBox::stateChanged, modifier, + &ScatterDataModifier::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); + + modifier->start(); + + return app.exec(); +} diff --git a/examples/scatterchart/scatterchart.cpp b/examples/scatterchart/scatterchart.cpp new file mode 100644 index 00000000..1c91f6d7 --- /dev/null +++ b/examples/scatterchart/scatterchart.cpp @@ -0,0 +1,287 @@ +/**************************************************************************** +** +** 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 "scatterchart.h" +#include "qscatterdataproxy.h" +#include <QImage> +#include <QFile> + +using namespace QtDataVis3D; + +ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter) + : m_chart(scatter), + m_fontSize(80.0f) +{ + m_chart->setFontSize(m_fontSize); + + m_chart->setTheme(ThemeBlueIcy); + m_chart->setShadowQuality(ShadowMedium); + + QScatterDataProxy *proxy = new QScatterDataProxy; + m_chart->setDataProxy(proxy); +} + +ScatterDataModifier::~ScatterDataModifier() +{ + delete m_chart; +} + +void ScatterDataModifier::start() +{ + addData(); +} + +void ScatterDataModifier::addData() +{ + QScatterDataArray *dataArray = new QScatterDataArray; + QScatterDataItem *item; +#if 0 + item = new QScatterDataItem(); + item->setValue(-1.0); + //item->setLabel("Oulu"); + item->setScatterPosition(QPointF(0.0f, 0.0f)); + dataArray->append(*item); + delete item; + + item = new QScatterDataItem(); + item->setValue(1.0); + //item->setLabel("Kemi"); + item->setScatterPosition(QPointF(1.0f, 1.0f)); + dataArray->append(*item); + delete item; + + item = new QScatterDataItem(); + item->setValue(0.5); + //item->setLabel("Rovaniemi"); + item->setScatterPosition(QPointF(-1.0f, -1.0f)); + dataArray->append(*item); + delete item; + + item = new QScatterDataItem(); + item->setValue(-0.5); + //item->setLabel("Kuusamo"); + item->setScatterPosition(QPointF(0.5f, -0.5f)); + dataArray->append(*item); + delete item; + + item = new QScatterDataItem(); + item->setValue(-0.75); + //item->setLabel("Kuusamo"); + item->setScatterPosition(QPointF(0.25f, 0.25f)); + dataArray->append(*item); + delete item; + + item = new QScatterDataItem(); + item->setValue(0.75); + //item->setLabel("Kuusamo"); + item->setScatterPosition(QPointF(0.75f, -0.75f)); + dataArray->append(*item); + delete item; + + item = new QScatterDataItem(); + item->setValue(0.6); + //item->setLabel("Kuusamo"); + item->setScatterPosition(QPointF(0.1f, -0.2f)); + dataArray->append(*item); + delete item; + + item = new QScatterDataItem(); + item->setValue(-0.4); + //item->setLabel("Kuusamo"); + item->setScatterPosition(QPointF(0.2f, -0.05f)); + dataArray->append(*item); + delete item; + + item = new QScatterDataItem(); + item->setValue(0.35); + //item->setLabel("Kuusamo"); + item->setScatterPosition(QPointF(-0.25f, 0.35f)); + dataArray->append(*item); + delete item; +#else + for (int i = 0; i < 500; i++) { + item = new QScatterDataItem(); + item->setValue((qreal)(rand() % 100) / 100.0 - (qreal)(rand() % 100) / 100.0); + item->setScatterPosition( + QPointF((qreal)(rand() % 100) / 100.0 - (qreal)(rand() % 100) / 100.0, + (qreal)(rand() % 100) / 100.0 - (qreal)(rand() % 100) / 100.0)); + dataArray->append(*item); + delete item; + } +#endif + static_cast<QScatterDataProxy *>(m_chart->dataProxy())->resetArray(dataArray); +} + +void ScatterDataModifier::changeStyle() +{ + static int model = 0; + switch (model) { + case 0: + m_chart->setBarType(Dots, false); + break; + case 1: + m_chart->setBarType(Dots, true); + break; + case 2: + m_chart->setBarType(Spheres, false); + break; + case 3: + m_chart->setBarType(Spheres, true); + break; + } + model++; + if (model > 3) + model = 0; +} + +void ScatterDataModifier::changePresetCamera() +{ + static int preset = PresetFrontLow; + + m_chart->setCameraPreset((CameraPreset)preset); + + if (++preset > PresetDirectlyAboveCCW45) + preset = PresetFrontLow; +} + +void ScatterDataModifier::changeTheme() +{ + static int theme = ThemeSystem; + + m_chart->setTheme((ColorTheme)theme); + + if (++theme > ThemeLight) + theme = ThemeSystem; +} + +void ScatterDataModifier::changeTransparency() +{ + static int transparency = TransparencyNone; + + m_chart->setLabelTransparency((LabelTransparency)transparency); + + if (++transparency > TransparencyNoBackground) + transparency = TransparencyFromTheme; +} + +//void ScatterDataModifier::changeValueDimension(int dimension) +//{ +// m_chart->setBarSpecs(m_barSpecs, (Q3DMaps::AdjustmentDirection)dimension); +//} + +void ScatterDataModifier::changeFont(const QFont &font) +{ + QFont newFont = font; + newFont.setPointSizeF(m_fontSize); + //qDebug() << newFont << newFont.style(); + m_chart->setFont(newFont); +} + +void ScatterDataModifier::changeFontSize(int fontsize) +{ + m_fontSize = fontsize; + m_chart->setFontSize((GLfloat)m_fontSize); +} + +void ScatterDataModifier::shadowQualityUpdatedByVisual(ShadowQuality sq) +{ + int quality = 0; + switch (sq) { + case ShadowLow: + quality = 1; + break; + case ShadowMedium: + quality = 2; + break; + case ShadowHigh: + quality = 3; + break; + } + + // Updates the UI component to show correct shadow quality + emit shadowQualityChanged(quality); +} + +void ScatterDataModifier::changeShadowQuality(int quality) +{ + ShadowQuality sq = ShadowNone; + switch (quality) { + case 1: + sq = ShadowLow; + break; + case 2: + sq = ShadowMedium; + break; + case 3: + sq = ShadowHigh; + break; + } + m_chart->setShadowQuality(sq); + emit shadowQualityChanged(quality); +} + +void ScatterDataModifier::setGridEnabled(int enabled) +{ + m_chart->setGridVisible((bool)enabled); +} + +//void ScatterDataModifier::rotateX(int rotation) +//{ +// m_xRotation = rotation; +// m_chart->setCameraPosition(m_xRotation, m_yRotation); +//} + +//void ScatterDataModifier::rotateY(int rotation) +//{ +// m_yRotation = rotation; +// m_chart->setCameraPosition(m_xRotation, m_yRotation); +//} + +//void ScatterDataModifier::setSpecsX(int barwidth) +//{ +// m_barWidth = (float)barwidth / 100.0f; +// m_chart->setBarSpecs(QSizeF(m_barWidth, m_barDepth), QSizeF(m_barSpacingX, m_barSpacingZ)); +//} + +//void ScatterDataModifier::setSpecsZ(int bardepth) +//{ +// m_barDepth = (float)bardepth / 100.0f; +// m_chart->setBarSpecs(QSizeF(m_barWidth, m_barDepth), QSizeF(m_barSpacingX, m_barSpacingZ)); +//} diff --git a/examples/scatterchart/scatterchart.h b/examples/scatterchart/scatterchart.h new file mode 100644 index 00000000..449c21c5 --- /dev/null +++ b/examples/scatterchart/scatterchart.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** 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 SCATTERDATAMODIFIER_H +#define SCATTERDATAMODIFIER_H + +#include "q3dscatter.h" + +#include <QFont> +#include <QDebug> +//#include <QVector3D> + +using namespace QtDataVis3D; + +class ScatterDataModifier : public QObject +{ + Q_OBJECT +public: + explicit ScatterDataModifier(Q3DScatter *scatter); + ~ScatterDataModifier(); + + void addData(); + void changeStyle(); + void changePresetCamera(); + void changeTheme(); +// void changeSelectionMode(); + void changeTransparency(); + 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 start(); + +public slots: + void changeShadowQuality(int quality); + void shadowQualityUpdatedByVisual(ShadowQuality shadowQuality); + +signals: + void shadowQualityChanged(int quality); + +private: + Q3DScatter *m_chart; + //QRect m_areaRect; + int m_fontSize; + //QVector3D m_barSpecs; +}; + +#endif diff --git a/examples/scatterchart/scatterchart.pro b/examples/scatterchart/scatterchart.pro new file mode 100644 index 00000000..5dee59fd --- /dev/null +++ b/examples/scatterchart/scatterchart.pro @@ -0,0 +1,10 @@ +!include( ../examples.pri ) { + error( "Couldn't find the examples.pri file!" ) +} + +SOURCES += main.cpp scatterchart.cpp +HEADERS += scatterchart.h + +QT += widgets + +INSTALLS += target |