diff options
Diffstat (limited to 'examples')
78 files changed, 5279 insertions, 1446 deletions
diff --git a/examples/barchart/barchart.pro b/examples/barchart/barchart.pro index 381b3402..12b296c5 100644 --- a/examples/barchart/barchart.pro +++ b/examples/barchart/barchart.pro @@ -3,6 +3,7 @@ } SOURCES += main.cpp -QT += datavis3d INSTALLS += target + +QT += widgets diff --git a/examples/barchart/doc/src/barchart.qdoc b/examples/barchart/doc/src/barchart.qdoc index 498388bb..6c2c8760 100644 --- a/examples/barchart/doc/src/barchart.qdoc +++ b/examples/barchart/doc/src/barchart.qdoc @@ -1,27 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the documentation of the QtDataVis3D module. +** This file is part 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 +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. 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. +** a written agreement between you and Digia. ** -** 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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/barchart/main.cpp b/examples/barchart/main.cpp index 6887bb0b..77230b5d 100644 --- a/examples/barchart/main.cpp +++ b/examples/barchart/main.cpp @@ -1,47 +1,29 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the documentation of the QtDataVis3D module. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ -#include "q3dbars.h" -#include "qdataset.h" +#include <QtDataVis3D/q3dbars.h> +#include <QtDataVis3D/qcategoryaxis.h> +#include <QtDataVis3D/qitemmodelbardataproxy.h> +#include <QtDataVis3D/qvalueaxis.h> -#include <QGuiApplication> +#include <QApplication> +#include <QVBoxLayout> +#include <QTableWidget> #include <QScreen> #include <QTimer> #include <QFont> @@ -57,11 +39,11 @@ using namespace QtDataVis3D; class ChartDataGenerator : public QObject { public: - explicit ChartDataGenerator(Q3DBars *barchart); + explicit ChartDataGenerator(Q3DBars *barchart, QTableWidget *tableWidget); ~ChartDataGenerator(); - void addDataSet(); - void addBars(); + void setupModel(); + void addRow(); void changeStyle(); void changePresetCamera(); void changeTheme(); @@ -75,16 +57,18 @@ private: QTimer *m_themeTimer; int m_columnCount; int m_rowCount; + QTableWidget *m_tableWidget; // not owned }; -ChartDataGenerator::ChartDataGenerator(Q3DBars *barchart) +ChartDataGenerator::ChartDataGenerator(Q3DBars *barchart, QTableWidget *tableWidget) : m_chart(barchart), m_dataTimer(0), m_styleTimer(0), m_presetTimer(0), m_themeTimer(0), - m_columnCount(21), - m_rowCount(21) + m_columnCount(100), + m_rowCount(50), + m_tableWidget(tableWidget) { // Set up bar specifications; make the bars as wide as they are deep, // and add a small space between the bars @@ -92,20 +76,21 @@ ChartDataGenerator::ChartDataGenerator(Q3DBars *barchart) #ifndef USE_STATIC_DATA // Set up sample space; make it as deep as it's wide - m_chart->setupSampleSpace(m_columnCount, m_rowCount); + m_chart->setupSampleSpace(m_rowCount, m_columnCount); + m_tableWidget->setColumnCount(m_columnCount); #endif // Set bar type to smooth bar #ifndef CYCLE_THROUGH_STYLES - m_chart->setBarType(Pyramids, false); + m_chart->setBarType(QDataVis::Pyramids, false); #endif #ifndef USE_STATIC_DATA // Set selection mode to full - m_chart->setSelectionMode(ModeBarRowAndColumn); + m_chart->setSelectionMode(QDataVis::ModeItemRowAndColumn); #else // Set selection mode to zoom row - m_chart->setSelectionMode(ModeZoomRow); + m_chart->setSelectionMode(QDataVis::ModeZoomRow); m_chart->setFont(QFont("Courier", 25)); #endif @@ -113,11 +98,11 @@ ChartDataGenerator::ChartDataGenerator(Q3DBars *barchart) // Set bar colors m_chart->setBarColor(QColor(Qt::gray), QColor(Qt::red), QColor(Qt::darkBlue)); #else - m_chart->setLabelTransparency(TransparencyNone); + m_chart->setLabelTransparency(QDataVis::TransparencyNone); #endif // Set preset camera position - m_chart->setCameraPreset(PresetFront); + m_chart->setCameraPreset(QDataVis::PresetFront); } ChartDataGenerator::~ChartDataGenerator() @@ -146,11 +131,11 @@ void ChartDataGenerator::start() #ifndef USE_STATIC_DATA m_dataTimer = new QTimer(); m_dataTimer->setTimerType(Qt::CoarseTimer); - m_dataTimer->setInterval(100); - QObject::connect(m_dataTimer, &QTimer::timeout, this, &ChartDataGenerator::addBars); - m_dataTimer->start(100); + m_dataTimer->setInterval(20); + QObject::connect(m_dataTimer, &QTimer::timeout, this, &ChartDataGenerator::addRow); + m_dataTimer->start(20); #else - addDataSet(); + setupModel(); #endif #ifdef CYCLE_THROUGH_STYLES @@ -182,84 +167,53 @@ void ChartDataGenerator::start() #endif } -void ChartDataGenerator::addDataSet() +void ChartDataGenerator::setupModel() { -#if 0 - // Prepare data to be visualized - // Use float vector adder - QVector< QVector<float> > data; - QVector<float> row; - // TODO: Keep here for testing - for (int j = 0; j < m_rowCount; j++) { - for (int i = 0; i < m_columnCount; i++) { - row.prepend(((float)i / (float)m_columnCount) * 100 + (float)(rand() % 30)); - //row.append(1.0f); - } - data.append(row); - row.clear(); - } - // Set up sample space based on inserted data - m_chart->setupSampleSpace(m_columnCount, m_rowCount); - // Add data to chart - m_chart->addDataSet(data); -#else - // Prepare data to be visualized - // Use QDataSet adder - - // Set window title - m_chart->setWindowTitle(QStringLiteral("Hours playing banjo")); - // Set up row and column names - QVector<QString> days; + QStringList days; days << "Monday" << "Tuesday" << "Wednesday" << "Thursday" << "Friday" << "Saturday" << "Sunday"; - QVector<QString> weeks; + QStringList weeks; weeks << "week 1" << "week 2" << "week 3" << "week 4" << "week 5"; // Set up data Mon Tue Wed Thu Fri Sat Sun - float hours[5][7] = {{2.0f, 1.0f, 3.0f, 0.2f, 1.0f, 5.0f, 7.0f}, // week 1 + float hours[5][7] = {{2.0f, 1.0f, 3.0f, 0.2f, 1.0f, 5.0f, 10.0f}, // week 1 {0.5f, 1.0f, 3.0f, 1.0f, 2.0f, 2.0f, 3.0f}, // week 2 {1.0f, 1.0f, 2.0f, 1.0f, 4.0f, 4.0f, 4.0f}, // week 3 - {0.0f, 0.0f, 0.0f, 0.0f, 2.0f, 2.0f, 0.3f}, // week 4 + {0.0f, 1.0f, 0.0f, 0.0f, 2.0f, 2.0f, 0.3f}, // week 4 {3.0f, 3.0f, 6.0f, 2.0f, 2.0f, 1.0f, 1.0f}}; // week 5 - // Set tick count and step, we want a line every hour -> 7 ticks, step 1 hour - m_chart->setTickCount(7, 1.0f); - - // Create data set - QDataSet *dataSet = new QDataSet(); - // Add labels - dataSet->setLabels("Week of year", "Day of week", "Hours playing banjo", weeks, days); + m_chart->rowAxis()->setTitle("Week of year"); + m_chart->columnAxis()->setTitle("Day of week"); + m_chart->valueAxis()->setTitle("Hours playing banjo"); + m_chart->valueAxis()->setSegmentCount(5); + m_chart->rowAxis()->setCategoryLabels(weeks); + m_chart->columnAxis()->setCategoryLabels(days); + + m_tableWidget->setRowCount(5); + m_tableWidget->setColumnCount(7); + m_tableWidget->setHorizontalHeaderLabels(days); + m_tableWidget->setVerticalHeaderLabels(weeks); - // Create data rows - QDataRow *dataRow; for (int week = 0; week < weeks.size(); week++) { - dataRow = new QDataRow(weeks.at(week)); - // Create data items for (int day = 0; day < days.size(); day++) { - // Add data to rows - dataRow->addItem(new QDataItem(hours[week][day], "h"));//, " + days.at(day))); + QModelIndex index = m_tableWidget->model()->index(week, day); + m_tableWidget->model()->setData(index, hours[week][day]); } - // Add row to set - dataSet->addRow(dataRow); - // Get next pointer - dataRow++; } // Set up sample space based on prepared data - m_chart->setupSampleSpace(days.size(), weeks.size()); - - // Add data to chart - m_chart->addDataSet(dataSet); -#endif + m_chart->setupSampleSpace(weeks.size(), days.size()); } -void ChartDataGenerator::addBars() +void ChartDataGenerator::addRow() { - QVector<float> data; - for (int i = 0; i < m_columnCount; i++) - data.append(((float)i / (float)m_columnCount) / 2.0f + (float)(rand() % 30) / 100); - m_chart->addDataRow(data); + m_tableWidget->model()->insertRow(0); + for (int i = 0; i < m_columnCount; i++) { + QModelIndex index = m_tableWidget->model()->index(0, i); + m_tableWidget->model()->setData(index, + ((qreal)i / (qreal)m_columnCount) / 2.0 + (qreal)(rand() % 30) / 100.0); + } } void ChartDataGenerator::changeStyle() @@ -267,28 +221,28 @@ void ChartDataGenerator::changeStyle() static int model = 0; switch (model) { case 0: - m_chart->setBarType(Cylinders, false); + m_chart->setBarType(QDataVis::Cylinders, false); break; case 1: - m_chart->setBarType(Cylinders, true); + m_chart->setBarType(QDataVis::Cylinders, true); break; case 2: - m_chart->setBarType(Cones, false); + m_chart->setBarType(QDataVis::Cones, false); break; case 3: - m_chart->setBarType(Cones, true); + m_chart->setBarType(QDataVis::Cones, true); break; case 4: - m_chart->setBarType(Bars, false); + m_chart->setBarType(QDataVis::Bars, false); break; case 5: - m_chart->setBarType(Bars, true); + m_chart->setBarType(QDataVis::Bars, true); break; case 6: - m_chart->setBarType(Pyramids, false); + m_chart->setBarType(QDataVis::Pyramids, false); break; case 7: - m_chart->setBarType(Pyramids, true); + m_chart->setBarType(QDataVis::Pyramids, true); break; } model++; @@ -300,9 +254,9 @@ void ChartDataGenerator::changePresetCamera() { static int preset = 0; - m_chart->setCameraPreset((CameraPreset)preset); + m_chart->setCameraPreset((QDataVis::CameraPreset)preset); - if (++preset > (int)PresetDirectlyAboveCCW45) + if (++preset > (int)QDataVis::PresetDirectlyAboveCCW45) preset = 0; } @@ -310,24 +264,45 @@ void ChartDataGenerator::changeTheme() { static int theme = 0; - m_chart->setTheme((ColorTheme)theme); + m_chart->setTheme((QDataVis::ColorTheme)theme); - if (++theme > (int)ThemeLight) + if (++theme > (int)QDataVis::ThemeLight) theme = 0; } int main(int argc, char **argv) { - QGuiApplication app(argc, argv); + QApplication app(argc, argv); + + QWidget *widget = new QWidget; + QVBoxLayout *layout = new QVBoxLayout(widget); + + Q3DBars *chart = new Q3DBars(); + QSize screenSize = chart->screen()->size(); - Q3DBars barchart; - QSize screenSize = barchart.screen()->size(); - barchart.resize(screenSize.width() / 1.5, screenSize.height() / 1.5); - barchart.setPosition(screenSize.width() / 6, screenSize.height() / 6); - barchart.show(); + 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); - ChartDataGenerator *generator = new ChartDataGenerator(&barchart); + widget->setWindowTitle(QStringLiteral("Hours playing banjo")); + + QTableWidget *tableWidget = new QTableWidget(0, 0, widget); + + layout->addWidget(tableWidget); + layout->addWidget(container, 1); + + // We don't need to initialize the mapping object in any way, as it defaults + // to row/column support and uses the Qt::DisplayRole role for value role by default. + QItemModelBarDataMapping mapping; + QItemModelBarDataProxy *proxy = new QItemModelBarDataProxy(tableWidget->model(), &mapping); + chart->setDataProxy(proxy); + + ChartDataGenerator *generator = new ChartDataGenerator(chart, tableWidget); generator->start(); + widget->show(); + return app.exec(); } diff --git a/examples/examples.pri b/examples/examples.pri index f20862e7..48d2f29a 100644 --- a/examples/examples.pri +++ b/examples/examples.pri @@ -11,6 +11,10 @@ win32 { DESTDIR = $$OUT_PWD } +LIBS += -L$$OUT_PWD/../../lib + +QT += datavis3d + contains(TARGET, qml.*) { uri = com.digia.QtDataVis3D lib_name = datavis3dqml2 @@ -46,7 +50,8 @@ contains(TARGET, qml.*) { src_lib = lib$${lib_name}.dylib } } else { - src_lib = $${lib_name}.so + # linux, android + src_lib = lib$${lib_name}.so } } copy_lib.target = $$make_qmldir_path/$$src_lib @@ -54,14 +59,12 @@ contains(TARGET, qml.*) { copy_lib.commands = $(COPY_FILE) \"$$replace(copy_lib.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_lib.target, /, $$QMAKE_DIR_SEP)\" QMAKE_EXTRA_TARGETS += copy_lib PRE_TARGETDEPS += $$copy_lib.target -} -#android { -# contains(TARGET, qml.*) { -# charts_qmldir.files = $$CHART_BUILD_QML_PLUGIN_DIR/qmldir -# charts_qmldir.path = /assets/imports/QtCommercial/Chart -# charts_qmlplugin.files = $$CHART_BUILD_QML_PLUGIN_DIR/libqtcommercialchartqml.so -# charts_qmlplugin.path = /libs/$$ANDROID_TARGET_ARCH -# INSTALLS += charts_qmldir charts_qmlplugin -# } -#} + android { + android_qmldir.files = $$copy_qmldir_examples.target + android_qmldir.path = /assets/imports/$$make_qmldir_target + android_qmlplugin.files = $$copy_lib.target + android_qmlplugin.path = $$target.path + INSTALLS += android_qmldir android_qmlplugin + } +} diff --git a/examples/examples.pro b/examples/examples.pro index dd772368..4db7ed2f 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -3,6 +3,10 @@ SUBDIRS += barchart \ rainfall \ widget \ mapdata \ - qmlbarchart + qmlbarchart \ + #qmlmaps \ + qmlscatter \ + surfacechart \ + scatterchart -qtHaveModule(multimedia): SUBDIRS += spectrum +qtHaveModule(multimedia):!android: SUBDIRS += spectrum diff --git a/examples/mapdata/doc/src/mapdata.qdoc b/examples/mapdata/doc/src/mapdata.qdoc index be424509..3014cadb 100644 --- a/examples/mapdata/doc/src/mapdata.qdoc +++ b/examples/mapdata/doc/src/mapdata.qdoc @@ -1,27 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the documentation of the QtDataVis3D module. +** This file is part 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 +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. 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. +** a written agreement between you and Digia. ** -** 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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/mapdata/main.cpp b/examples/mapdata/main.cpp index 976b2165..d176bd55 100644 --- a/examples/mapdata/main.cpp +++ b/examples/mapdata/main.cpp @@ -1,40 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the documentation of QtDataVis3D module. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ @@ -199,6 +177,8 @@ int main(int argc, char **argv) QObject::connect(shadowQuality, SIGNAL(currentIndexChanged(int)), modifier, SLOT(changeShadowQuality(int))); + QObject::connect(modifier, &MapsModifier::shadowQuality, shadowQuality, + &QComboBox::setCurrentIndex); QObject::connect(fontList, &QFontComboBox::currentFontChanged, modifier, &MapsModifier::changeFont); diff --git a/examples/mapdata/mapdata.cpp b/examples/mapdata/mapdata.cpp index 8f4aee7c..6f0157da 100644 --- a/examples/mapdata/mapdata.cpp +++ b/examples/mapdata/mapdata.cpp @@ -1,44 +1,23 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the documentation of QtDataVis3D module. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ #include "mapdata.h" +#include <QtDataVis3D/qmapdataproxy.h> #include <QImage> #include <QFile> @@ -64,6 +43,8 @@ MapsModifier::MapsModifier(Q3DMaps *maps) m_chart->setBarSpecs(m_barSpecs, Q3DMaps::AdjustAll); m_chart->setMeshFileName(QStringLiteral(":/meshes/weirdthing")); #endif + QMapDataProxy *proxy = new QMapDataProxy; + m_chart->setDataProxy(proxy); } MapsModifier::~MapsModifier() @@ -78,132 +59,156 @@ void MapsModifier::start() void MapsModifier::addData() { - QDataItem *item; - item = new QDataItem(); + QMapDataArray *dataArray = new QMapDataArray; + QMapDataItem *item; + item = new QMapDataItem(); item->setValue(191050); - item->setLabel("Oulu", true); - item->setPosition(QPoint(963, 1604)); - m_chart->addDataItem(item); + item->setLabel("Oulu"); + item->setMapPosition(QPointF(963, 1604)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(22274); - item->setLabel("Kemi", true); - item->setPosition(QPoint(857, 1383)); - m_chart->addDataItem(item); + item->setLabel("Kemi"); + item->setMapPosition(QPointF(857, 1383)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(60887); - item->setLabel("Rovaniemi", true); - item->setPosition(QPoint(1061, 1119)); - m_chart->addDataItem(item); + item->setLabel("Rovaniemi"); + item->setMapPosition(QPointF(1061, 1119)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(16176); - item->setLabel("Kuusamo", true); - item->setPosition(QPoint(1459, 1284)); - m_chart->addDataItem(item); + item->setLabel("Kuusamo"); + item->setMapPosition(QPointF(1459, 1284)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(3998); - item->setLabel("Ivalo", true); - item->setPosition(QPoint(1239, 474)); - m_chart->addDataItem(item); + item->setLabel("Ivalo"); + item->setMapPosition(QPointF(1239, 474)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(37978); - item->setLabel("Kajaani", true); - item->setPosition(QPoint(1285, 1859)); - m_chart->addDataItem(item); + item->setLabel("Kajaani"); + item->setMapPosition(QPointF(1285, 1859)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(46809); - item->setLabel("Kokkola", true); - item->setPosition(QPoint(580, 1973)); - m_chart->addDataItem(item); + item->setLabel("Kokkola"); + item->setMapPosition(QPointF(580, 1973)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(105236); - item->setLabel("Kuopio", true); - item->setPosition(QPoint(1292, 2283)); - m_chart->addDataItem(item); + item->setLabel("Kuopio"); + item->setMapPosition(QPointF(1292, 2283)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(133557); - item->setLabel("Jyväskylä", true); - item->setPosition(QPoint(991, 2496)); - m_chart->addDataItem(item); + item->setLabel("Jyväskylä"); + item->setMapPosition(QPointF(991, 2496)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(65771); - item->setLabel("Vaasa", true); - item->setPosition(QPoint(441, 2184)); - m_chart->addDataItem(item); + item->setLabel("Vaasa"); + item->setMapPosition(QPointF(441, 2184)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(217603); - item->setLabel("Tampere", true); - item->setPosition(QPoint(686, 2656)); - m_chart->addDataItem(item); + item->setLabel("Tampere"); + item->setMapPosition(QPointF(686, 2656)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(180350); - item->setLabel("Turku", true); - item->setPosition(QPoint(430, 3046)); - m_chart->addDataItem(item); + item->setLabel("Turku"); + item->setMapPosition(QPointF(430, 3046)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(72400); - item->setLabel("Lappeenranta", true); - item->setPosition(QPoint(1365, 2852)); - m_chart->addDataItem(item); + item->setLabel("Lappeenranta"); + item->setMapPosition(QPoint(1365, 2852)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(14754); - item->setLabel("Tammisaari", true); - item->setPosition(QPoint(605, 3215)); - m_chart->addDataItem(item); + item->setLabel("Tammisaari"); + item->setMapPosition(QPointF(605, 3215)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(1879); - item->setLabel("Enontekiö", true); - item->setPosition(QPoint(752, 556)); - m_chart->addDataItem(item); + item->setLabel("Enontekiö"); + item->setMapPosition(QPointF(752, 556)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(36624); - item->setLabel("Savonlinna", true); - item->setPosition(QPoint(1445, 2586)); - m_chart->addDataItem(item); + item->setLabel("Savonlinna"); + item->setMapPosition(QPointF(1445, 2586)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(605022); - item->setLabel("Helsinki", true); - item->setPosition(QPoint(822, 3130)); - m_chart->addDataItem(item); + item->setLabel("Helsinki"); + item->setMapPosition(QPointF(822, 3130)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(54887); - item->setLabel("Kotka", true); - item->setPosition(QPoint(1162, 3051)); - m_chart->addDataItem(item); + item->setLabel("Kotka"); + item->setMapPosition(QPointF(1162, 3051)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(11372); - item->setLabel("Maarianhamina", true); - item->setPosition(QPoint(56, 3101)); - m_chart->addDataItem(item); + item->setLabel("Maarianhamina"); + item->setMapPosition(QPointF(56, 3101)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(9266); - item->setLabel("Hanko", true); - item->setPosition(QPoint(527, 3228)); - m_chart->addDataItem(item); + item->setLabel("Hanko"); + item->setMapPosition(QPointF(527, 3228)); + dataArray->append(*item); + delete item; - item = new QDataItem(); + item = new QMapDataItem(); item->setValue(1287); - item->setLabel("Utsjoki", true); - item->setPosition(QPoint(1180, 72)); - m_chart->addDataItem(item); + item->setLabel("Utsjoki"); + item->setMapPosition(QPointF(1180, 72)); + dataArray->append(*item); + delete item; + + static_cast<QMapDataProxy *>(m_chart->dataProxy())->resetArray(dataArray); } void MapsModifier::changeStyle() @@ -211,40 +216,40 @@ void MapsModifier::changeStyle() static int model = 0; switch (model) { case 0: - m_chart->setBarType(Cylinders, false); + m_chart->setBarType(QDataVis::Cylinders, false); break; case 1: - m_chart->setBarType(Cylinders, true); + m_chart->setBarType(QDataVis::Cylinders, true); break; case 2: - m_chart->setBarType(Cones, false); + m_chart->setBarType(QDataVis::Cones, false); break; case 3: - m_chart->setBarType(Cones, true); + m_chart->setBarType(QDataVis::Cones, true); break; case 4: - m_chart->setBarType(Bars, false); + m_chart->setBarType(QDataVis::Bars, false); break; case 5: - m_chart->setBarType(Bars, true); + m_chart->setBarType(QDataVis::Bars, true); break; case 6: - m_chart->setBarType(Pyramids, false); + m_chart->setBarType(QDataVis::Pyramids, false); break; case 7: - m_chart->setBarType(Pyramids, true); + m_chart->setBarType(QDataVis::Pyramids, true); break; case 8: - m_chart->setBarType(BevelBars, false); + m_chart->setBarType(QDataVis::BevelBars, false); break; case 9: - m_chart->setBarType(BevelBars, true); + m_chart->setBarType(QDataVis::BevelBars, true); break; case 10: - m_chart->setBarType(Spheres, false); + m_chart->setBarType(QDataVis::Spheres, false); break; case 11: - m_chart->setBarType(Spheres, true); + m_chart->setBarType(QDataVis::Spheres, true); break; } model++; @@ -254,32 +259,32 @@ void MapsModifier::changeStyle() void MapsModifier::changePresetCamera() { - static int preset = PresetFrontLow; + static int preset = QDataVis::PresetFrontLow; - m_chart->setCameraPreset((CameraPreset)preset); + m_chart->setCameraPreset((QDataVis::CameraPreset)preset); - if (++preset > PresetDirectlyAboveCCW45) - preset = PresetFrontLow; + if (++preset > QDataVis::PresetDirectlyAboveCCW45) + preset = QDataVis::PresetFrontLow; } void MapsModifier::changeTheme() { - static int theme = ThemeSystem; + static int theme = QDataVis::ThemeSystem; - m_chart->setTheme((ColorTheme)theme); + m_chart->setTheme((QDataVis::ColorTheme)theme); - if (++theme > ThemeLight) - theme = ThemeSystem; + if (++theme > QDataVis::ThemeLight) + theme = QDataVis::ThemeSystem; } void MapsModifier::changeTransparency() { - static int transparency = TransparencyNone; + static int transparency = QDataVis::TransparencyNone; - m_chart->setLabelTransparency((LabelTransparency)transparency); + m_chart->setLabelTransparency((QDataVis::LabelTransparency)transparency); - if (++transparency > TransparencyNoBackground) - transparency = TransparencyFromTheme; + if (++transparency > QDataVis::TransparencyNoBackground) + transparency = QDataVis::TransparencyFromTheme; } void MapsModifier::changeValueDimension(int dimension) @@ -303,19 +308,34 @@ void MapsModifier::changeFontSize(int fontsize) void MapsModifier::changeShadowQuality(int quality) { - ShadowQuality sq = ShadowNone; + QDataVis::ShadowQuality sq = QDataVis::ShadowNone; switch (quality) { case 1: - sq = ShadowLow; + sq = QDataVis::ShadowLow; break; case 2: - sq = ShadowMedium; + sq = QDataVis::ShadowMedium; break; case 3: - sq = ShadowHigh; + sq = QDataVis::ShadowHigh; break; } - m_chart->setShadowQuality(sq); + QDataVis::ShadowQuality realquality = m_chart->setShadowQuality(sq); + // Check if it setting quality was successful + if (realquality != sq) { + switch (realquality) { + case QDataVis::ShadowLow: + quality = 1; + break; + case QDataVis::ShadowMedium: + quality = 2; + break; + case QDataVis::ShadowHigh: + quality = 3; + break; + } + emit shadowQuality(quality); + } } //void MapsModifier::setGridEnabled(int enabled) diff --git a/examples/mapdata/mapdata.h b/examples/mapdata/mapdata.h index 3b3c7219..8aed69fe 100644 --- a/examples/mapdata/mapdata.h +++ b/examples/mapdata/mapdata.h @@ -1,48 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the documentation of QtDataVis3D module. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ #ifndef CHARTMODIFIER_H #define CHARTMODIFIER_H -#include "q3dmaps.h" -#include "qdataset.h" +#include <QtDataVis3D/q3dmaps.h> #include <QFont> #include <QDebug> @@ -75,6 +52,9 @@ public slots: void changeValueDimension(int dimension); void changeShadowQuality(int quality); +signals: + void shadowQuality(int quality); + private: Q3DMaps *m_chart; QRect m_imageRect; diff --git a/examples/mapdata/mapdata.pro b/examples/mapdata/mapdata.pro index 7ed5984e..091fdc7c 100644 --- a/examples/mapdata/mapdata.pro +++ b/examples/mapdata/mapdata.pro @@ -5,7 +5,7 @@ SOURCES += main.cpp mapdata.cpp HEADERS += mapdata.h -QT += datavis3d widgets +QT += widgets INSTALLS += target diff --git a/examples/qmlbarchart/doc/src/qmlbarchart.qdoc b/examples/qmlbarchart/doc/src/qmlbarchart.qdoc index 42bb05aa..becc5d8b 100644 --- a/examples/qmlbarchart/doc/src/qmlbarchart.qdoc +++ b/examples/qmlbarchart/doc/src/qmlbarchart.qdoc @@ -1,27 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the documentation of the QtDataVis3D module. +** This file is part 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 +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. 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. +** a written agreement between you and Digia. ** -** 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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/qmlbarchart/main.cpp b/examples/qmlbarchart/main.cpp index d813443e..b58e66f8 100644 --- a/examples/qmlbarchart/main.cpp +++ b/examples/qmlbarchart/main.cpp @@ -6,26 +6,27 @@ ** ** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. ** ** If you have questions regarding the use of this file, please use ** contact form at http://qt.digia.com -** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QtGui/QGuiApplication> #include "qtquick2applicationviewer.h" +#ifdef Q_OS_ANDROID +#include <QDir> +#include <QQmlEngine> +#endif #include <QDebug> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); - qDebug() << "Hello world."; QtQuick2ApplicationViewer viewer; #ifdef Q_OS_ANDROID @@ -36,7 +37,7 @@ int main(int argc, char *argv[]) viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("qml"))); #endif - viewer.setMainQmlFile(QStringLiteral("qml/qmlbarchart/main.qml")); + viewer.setSource(QUrl("qrc:/qml/main.qml")); viewer.setResizeMode(QQuickView::SizeRootObjectToView); viewer.show(); diff --git a/examples/qmlbarchart/qml/qmlbarchart/main.qml b/examples/qmlbarchart/qml/qmlbarchart/main.qml index 990c78e6..f10f98b9 100644 --- a/examples/qmlbarchart/qml/qmlbarchart/main.qml +++ b/examples/qmlbarchart/qml/qmlbarchart/main.qml @@ -6,116 +6,200 @@ ** ** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. ** ** If you have questions regarding the use of this file, please use ** contact form at http://qt.digia.com -** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.0 +import QtQuick 2.1 import QtQuick.Window 2.1 +import QtQuick.Controls 1.0 import com.digia.QtDataVis3D 1.0 Item { id: mainview - //title: "My MainWindow" - width: 640 - height: 480 + width: 800 + height: 600 visible: true - Bars3D { - id: testchart - width: mainview.width - height: mainview.height + Item { + id: dataView + width: parent.width - tableView.width + height: parent.height + anchors.right: parent.right; - DataItem { - id: testitem - label: "Test" - value: 10 + BarDataMapping { + id: valueMapping + rowRole: "year" + columnRole: "month" + valueRole: "expenses" + rowCategories: ["2000", "2001", "2002", "2003", "2004"] + columnCategories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] } - DataItem { - id: testitem2 - label: "Test2" - value: -10 - } - DataItem { - id: testitem3 - label: "Test3" - value: 5 + + ListModel { + id: dataModel + ListElement{ year: "2000"; month: "Jan"; expenses: "3"; income: "8" } + ListElement{ year: "2000"; month: "Feb"; expenses: "8"; income: "14" } + ListElement{ year: "2000"; month: "Mar"; expenses: "10"; income: "20" } + ListElement{ year: "2000"; month: "Apr"; expenses: "12"; income: "24" } + ListElement{ year: "2000"; month: "May"; expenses: "10"; income: "19" } + ListElement{ year: "2000"; month: "Jun"; expenses: "5"; income: "8" } + ListElement{ year: "2000"; month: "Jul"; expenses: "1"; income: "4" } + ListElement{ year: "2000"; month: "Aug"; expenses: "7"; income: "12" } + ListElement{ year: "2000"; month: "Sep"; expenses: "4"; income: "16" } + ListElement{ year: "2000"; month: "Oct"; expenses: "22"; income: "33" } + ListElement{ year: "2000"; month: "Nov"; expenses: "16"; income: "25" } + ListElement{ year: "2000"; month: "Dec"; expenses: "2"; income: "7" } + + ListElement{ year: "2001"; month: "Jan"; expenses: "4"; income: "5" } + ListElement{ year: "2001"; month: "Feb"; expenses: "4"; income: "7" } + ListElement{ year: "2001"; month: "Mar"; expenses: "11"; income: "14" } + ListElement{ year: "2001"; month: "Apr"; expenses: "16"; income: "22" } + ListElement{ year: "2001"; month: "May"; expenses: "3"; income: "5" } + ListElement{ year: "2001"; month: "Jun"; expenses: "4"; income: "8" } + ListElement{ year: "2001"; month: "Jul"; expenses: "7"; income: "9" } + ListElement{ year: "2001"; month: "Aug"; expenses: "9"; income: "13" } + ListElement{ year: "2001"; month: "Sep"; expenses: "1"; income: "6" } + ListElement{ year: "2001"; month: "Oct"; expenses: "14"; income: "25" } + ListElement{ year: "2001"; month: "Nov"; expenses: "19"; income: "29" } + ListElement{ year: "2001"; month: "Dec"; expenses: "5"; income: "7" } + + ListElement{ year: "2002"; month: "Jan"; expenses: "14"; income: "22" } + ListElement{ year: "2002"; month: "Feb"; expenses: "5"; income: "7" } + ListElement{ year: "2002"; month: "Mar"; expenses: "1"; income: "9" } + ListElement{ year: "2002"; month: "Apr"; expenses: "1"; income: "12" } + ListElement{ year: "2002"; month: "May"; expenses: "5"; income: "9" } + ListElement{ year: "2002"; month: "Jun"; expenses: "5"; income: "8" } + ListElement{ year: "2002"; month: "Jul"; expenses: "3"; income: "7" } + ListElement{ year: "2002"; month: "Aug"; expenses: "1"; income: "5" } + ListElement{ year: "2002"; month: "Sep"; expenses: "2"; income: "4" } + ListElement{ year: "2002"; month: "Oct"; expenses: "10"; income: "13" } + ListElement{ year: "2002"; month: "Nov"; expenses: "12"; income: "17" } + ListElement{ year: "2002"; month: "Dec"; expenses: "6"; income: "9" } + + ListElement{ year: "2003"; month: "Jan"; expenses: "2"; income: "6" } + ListElement{ year: "2003"; month: "Feb"; expenses: "4"; income: "8" } + ListElement{ year: "2003"; month: "Mar"; expenses: "7"; income: "12" } + ListElement{ year: "2003"; month: "Apr"; expenses: "9"; income: "15" } + // rest of 2003 missing on purpose, as well as whole of 2004 } - DataItem { - id: testitem4 - label: "Test4" - value: -7 + CategoryAxis { + id: rowAxis + categoryLabels: ["2000", "2001", "2002", "2003", "2004"] } - DataItem { - id: testitem5 - label: "Test5" - value: 8 + CategoryAxis { + id: columnAxis + categoryLabels: ["January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December"] } - DataItem { - id: testitem6 - label: "Test6" - value: 1 + ValueAxis { + id: valueAxis + min: 0 + max: 35 + labelFormat: "M\u20AC" } + Bars3D { + id: testchart + width: dataView.width + height: dataView.height + gridVisible: true + shadowQuality: Bars3D.ShadowNone + selectionMode: Bars3D.ModeItem + labelTransparency: Bars3D.TransparencyNone + rows: 5 + columns: 12 + mapping: valueMapping + barThickness: Qt.size(0.5, 1.0) + barSpacing: Qt.size(0.5, 0.5) + barSpacingRelative: false + barType: Bars3D.BevelBars + axisX: rowAxis + axisY: valueAxis + axisZ: columnAxis + } + } - DataRow { - id: testrow1 - function addData() { - testrow1.addItem(testitem); - testrow1.addItem(testitem2); - testrow1.addItem(testitem3); - testrow1.addItem(testitem4); - testrow1.addItem(testitem5); - testrow1.addItem(testitem6); - } + Component.onCompleted: { + testchart.data = dataModel + } + + TableView { + id: tableView + x: 0 + y: 0 + width: 270 + height: 500 + TableViewColumn{ role: "year" ; title: "Year" ; width: 40 } + TableViewColumn{ role: "month" ; title: "Month" ; width: 80 } + TableViewColumn{ role: "expenses" ; title: "Expenses" ; width: 70 } + TableViewColumn{ role: "income" ; title: "Income" ; width: 60 } + model: dataModel + } + + Rectangle { + id: shadowToggle + color: "#FFFFFF" + x: 0 + y: tableView.height + width: tableView.width + height: 50 + + TextArea { + id: shadowButtonText + text: "Toggle Shadows" + anchors.fill: parent + textColor: "#000000" } - //visible: true - //x: mainview.x + mainview.width - //y: mainview.y - - grid: false - shadowQuality: Bars3D.ShadowNone - selectionMode: Bars3D.ModeNone - labelTransparency: Bars3D.TransparencyNone - - function setUpBars3D() { - /*console.log(parent) - console.log(container.x) - console.log(container.y) - console.log(Window.x) - console.log(Window.y) - console.log(Screen.desktopAvailableHeight) - console.log(Screen.desktopAvailableWidth) - console.log(mainview.x) - console.log(mainview.y) - console.log(x) - console.log(y)*/ - testchart.setupSampleSpace(6, 1); - testchart.addDataRow(testrow1); + MouseArea { + anchors.fill: parent + onClicked: { + if (testchart.shadowQuality == Bars3D.ShadowNone) { + testchart.shadowQuality = Bars3D.ShadowLow; + shadowButtonText.textColor = "#FFFFFF"; + shadowToggle.color = "#000000"; + } else { + testchart.shadowQuality = Bars3D.ShadowNone; + shadowButtonText.textColor = "#000000"; + shadowToggle.color = "#FFFFFF"; + } + } } } + Rectangle { + id: mappingToggle + color: "#FFFFFF" + x: 0 + y: shadowToggle.height + shadowToggle.y + width: shadowToggle.width + height: 50 - MouseArea { - anchors.fill: parent - onClicked: { - Qt.quit(); + TextArea { + id: mappingButtonText + text: "Show Income" + anchors.fill: parent + textColor: "#000000" } - } - Component.onCompleted: { - // This allows us to flip the texture to be displayed correctly in scene graph - // TODO: Find a way to do it in code.. - //rotation.angle = 180 - testrow1.addData(); - testchart.setUpBars3D(); + MouseArea { + anchors.fill: parent + onClicked: { + if (valueMapping.valueRole == "expenses") { + valueMapping.valueRole = "income" + mappingButtonText.text = "Show Expenses" + } else { + valueMapping.valueRole = "expenses" + mappingButtonText.text = "Show Income" + } + } + } } } diff --git a/examples/qmlbarchart/qmlbarchart.pro b/examples/qmlbarchart/qmlbarchart.pro index 2c729f6b..ef609ef6 100644 --- a/examples/qmlbarchart/qmlbarchart.pro +++ b/examples/qmlbarchart/qmlbarchart.pro @@ -24,3 +24,6 @@ SOURCES += main.cpp # Please do not modify the following two lines. Required for deployment. include(qtquick2applicationviewer/qtquick2applicationviewer.pri) qtcAddDeployment() + +RESOURCES += \ + qmlbarchart.qrc diff --git a/examples/qmlbarchart/qmlbarchart.qrc b/examples/qmlbarchart/qmlbarchart.qrc new file mode 100644 index 00000000..b96401d5 --- /dev/null +++ b/examples/qmlbarchart/qmlbarchart.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/qml"> + <file alias="main.qml">qml/qmlbarchart/main.qml</file> + </qresource> +</RCC> diff --git a/examples/qmlmaps/doc/src/qmlmaps.qdoc b/examples/qmlmaps/doc/src/qmlmaps.qdoc new file mode 100644 index 00000000..f27dc126 --- /dev/null +++ b/examples/qmlmaps/doc/src/qmlmaps.qdoc @@ -0,0 +1,29 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +/*! + \example qmlmaps + \title Qt Quick 2 Maps Example + + The Qt Quick 2 maps example shows how to make a simple maps visualization using Q3DMaps using Qt + Quick 2. + + \image qmlmaps-example.png + + TODO +*/ diff --git a/examples/qmlmaps/floorplan.jpg b/examples/qmlmaps/floorplan.jpg Binary files differnew file mode 100644 index 00000000..578d8252 --- /dev/null +++ b/examples/qmlmaps/floorplan.jpg diff --git a/examples/qmlmaps/main.cpp b/examples/qmlmaps/main.cpp new file mode 100644 index 00000000..b58e66f8 --- /dev/null +++ b/examples/qmlmaps/main.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include <QtGui/QGuiApplication> +#include "qtquick2applicationviewer.h" +#ifdef Q_OS_ANDROID +#include <QDir> +#include <QQmlEngine> +#endif +#include <QDebug> + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QtQuick2ApplicationViewer viewer; +#ifdef Q_OS_ANDROID + viewer.addImportPath(QString::fromLatin1("assets:/qml")); + viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), + QString::fromLatin1("lib"))); +#else + viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), + QString::fromLatin1("qml"))); +#endif + viewer.setSource(QUrl("qrc:/qml/main.qml")); + viewer.setResizeMode(QQuickView::SizeRootObjectToView); + viewer.show(); + + return app.exec(); +} diff --git a/examples/qmlmaps/qml/qmlmaps/main.qml b/examples/qmlmaps/qml/qmlmaps/main.qml new file mode 100644 index 00000000..9a8fa93b --- /dev/null +++ b/examples/qmlmaps/qml/qmlmaps/main.qml @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.0 +import com.digia.QtDataVis3D 1.0 + +Item { + id: mainview + width: 800 + height: 500 + visible: true + //title: "Noise levels from construction site" + + Item { + id: dataView + width: parent.width + height: parent.height - shadowToggle.height + anchors.bottom: parent.bottom + + Image { + id: testimage + source: "qrc:/images/floorplan.jpg" + visible: false + } + + MapDataMapping { + id: mapMapping + labelRole: "label" + valueRole: "value" + xPosRole: "xPos" + yPosRole: "yPos" + } + + ListModel { + id: dataModel + ListElement{ label: "dB"; value: 76; xPos: 95.0; yPos: 490.0 } + ListElement{ label: "dB"; value: 88; xPos: 185.0; yPos: 105.0 } + ListElement{ label: "dB"; value: 85; xPos: 700.0; yPos: 465.0 } + ListElement{ label: "dB"; value: 92; xPos: 505.0; yPos: 225.0 } + } + + Maps3D { + id: testmap + width: dataView.width + height: dataView.height + fontSize: 300.0 + mapping: mapMapping + + Component.onCompleted: { + console.log("testmap complete"); + console.log(testimage); + console.log(testimage.sourceSize); + setBarSpecs(Qt.vector3d(10.0, 10.0, 10.0)); + setAreaSpecs(Qt.rect(0, 0, testimage.sourceSize.width, testimage.sourceSize.height), + testimage); + //setImage(testimage); + setImage(":/images/floorplan.jpg"); + shadowQuality = Maps3D.ShadowNone + selectionMode = Maps3D.ModeBar + labelTransparency = Maps3D.TransparencyNoBackground//.TransparencyFromTheme + data = dataModel + } + } + } + + Component.onCompleted: { + console.log("mainview complete"); + } + + Rectangle { + id: shadowToggle + color: "#FFFFFF" + x: 0 + y: 0 + width: parent.width + height: 60 + + TextArea { + id: buttonText + text: "Toggle Shadows" + anchors.fill: parent + textColor: "#000000" + } + + MouseArea { + anchors.fill: parent + onClicked: { + if (testmap.shadowQuality === Maps3D.ShadowNone) { + testmap.shadowQuality = Maps3D.ShadowLow; + buttonText.textColor = "#999999"; + } else { + testmap.shadowQuality = Maps3D.ShadowNone; + buttonText.textColor = "#000000"; + } + } + } + } +} diff --git a/examples/qmlmaps/qmlmaps.desktop b/examples/qmlmaps/qmlmaps.desktop new file mode 100644 index 00000000..25959510 --- /dev/null +++ b/examples/qmlmaps/qmlmaps.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=qmlmaps +Exec=/opt/qmlmaps/bin/qmlmaps +Icon=qmlmaps64 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qmlmaps/qmlmaps.pro b/examples/qmlmaps/qmlmaps.pro new file mode 100644 index 00000000..44963d48 --- /dev/null +++ b/examples/qmlmaps/qmlmaps.pro @@ -0,0 +1,29 @@ +!include( ../examples.pri ) { + error( "Couldn't find the examples.pri file!" ) +} + +# Add more folders to ship with the application, here +folder_01.source = qml/qmlmaps +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# If your application uses the Qt Mobility libraries, uncomment the following +# lines and add the respective components to the MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Installation path +# target.path = + +# Please do not modify the following two lines. Required for deployment. +include(qtquick2applicationviewer/qtquick2applicationviewer.pri) +qtcAddDeployment() + +RESOURCES += \ + qmlmaps.qrc diff --git a/examples/qmlmaps/qmlmaps.qrc b/examples/qmlmaps/qmlmaps.qrc new file mode 100644 index 00000000..81f1f83c --- /dev/null +++ b/examples/qmlmaps/qmlmaps.qrc @@ -0,0 +1,8 @@ +<RCC> + <qresource prefix="/images"> + <file>floorplan.jpg</file> + </qresource> + <qresource prefix="/qml"> + <file alias="main.qml">qml/qmlmaps/main.qml</file> + </qresource> +</RCC> diff --git a/examples/qmlmaps/qmlmaps64.png b/examples/qmlmaps/qmlmaps64.png Binary files differnew file mode 100644 index 00000000..707d5c4e --- /dev/null +++ b/examples/qmlmaps/qmlmaps64.png diff --git a/examples/qmlmaps/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/examples/qmlmaps/qtquick2applicationviewer/qtquick2applicationviewer.cpp new file mode 100644 index 00000000..10709d7a --- /dev/null +++ b/examples/qmlmaps/qtquick2applicationviewer/qtquick2applicationviewer.cpp @@ -0,0 +1,81 @@ +// checksum 0x4f6f version 0x90005 +/* + This file was generated by the Qt Quick 2 Application wizard of Qt Creator. + QtQuick2ApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qtquick2applicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtQml/QQmlEngine> + +class QtQuick2ApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QtQuick2ApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path) +{ +#if defined(Q_OS_MAC) + if (!QDir::isAbsolutePath(path)) + return QString::fromLatin1("%1/../Resources/%2") + .arg(QCoreApplication::applicationDirPath(), path); +#elif defined(Q_OS_BLACKBERRY) + if (!QDir::isAbsolutePath(path)) + return QString::fromLatin1("app/native/%1").arg(path); +#elif !defined(Q_OS_ANDROID) + QString pathInInstallDir = + QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); + if (QFileInfo(pathInInstallDir).exists()) + return pathInInstallDir; + pathInInstallDir = + QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); + if (QFileInfo(pathInInstallDir).exists()) + return pathInInstallDir; +#endif + return path; +} + +QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent) + : QQuickView(parent) + , d(new QtQuick2ApplicationViewerPrivate()) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QQuickView::SizeRootObjectToView); +} + +QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer() +{ + delete d; +} + +void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file) +{ + d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file); +#ifdef Q_OS_ANDROID + setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); +#else + setSource(QUrl::fromLocalFile(d->mainQmlFile)); +#endif +} + +void QtQuick2ApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path)); +} + +void QtQuick2ApplicationViewer::showExpanded() +{ +#if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX) + showFullScreen(); +#else + show(); +#endif +} diff --git a/examples/qmlmaps/qtquick2applicationviewer/qtquick2applicationviewer.h b/examples/qmlmaps/qtquick2applicationviewer/qtquick2applicationviewer.h new file mode 100644 index 00000000..cf66f140 --- /dev/null +++ b/examples/qmlmaps/qtquick2applicationviewer/qtquick2applicationviewer.h @@ -0,0 +1,33 @@ +// checksum 0xfde6 version 0x90005 +/* + This file was generated by the Qt Quick 2 Application wizard of Qt Creator. + QtQuick2ApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QTQUICK2APPLICATIONVIEWER_H +#define QTQUICK2APPLICATIONVIEWER_H + +#include <QtQuick/QQuickView> + +class QtQuick2ApplicationViewer : public QQuickView +{ + Q_OBJECT + +public: + explicit QtQuick2ApplicationViewer(QWindow *parent = 0); + virtual ~QtQuick2ApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + + void showExpanded(); + +private: + class QtQuick2ApplicationViewerPrivate *d; +}; + +#endif // QTQUICK2APPLICATIONVIEWER_H diff --git a/examples/qmlmaps/qtquick2applicationviewer/qtquick2applicationviewer.pri b/examples/qmlmaps/qtquick2applicationviewer/qtquick2applicationviewer.pri new file mode 100644 index 00000000..e5f7990f --- /dev/null +++ b/examples/qmlmaps/qtquick2applicationviewer/qtquick2applicationviewer.pri @@ -0,0 +1,180 @@ +# checksum 0x7b0d version 0x90005 +# This file was generated by the Qt Quick 2 Application wizard of Qt Creator. +# The code below adds the QtQuick2ApplicationViewer to the project and handles +# the activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += qml quick + +SOURCES += $$PWD/qtquick2applicationviewer.cpp +HEADERS += $$PWD/qtquick2applicationviewer.h +INCLUDEPATH += $$PWD +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Android and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + greaterThan(QT_MAJOR_VERSION, 4) { + itemsources = $${item}.files + } else { + itemsources = $${item}.sources + } + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +android-no-sdk { + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = /data/user/qt/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + + target.path = /data/user/qt + + export(target.path) + INSTALLS += target +} else:android { + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = /assets/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + + x86 { + target.path = /libs/x86 + } else: armeabi-v7a { + target.path = /libs/armeabi-v7a + } else { + target.path = /libs/armeabi + } + + export(target.path) + INSTALLS += target +} else:win32 { + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, /, \\) + sourcePathSegments = $$split(source, \\) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments) + target = $$replace(target, /, \\) + target ~= s,\\\\\\.?\\\\,\\, + !isEqual(source,$$target) { + !isEmpty(copyCommand):copyCommand += && + isEqual(QMAKE_DIR_SEP, \\) { + copyCommand += $(COPY_DIR) \"$$source\" \"$$target\" + } else { + source = $$replace(source, \\\\, /) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + target = $$replace(target, \\\\, /) + copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\" + } + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + desktopfile.files = $${TARGET}.desktop + desktopfile.path = /usr/share/applications/hildon + icon.files = $${TARGET}64.png + icon.path = /usr/share/icons/hicolor/64x64/apps + } else:!isEmpty(MEEGO_VERSION_MAJOR) { + desktopfile.files = $${TARGET}_harmattan.desktop + desktopfile.path = /usr/share/applications + icon.files = $${TARGET}80.png + icon.path = /usr/share/icons/hicolor/80x80/apps + } else { # Assumed to be a Desktop Unix + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, \\\\, /) + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + target = $$replace(target, \\\\, /) + sourcePathSegments = $$split(source, /) + targetFullPath = $$target/$$last(sourcePathSegments) + targetFullPath ~= s,/\\.?/,/, + !isEqual(source,$$targetFullPath) { + !isEmpty(copyCommand):copyCommand += && + copyCommand += $(MKDIR) \"$$target\" + copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\" + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + !isEmpty(target.path) { + installPrefix = $${target.path} + } else { + installPrefix = /opt/$${TARGET} + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + + !isEmpty(desktopfile.path) { + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + INSTALLS += icon desktopfile + } + + isEmpty(target.path) { + target.path = $${installPrefix}/bin + export(target.path) + } + INSTALLS += target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/qmlscatter/doc/src/qmlscatter.qdoc b/examples/qmlscatter/doc/src/qmlscatter.qdoc new file mode 100644 index 00000000..d52798c2 --- /dev/null +++ b/examples/qmlscatter/doc/src/qmlscatter.qdoc @@ -0,0 +1,29 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +/*! + \example qmlscatter + \title Qt Quick 2 Scatter Example + + The Qt Quick 2 scatter example shows how to make a simple scatter chart visualization using + Q3DScatter using Qt Quick 2. + + \image qmlscatter-example.png + + TODO +*/ diff --git a/examples/qmlscatter/main.cpp b/examples/qmlscatter/main.cpp new file mode 100644 index 00000000..d48bea3d --- /dev/null +++ b/examples/qmlscatter/main.cpp @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include <QtGui/QGuiApplication> +#include "qtquick2applicationviewer.h" +#ifdef Q_OS_ANDROID +#include <QDir> +#include <QQmlEngine> +#endif +#include <QDebug> + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QtQuick2ApplicationViewer viewer; +#ifdef Q_OS_ANDROID + viewer.addImportPath(QString::fromLatin1("assets:/qml")); + viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), + QString::fromLatin1("lib"))); +#else + viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), + QString::fromLatin1("qml"))); +#endif + viewer.setSource(QUrl("qrc:/qml/main.qml")); + viewer.setResizeMode(QQuickView::SizeRootObjectToView); + viewer.setMinimumSize(QSize(640, 480)); + viewer.show(); + + return app.exec(); +} diff --git a/examples/qmlscatter/qml/qmlscatter/main.qml b/examples/qmlscatter/qml/qmlscatter/main.qml new file mode 100644 index 00000000..6238529d --- /dev/null +++ b/examples/qmlscatter/qml/qmlscatter/main.qml @@ -0,0 +1,209 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.0 +import com.digia.QtDataVis3D 1.0 + +Item { + id: mainview + width: 800 + height: 700 + visible: true + + Item { + id: dataView + width: parent.width + height: parent.height - shadowToggle.height + anchors.bottom: parent.bottom + + ScatterDataMapping { + id: scatterMapping + xPosRole: "xPos" + yPosRole: "yPos" + zPosRole: "zPos" + } + + ListModel { + id: dataModel + ListElement{ xPos: -10.0; yPos: 4.9; zPos: -5.0 } + ListElement{ xPos: 10.0; yPos: 4.9; zPos: -5.0 } + ListElement{ xPos: -10.0; yPos: 4.9; zPos: 5.0 } + ListElement{ xPos: 10.0; yPos: 4.9; zPos: 5.0 } + ListElement{ xPos: -10.0; yPos: -4.9; zPos: -5.0 } + ListElement{ xPos: 10.0; yPos: -4.9; zPos: -5.0 } + ListElement{ xPos: -10.0; yPos: -4.9; zPos: 5.0 } + ListElement{ xPos: 10.0; yPos: -4.9; zPos: 5.0 } + + ListElement{ xPos: -1.0; yPos: 0.3; zPos: -0.5 } + ListElement{ xPos: 1.0; yPos: 2.105; zPos: 0.5 } + ListElement{ xPos: 0.5; yPos: -0.65; zPos: -0.5 } + ListElement{ xPos: -0.5; yPos: 1.225; zPos: 0.5 } + ListElement{ xPos: 0.0; yPos: 0.0; zPos: 0.0 } + ListElement{ xPos: 0.0; yPos: 2.0; zPos: 0.0 } + ListElement{ xPos: 0.0; yPos: -0.5; zPos: 0.0 } + + ListElement{ xPos: 6.0; yPos: 0.0; zPos: 4.0 } + ListElement{ xPos: 5.8; yPos: 0.2; zPos: 5.0 } + ListElement{ xPos: 5.6; yPos: 0.4; zPos: 4.5 } + ListElement{ xPos: 5.4; yPos: 0.6; zPos: 3.8 } + ListElement{ xPos: 5.2; yPos: 0.8; zPos: 4.8 } + ListElement{ xPos: 5.0; yPos: 0.3; zPos: 4.1 } + ListElement{ xPos: 4.9; yPos: -0.3; zPos: 4.9 } + ListElement{ xPos: 4.7; yPos: -0.5; zPos: 3.5 } + ListElement{ xPos: 4.5; yPos: -0.7; zPos: 3.3 } + ListElement{ xPos: 4.3; yPos: -0.4; zPos: 3.7 } + } + + Scatter3D { + id: testscatter + width: dataView.width + height: dataView.height + fontSize: 30.0 + mapping: scatterMapping + shadowQuality: Scatter3D.ShadowNone + selectionMode: Scatter3D.ModeItem + labelTransparency: Scatter3D.TransparencyNoBackground + + Component.onCompleted: { + console.log("testscatter complete"); + data = dataModel + } + } + } + + Rectangle { + id: shadowToggle + width: 120 + height: 30 + + TextArea { + id: shadowText + text: "Toggle Shadows On" + anchors.fill: parent + } + + MouseArea { + anchors.fill: parent + onClicked: { + if (testscatter.shadowQuality === Scatter3D.ShadowNone) { + testscatter.shadowQuality = Scatter3D.ShadowMedium; + shadowText.text = "Toggle Shadows Off"; + } else { + testscatter.shadowQuality = Scatter3D.ShadowNone; + shadowText.text = "Toggle Shadows On"; + } + } + } + } + Rectangle { + id: smoothToggle + width: 140 + height: 30 + anchors.left: shadowToggle.right + + TextArea { + id: smoothText + text: "Toggle Smooth Objects On" + anchors.fill: parent + } + + MouseArea { + anchors.fill: parent + onClicked: { + if (testscatter.objectSmooth === false) { + smoothText.text = "Toggle Smooth Objects Off" + testscatter.objectSmooth = true; + } else { + smoothText.text = "Toggle Smooth Objects On" + testscatter.objectSmooth = false; + } + } + } + } + Rectangle { + id: cameraToggle + width: 130 + height: 30 + anchors.left: smoothToggle.right + + TextArea { + text: "Toggle Camera Preset" + anchors.fill: parent + } + + MouseArea { + anchors.fill: parent + onClicked: { + if (testscatter.cameraPreset === Scatter3D.PresetFront) { + testscatter.cameraPreset = Scatter3D.PresetIsometricRightHigh; + } else { + testscatter.cameraPreset = Scatter3D.PresetFront; + } + } + } + } + Rectangle { + id: themeToggle + width: 120 + height: 30 + anchors.left: cameraToggle.right + + TextArea { + text: "Toggle Theme" + anchors.fill: parent + } + + MouseArea { + anchors.fill: parent + onClicked: { + if (testscatter.theme === Scatter3D.ThemeBlueCerulean) { + testscatter.theme = Scatter3D.ThemeSystem; + } else { + testscatter.theme = Scatter3D.ThemeBlueCerulean; + } + } + } + } + Rectangle { + id: backgroundToggle + width: 130 + height: 30 + anchors.left: themeToggle.right + + TextArea { + id: backgroundText + text: "Toggle Background Off" + anchors.fill: parent + } + + MouseArea { + anchors.fill: parent + onClicked: { + if (testscatter.backgroundVisible === true) { + testscatter.backgroundVisible = false; + backgroundText.text = "Toggle Background On"; + } else { + testscatter.backgroundVisible = true; + backgroundText.text = "Toggle Background Off"; + } + } + } + } + +} diff --git a/examples/qmlscatter/qmlscatter.desktop b/examples/qmlscatter/qmlscatter.desktop new file mode 100644 index 00000000..0f9e5498 --- /dev/null +++ b/examples/qmlscatter/qmlscatter.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=qmlscatter +Exec=/opt/qmlscatter/bin/qmlscatter +Icon=qmlscatter64 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qmlscatter/qmlscatter.pro b/examples/qmlscatter/qmlscatter.pro new file mode 100644 index 00000000..6f89fbae --- /dev/null +++ b/examples/qmlscatter/qmlscatter.pro @@ -0,0 +1,23 @@ +!include( ../examples.pri ) { + error( "Couldn't find the examples.pri file!" ) +} + +# Add more folders to ship with the application, here +folder_01.source = qml/qmlscatter +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Installation path +# target.path = + +# Please do not modify the following two lines. Required for deployment. +include(qtquick2applicationviewer/qtquick2applicationviewer.pri) +qtcAddDeployment() + +RESOURCES += qmlscatter.qrc diff --git a/examples/qmlscatter/qmlscatter.qrc b/examples/qmlscatter/qmlscatter.qrc new file mode 100644 index 00000000..62f5931b --- /dev/null +++ b/examples/qmlscatter/qmlscatter.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/qml"> + <file alias="main.qml">qml/qmlscatter/main.qml</file> + </qresource> +</RCC> diff --git a/examples/qmlscatter/qmlscatter64.png b/examples/qmlscatter/qmlscatter64.png Binary files differnew file mode 100644 index 00000000..707d5c4e --- /dev/null +++ b/examples/qmlscatter/qmlscatter64.png diff --git a/examples/qmlscatter/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/examples/qmlscatter/qtquick2applicationviewer/qtquick2applicationviewer.cpp new file mode 100644 index 00000000..10709d7a --- /dev/null +++ b/examples/qmlscatter/qtquick2applicationviewer/qtquick2applicationviewer.cpp @@ -0,0 +1,81 @@ +// checksum 0x4f6f version 0x90005 +/* + This file was generated by the Qt Quick 2 Application wizard of Qt Creator. + QtQuick2ApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qtquick2applicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtQml/QQmlEngine> + +class QtQuick2ApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QtQuick2ApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path) +{ +#if defined(Q_OS_MAC) + if (!QDir::isAbsolutePath(path)) + return QString::fromLatin1("%1/../Resources/%2") + .arg(QCoreApplication::applicationDirPath(), path); +#elif defined(Q_OS_BLACKBERRY) + if (!QDir::isAbsolutePath(path)) + return QString::fromLatin1("app/native/%1").arg(path); +#elif !defined(Q_OS_ANDROID) + QString pathInInstallDir = + QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); + if (QFileInfo(pathInInstallDir).exists()) + return pathInInstallDir; + pathInInstallDir = + QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); + if (QFileInfo(pathInInstallDir).exists()) + return pathInInstallDir; +#endif + return path; +} + +QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent) + : QQuickView(parent) + , d(new QtQuick2ApplicationViewerPrivate()) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QQuickView::SizeRootObjectToView); +} + +QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer() +{ + delete d; +} + +void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file) +{ + d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file); +#ifdef Q_OS_ANDROID + setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); +#else + setSource(QUrl::fromLocalFile(d->mainQmlFile)); +#endif +} + +void QtQuick2ApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path)); +} + +void QtQuick2ApplicationViewer::showExpanded() +{ +#if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX) + showFullScreen(); +#else + show(); +#endif +} diff --git a/examples/qmlscatter/qtquick2applicationviewer/qtquick2applicationviewer.h b/examples/qmlscatter/qtquick2applicationviewer/qtquick2applicationviewer.h new file mode 100644 index 00000000..cf66f140 --- /dev/null +++ b/examples/qmlscatter/qtquick2applicationviewer/qtquick2applicationviewer.h @@ -0,0 +1,33 @@ +// checksum 0xfde6 version 0x90005 +/* + This file was generated by the Qt Quick 2 Application wizard of Qt Creator. + QtQuick2ApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QTQUICK2APPLICATIONVIEWER_H +#define QTQUICK2APPLICATIONVIEWER_H + +#include <QtQuick/QQuickView> + +class QtQuick2ApplicationViewer : public QQuickView +{ + Q_OBJECT + +public: + explicit QtQuick2ApplicationViewer(QWindow *parent = 0); + virtual ~QtQuick2ApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + + void showExpanded(); + +private: + class QtQuick2ApplicationViewerPrivate *d; +}; + +#endif // QTQUICK2APPLICATIONVIEWER_H diff --git a/examples/qmlscatter/qtquick2applicationviewer/qtquick2applicationviewer.pri b/examples/qmlscatter/qtquick2applicationviewer/qtquick2applicationviewer.pri new file mode 100644 index 00000000..e5f7990f --- /dev/null +++ b/examples/qmlscatter/qtquick2applicationviewer/qtquick2applicationviewer.pri @@ -0,0 +1,180 @@ +# checksum 0x7b0d version 0x90005 +# This file was generated by the Qt Quick 2 Application wizard of Qt Creator. +# The code below adds the QtQuick2ApplicationViewer to the project and handles +# the activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += qml quick + +SOURCES += $$PWD/qtquick2applicationviewer.cpp +HEADERS += $$PWD/qtquick2applicationviewer.h +INCLUDEPATH += $$PWD +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Android and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + greaterThan(QT_MAJOR_VERSION, 4) { + itemsources = $${item}.files + } else { + itemsources = $${item}.sources + } + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +android-no-sdk { + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = /data/user/qt/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + + target.path = /data/user/qt + + export(target.path) + INSTALLS += target +} else:android { + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = /assets/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + + x86 { + target.path = /libs/x86 + } else: armeabi-v7a { + target.path = /libs/armeabi-v7a + } else { + target.path = /libs/armeabi + } + + export(target.path) + INSTALLS += target +} else:win32 { + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, /, \\) + sourcePathSegments = $$split(source, \\) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments) + target = $$replace(target, /, \\) + target ~= s,\\\\\\.?\\\\,\\, + !isEqual(source,$$target) { + !isEmpty(copyCommand):copyCommand += && + isEqual(QMAKE_DIR_SEP, \\) { + copyCommand += $(COPY_DIR) \"$$source\" \"$$target\" + } else { + source = $$replace(source, \\\\, /) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + target = $$replace(target, \\\\, /) + copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\" + } + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + desktopfile.files = $${TARGET}.desktop + desktopfile.path = /usr/share/applications/hildon + icon.files = $${TARGET}64.png + icon.path = /usr/share/icons/hicolor/64x64/apps + } else:!isEmpty(MEEGO_VERSION_MAJOR) { + desktopfile.files = $${TARGET}_harmattan.desktop + desktopfile.path = /usr/share/applications + icon.files = $${TARGET}80.png + icon.path = /usr/share/icons/hicolor/80x80/apps + } else { # Assumed to be a Desktop Unix + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, \\\\, /) + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + target = $$replace(target, \\\\, /) + sourcePathSegments = $$split(source, /) + targetFullPath = $$target/$$last(sourcePathSegments) + targetFullPath ~= s,/\\.?/,/, + !isEqual(source,$$targetFullPath) { + !isEmpty(copyCommand):copyCommand += && + copyCommand += $(MKDIR) \"$$target\" + copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\" + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + !isEmpty(target.path) { + installPrefix = $${target.path} + } else { + installPrefix = /opt/$${TARGET} + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + + !isEmpty(desktopfile.path) { + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + INSTALLS += icon desktopfile + } + + isEmpty(target.path) { + target.path = $${installPrefix}/bin + export(target.path) + } + INSTALLS += target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/rainfall/data/raindata.txt b/examples/rainfall/data/raindata.txt new file mode 100644 index 00000000..7f581bff --- /dev/null +++ b/examples/rainfall/data/raindata.txt @@ -0,0 +1,1358 @@ +# Fictitious rainfall per month from 1900 to 2012 in three cities +# Format: year, month, city 1 rainfall, city 2 rainfall, city 3 rainfall +1900, 1, 58, 60, 40 +1900, 2, 48, 101, 47 +1900, 3, 58, 90, 25 +1900, 4, 59, 81, 33 +1900, 5, 51, 90, 24 +1900, 6, 91, 92, 55 +1900, 7, 92, 124, 34 +1900, 8, 89, 124, 30 +1900, 9, 50, 89, 16 +1900, 10, 69, 100, 55 +1900, 11, 78, 86, 15 +1900, 12, 63, 62, 30 +1901, 1, 34, 56, 50 +1901, 2, 31, 93, 54 +1901, 3, 72, 98, 34 +1901, 4, 88, 104, 18 +1901, 5, 66, 107, 20 +1901, 6, 121, 123, 34 +1901, 7, 100, 133, 46 +1901, 8, 129, 90, 64 +1901, 9, 98, 75, 56 +1901, 10, 77, 84, 56 +1901, 11, 42, 62, 38 +1901, 12, 62, 94, 22 +1902, 1, 58, 80, 37 +1902, 2, 43, 56, 16 +1902, 3, 53, 92, 9 +1902, 4, 81, 87, 33 +1902, 5, 85, 86, 60 +1902, 6, 98, 98, 32 +1902, 7, 100, 100, 54 +1902, 8, 107, 116, 69 +1902, 9, 86, 101, 43 +1902, 10, 71, 112, 34 +1902, 11, 43, 61, 7 +1902, 12, 30, 77, 21 +1903, 1, 38, 89, 12 +1903, 2, 43, 95, 29 +1903, 3, 67, 81, 49 +1903, 4, 59, 104, 32 +1903, 5, 79, 80, 64 +1903, 6, 117, 123, 53 +1903, 7, 104, 101, 49 +1903, 8, 111, 137, 56 +1903, 9, 68, 72, 23 +1903, 10, 81, 100, 62 +1903, 11, 68, 67, 50 +1903, 12, 34, 76, 42 +1904, 1, 65, 66, 33 +1904, 2, 41, 95, 18 +1904, 3, 46, 101, 31 +1904, 4, 53, 72, 32 +1904, 5, 82, 104, 52 +1904, 6, 123, 102, 32 +1904, 7, 109, 127, 30 +1904, 8, 100, 114, 67 +1904, 9, 91, 99, 45 +1904, 10, 79, 84, 62 +1904, 11, 38, 86, 30 +1904, 12, 71, 56, 14 +1905, 1, 59, 64, 39 +1905, 2, 75, 73, 32 +1905, 3, 30, 102, 36 +1905, 4, 86, 83, 39 +1905, 5, 93, 66, 31 +1905, 6, 118, 137, 36 +1905, 7, 129, 95, 31 +1905, 8, 104, 128, 56 +1905, 9, 59, 87, 61 +1905, 10, 54, 86, 56 +1905, 11, 46, 78, 51 +1905, 12, 57, 94, 47 +1906, 1, 75, 79, 17 +1906, 2, 72, 91, 44 +1906, 3, 52, 77, 32 +1906, 4, 63, 94, 41 +1906, 5, 83, 92, 48 +1906, 6, 121, 98, 65 +1906, 7, 93, 129, 60 +1906, 8, 104, 100, 48 +1906, 9, 90, 102, 59 +1906, 10, 58, 74, 42 +1906, 11, 52, 57, 9 +1906, 12, 53, 87, 28 +1907, 1, 74, 82, 50 +1907, 2, 45, 76, 10 +1907, 3, 38, 62, 37 +1907, 4, 58, 93, 59 +1907, 5, 66, 69, 21 +1907, 6, 102, 112, 42 +1907, 7, 125, 129, 30 +1907, 8, 108, 128, 51 +1907, 9, 81, 98, 23 +1907, 10, 58, 84, 45 +1907, 11, 68, 70, 51 +1907, 12, 70, 76, 29 +1908, 1, 49, 75, 11 +1908, 2, 56, 73, 45 +1908, 3, 79, 93, 29 +1908, 4, 93, 82, 39 +1908, 5, 70, 87, 52 +1908, 6, 113, 107, 34 +1908, 7, 120, 97, 40 +1908, 8, 92, 95, 74 +1908, 9, 88, 83, 16 +1908, 10, 57, 67, 33 +1908, 11, 30, 55, 12 +1908, 12, 37, 85, 54 +1909, 1, 67, 79, 47 +1909, 2, 68, 101, 7 +1909, 3, 59, 94, 14 +1909, 4, 58, 93, 49 +1909, 5, 79, 71, 32 +1909, 6, 129, 126, 68 +1909, 7, 82, 138, 52 +1909, 8, 96, 124, 73 +1909, 9, 85, 72, 27 +1909, 10, 92, 107, 61 +1909, 11, 42, 97, 51 +1909, 12, 31, 96, 33 +1910, 1, 71, 104, 27 +1910, 2, 76, 103, 6 +1910, 3, 53, 70, 13 +1910, 4, 71, 102, 37 +1910, 5, 63, 96, 34 +1910, 6, 112, 106, 59 +1910, 7, 81, 94, 28 +1910, 8, 98, 107, 26 +1910, 9, 63, 77, 21 +1910, 10, 60, 72, 39 +1910, 11, 36, 66, 12 +1910, 12, 62, 99, 36 +1911, 1, 78, 101, 48 +1911, 2, 35, 61, 38 +1911, 3, 48, 86, 24 +1911, 4, 78, 93, 31 +1911, 5, 90, 92, 49 +1911, 6, 89, 115, 64 +1911, 7, 129, 90, 46 +1911, 8, 88, 116, 35 +1911, 9, 91, 109, 64 +1911, 10, 95, 78, 45 +1911, 11, 55, 103, 8 +1911, 12, 36, 79, 10 +1912, 1, 30, 90, 15 +1912, 2, 49, 76, 37 +1912, 3, 79, 68, 45 +1912, 4, 74, 90, 52 +1912, 5, 61, 99, 30 +1912, 6, 112, 93, 39 +1912, 7, 88, 110, 48 +1912, 8, 99, 138, 47 +1912, 9, 92, 93, 56 +1912, 10, 86, 98, 46 +1912, 11, 31, 104, 14 +1912, 12, 60, 101, 19 +1913, 1, 71, 103, 37 +1913, 2, 42, 104, 26 +1913, 3, 68, 66, 31 +1913, 4, 81, 108, 57 +1913, 5, 77, 88, 64 +1913, 6, 98, 94, 46 +1913, 7, 127, 111, 36 +1913, 8, 91, 95, 48 +1913, 9, 51, 110, 23 +1913, 10, 77, 73, 46 +1913, 11, 36, 103, 11 +1913, 12, 45, 66, 40 +1914, 1, 55, 78, 21 +1914, 2, 40, 80, 6 +1914, 3, 71, 84, 12 +1914, 4, 56, 111, 23 +1914, 5, 79, 84, 17 +1914, 6, 124, 105, 62 +1914, 7, 121, 95, 68 +1914, 8, 81, 121, 37 +1914, 9, 64, 65, 52 +1914, 10, 56, 106, 27 +1914, 11, 53, 97, 52 +1914, 12, 75, 104, 39 +1915, 1, 37, 86, 6 +1915, 2, 74, 85, 30 +1915, 3, 75, 77, 49 +1915, 4, 72, 104, 37 +1915, 5, 88, 95, 41 +1915, 6, 111, 122, 53 +1915, 7, 112, 108, 43 +1915, 8, 119, 107, 51 +1915, 9, 85, 95, 43 +1915, 10, 76, 69, 48 +1915, 11, 42, 88, 48 +1915, 12, 42, 68, 13 +1916, 1, 70, 100, 30 +1916, 2, 64, 77, 10 +1916, 3, 45, 104, 26 +1916, 4, 74, 98, 53 +1916, 5, 52, 86, 26 +1916, 6, 105, 139, 56 +1916, 7, 123, 90, 36 +1916, 8, 87, 99, 32 +1916, 9, 73, 107, 30 +1916, 10, 79, 109, 51 +1916, 11, 45, 69, 43 +1916, 12, 62, 85, 11 +1917, 1, 73, 87, 5 +1917, 2, 61, 102, 18 +1917, 3, 48, 71, 50 +1917, 4, 83, 95, 33 +1917, 5, 97, 102, 38 +1917, 6, 117, 114, 66 +1917, 7, 127, 107, 66 +1917, 8, 120, 101, 36 +1917, 9, 79, 102, 44 +1917, 10, 56, 114, 38 +1917, 11, 66, 69, 36 +1917, 12, 33, 71, 52 +1918, 1, 67, 76, 42 +1918, 2, 71, 95, 33 +1918, 3, 51, 56, 28 +1918, 4, 95, 66, 50 +1918, 5, 77, 92, 51 +1918, 6, 91, 92, 64 +1918, 7, 103, 97, 51 +1918, 8, 90, 116, 55 +1918, 9, 72, 108, 34 +1918, 10, 60, 76, 55 +1918, 11, 63, 100, 44 +1918, 12, 30, 65, 12 +1919, 1, 58, 89, 48 +1919, 2, 45, 102, 29 +1919, 3, 48, 101, 47 +1919, 4, 68, 105, 64 +1919, 5, 71, 112, 18 +1919, 6, 129, 90, 73 +1919, 7, 120, 95, 73 +1919, 8, 96, 109, 35 +1919, 9, 70, 92, 20 +1919, 10, 61, 90, 41 +1919, 11, 37, 103, 6 +1919, 12, 70, 95, 25 +1920, 1, 43, 86, 52 +1920, 2, 69, 87, 51 +1920, 3, 61, 79, 27 +1920, 4, 65, 103, 51 +1920, 5, 60, 66, 21 +1920, 6, 80, 129, 50 +1920, 7, 106, 127, 56 +1920, 8, 110, 120, 39 +1920, 9, 71, 110, 64 +1920, 10, 79, 78, 58 +1920, 11, 51, 69, 41 +1920, 12, 56, 83, 8 +1921, 1, 65, 94, 10 +1921, 2, 32, 61, 44 +1921, 3, 76, 75, 24 +1921, 4, 52, 76, 55 +1921, 5, 50, 81, 46 +1921, 6, 128, 123, 48 +1921, 7, 92, 122, 38 +1921, 8, 102, 107, 50 +1921, 9, 93, 88, 44 +1921, 10, 96, 92, 24 +1921, 11, 64, 90, 38 +1921, 12, 34, 58, 38 +1922, 1, 75, 68, 50 +1922, 2, 40, 89, 29 +1922, 3, 31, 72, 46 +1922, 4, 80, 101, 22 +1922, 5, 94, 89, 61 +1922, 6, 85, 100, 65 +1922, 7, 111, 132, 32 +1922, 8, 83, 110, 45 +1922, 9, 81, 90, 32 +1922, 10, 60, 88, 22 +1922, 11, 45, 59, 37 +1922, 12, 34, 73, 36 +1923, 1, 46, 92, 47 +1923, 2, 75, 73, 5 +1923, 3, 58, 65, 21 +1923, 4, 83, 99, 47 +1923, 5, 64, 71, 37 +1923, 6, 124, 120, 57 +1923, 7, 114, 132, 32 +1923, 8, 113, 136, 56 +1923, 9, 54, 91, 43 +1923, 10, 57, 107, 26 +1923, 11, 75, 85, 43 +1923, 12, 38, 71, 29 +1924, 1, 66, 95, 49 +1924, 2, 72, 92, 48 +1924, 3, 34, 86, 17 +1924, 4, 58, 69, 23 +1924, 5, 77, 71, 25 +1924, 6, 117, 125, 27 +1924, 7, 105, 105, 33 +1924, 8, 83, 124, 25 +1924, 9, 99, 107, 57 +1924, 10, 55, 75, 59 +1924, 11, 47, 93, 5 +1924, 12, 71, 73, 46 +1925, 1, 30, 78, 41 +1925, 2, 33, 59, 48 +1925, 3, 39, 59, 8 +1925, 4, 82, 82, 35 +1925, 5, 65, 76, 21 +1925, 6, 99, 97, 62 +1925, 7, 82, 104, 63 +1925, 8, 116, 111, 67 +1925, 9, 97, 82, 25 +1925, 10, 63, 78, 55 +1925, 11, 32, 86, 50 +1925, 12, 52, 63, 13 +1926, 1, 76, 94, 52 +1926, 2, 50, 62, 34 +1926, 3, 41, 95, 52 +1926, 4, 84, 68, 17 +1926, 5, 52, 76, 33 +1926, 6, 97, 125, 49 +1926, 7, 92, 137, 37 +1926, 8, 90, 127, 30 +1926, 9, 60, 98, 42 +1926, 10, 54, 113, 33 +1926, 11, 62, 91, 52 +1926, 12, 62, 87, 48 +1927, 1, 54, 64, 30 +1927, 2, 60, 99, 30 +1927, 3, 45, 81, 36 +1927, 4, 61, 82, 58 +1927, 5, 57, 65, 57 +1927, 6, 125, 90, 56 +1927, 7, 104, 132, 68 +1927, 8, 127, 96, 66 +1927, 9, 77, 96, 15 +1927, 10, 68, 95, 55 +1927, 11, 55, 76, 38 +1927, 12, 78, 82, 36 +1928, 1, 67, 56, 45 +1928, 2, 51, 96, 51 +1928, 3, 63, 72, 15 +1928, 4, 85, 85, 30 +1928, 5, 54, 72, 46 +1928, 6, 90, 100, 26 +1928, 7, 103, 133, 29 +1928, 8, 94, 110, 29 +1928, 9, 71, 103, 63 +1928, 10, 79, 69, 62 +1928, 11, 49, 55, 24 +1928, 12, 33, 63, 12 +1929, 1, 48, 62, 20 +1929, 2, 77, 62, 51 +1929, 3, 70, 75, 8 +1929, 4, 83, 81, 23 +1929, 5, 64, 92, 56 +1929, 6, 126, 106, 35 +1929, 7, 96, 118, 45 +1929, 8, 80, 120, 46 +1929, 9, 94, 88, 62 +1929, 10, 50, 102, 33 +1929, 11, 62, 76, 47 +1929, 12, 70, 68, 33 +1930, 1, 51, 100, 30 +1930, 2, 60, 57, 46 +1930, 3, 65, 78, 38 +1930, 4, 70, 67, 37 +1930, 5, 83, 106, 62 +1930, 6, 127, 126, 51 +1930, 7, 108, 137, 61 +1930, 8, 81, 117, 69 +1930, 9, 51, 93, 37 +1930, 10, 56, 78, 63 +1930, 11, 38, 65, 18 +1930, 12, 32, 72, 19 +1931, 1, 76, 57, 15 +1931, 2, 62, 71, 53 +1931, 3, 32, 70, 25 +1931, 4, 76, 96, 51 +1931, 5, 85, 76, 61 +1931, 6, 112, 111, 57 +1931, 7, 85, 108, 42 +1931, 8, 125, 114, 29 +1931, 9, 89, 92, 27 +1931, 10, 95, 83, 19 +1931, 11, 34, 103, 25 +1931, 12, 33, 102, 50 +1932, 1, 38, 87, 6 +1932, 2, 66, 101, 15 +1932, 3, 40, 63, 27 +1932, 4, 60, 107, 15 +1932, 5, 98, 83, 27 +1932, 6, 122, 104, 48 +1932, 7, 92, 137, 46 +1932, 8, 104, 129, 29 +1932, 9, 63, 95, 39 +1932, 10, 76, 83, 35 +1932, 11, 62, 65, 43 +1932, 12, 75, 78, 7 +1933, 1, 71, 90, 7 +1933, 2, 72, 67, 32 +1933, 3, 32, 102, 25 +1933, 4, 67, 107, 39 +1933, 5, 78, 95, 43 +1933, 6, 115, 104, 33 +1933, 7, 127, 135, 74 +1933, 8, 99, 137, 52 +1933, 9, 57, 94, 51 +1933, 10, 76, 96, 28 +1933, 11, 40, 70, 12 +1933, 12, 30, 64, 12 +1934, 1, 70, 62, 35 +1934, 2, 34, 71, 7 +1934, 3, 66, 96, 7 +1934, 4, 60, 75, 36 +1934, 5, 67, 110, 15 +1934, 6, 93, 124, 31 +1934, 7, 123, 109, 69 +1934, 8, 80, 97, 57 +1934, 9, 69, 82, 51 +1934, 10, 95, 67, 53 +1934, 11, 61, 65, 24 +1934, 12, 71, 82, 14 +1935, 1, 53, 59, 46 +1935, 2, 36, 76, 7 +1935, 3, 66, 102, 7 +1935, 4, 80, 85, 55 +1935, 5, 65, 104, 30 +1935, 6, 86, 134, 68 +1935, 7, 128, 109, 44 +1935, 8, 117, 111, 45 +1935, 9, 60, 72, 53 +1935, 10, 56, 83, 62 +1935, 11, 74, 69, 42 +1935, 12, 49, 100, 11 +1936, 1, 38, 64, 28 +1936, 2, 67, 101, 39 +1936, 3, 33, 65, 54 +1936, 4, 74, 110, 25 +1936, 5, 62, 69, 39 +1936, 6, 107, 101, 73 +1936, 7, 102, 90, 47 +1936, 8, 88, 135, 47 +1936, 9, 62, 88, 32 +1936, 10, 96, 102, 19 +1936, 11, 72, 59, 51 +1936, 12, 56, 66, 45 +1937, 1, 50, 80, 23 +1937, 2, 56, 86, 39 +1937, 3, 30, 79, 16 +1937, 4, 69, 100, 19 +1937, 5, 99, 114, 22 +1937, 6, 128, 92, 33 +1937, 7, 128, 98, 44 +1937, 8, 92, 133, 56 +1937, 9, 67, 89, 17 +1937, 10, 79, 89, 40 +1937, 11, 48, 58, 36 +1937, 12, 79, 96, 51 +1938, 1, 78, 85, 34 +1938, 2, 41, 67, 5 +1938, 3, 41, 57, 45 +1938, 4, 88, 113, 16 +1938, 5, 73, 78, 28 +1938, 6, 92, 100, 42 +1938, 7, 118, 124, 68 +1938, 8, 89, 105, 65 +1938, 9, 73, 110, 45 +1938, 10, 98, 81, 60 +1938, 11, 54, 85, 16 +1938, 12, 70, 65, 42 +1939, 1, 39, 64, 18 +1939, 2, 33, 92, 27 +1939, 3, 39, 100, 34 +1939, 4, 97, 101, 21 +1939, 5, 70, 84, 29 +1939, 6, 103, 126, 57 +1939, 7, 114, 102, 70 +1939, 8, 110, 105, 36 +1939, 9, 99, 79, 54 +1939, 10, 57, 88, 16 +1939, 11, 73, 59, 6 +1939, 12, 46, 78, 22 +1940, 1, 57, 77, 49 +1940, 2, 68, 80, 46 +1940, 3, 73, 100, 5 +1940, 4, 77, 66, 17 +1940, 5, 79, 111, 43 +1940, 6, 112, 125, 65 +1940, 7, 85, 111, 52 +1940, 8, 85, 96, 53 +1940, 9, 58, 75, 53 +1940, 10, 67, 82, 36 +1940, 11, 78, 89, 16 +1940, 12, 62, 104, 10 +1941, 1, 51, 61, 35 +1941, 2, 36, 88, 18 +1941, 3, 73, 65, 11 +1941, 4, 97, 68, 49 +1941, 5, 80, 110, 47 +1941, 6, 100, 112, 64 +1941, 7, 123, 104, 40 +1941, 8, 93, 99, 45 +1941, 9, 86, 99, 33 +1941, 10, 98, 76, 64 +1941, 11, 72, 101, 24 +1941, 12, 77, 78, 40 +1942, 1, 48, 98, 8 +1942, 2, 55, 69, 46 +1942, 3, 36, 77, 24 +1942, 4, 76, 111, 23 +1942, 5, 99, 85, 49 +1942, 6, 83, 125, 72 +1942, 7, 125, 97, 41 +1942, 8, 106, 98, 68 +1942, 9, 87, 105, 35 +1942, 10, 93, 73, 28 +1942, 11, 44, 71, 23 +1942, 12, 58, 92, 47 +1943, 1, 65, 72, 28 +1943, 2, 53, 74, 46 +1943, 3, 56, 76, 33 +1943, 4, 62, 94, 34 +1943, 5, 97, 109, 23 +1943, 6, 105, 95, 41 +1943, 7, 104, 128, 37 +1943, 8, 83, 117, 56 +1943, 9, 56, 97, 58 +1943, 10, 67, 99, 22 +1943, 11, 70, 68, 53 +1943, 12, 52, 89, 20 +1944, 1, 69, 83, 53 +1944, 2, 74, 57, 13 +1944, 3, 57, 67, 13 +1944, 4, 85, 103, 25 +1944, 5, 57, 113, 21 +1944, 6, 116, 102, 60 +1944, 7, 105, 92, 59 +1944, 8, 90, 125, 68 +1944, 9, 73, 93, 32 +1944, 10, 90, 84, 30 +1944, 11, 51, 83, 13 +1944, 12, 36, 82, 41 +1945, 1, 70, 82, 45 +1945, 2, 56, 82, 44 +1945, 3, 55, 103, 21 +1945, 4, 95, 93, 27 +1945, 5, 88, 86, 59 +1945, 6, 127, 98, 25 +1945, 7, 90, 112, 60 +1945, 8, 104, 132, 53 +1945, 9, 87, 96, 29 +1945, 10, 97, 81, 29 +1945, 11, 36, 82, 7 +1945, 12, 47, 72, 6 +1946, 1, 39, 65, 46 +1946, 2, 62, 74, 47 +1946, 3, 75, 83, 20 +1946, 4, 77, 107, 61 +1946, 5, 63, 110, 54 +1946, 6, 92, 131, 55 +1946, 7, 101, 111, 42 +1946, 8, 118, 118, 69 +1946, 9, 74, 109, 58 +1946, 10, 61, 67, 38 +1946, 11, 49, 94, 34 +1946, 12, 73, 81, 27 +1947, 1, 56, 72, 48 +1947, 2, 78, 97, 36 +1947, 3, 57, 102, 51 +1947, 4, 71, 92, 45 +1947, 5, 58, 81, 39 +1947, 6, 93, 136, 53 +1947, 7, 117, 132, 41 +1947, 8, 91, 104, 33 +1947, 9, 65, 95, 40 +1947, 10, 64, 87, 26 +1947, 11, 46, 87, 7 +1947, 12, 43, 78, 10 +1948, 1, 40, 79, 12 +1948, 2, 67, 63, 52 +1948, 3, 73, 66, 24 +1948, 4, 97, 86, 52 +1948, 5, 73, 105, 35 +1948, 6, 99, 129, 69 +1948, 7, 122, 109, 64 +1948, 8, 104, 134, 33 +1948, 9, 62, 79, 62 +1948, 10, 61, 71, 45 +1948, 11, 36, 91, 54 +1948, 12, 51, 95, 25 +1949, 1, 38, 73, 41 +1949, 2, 39, 76, 49 +1949, 3, 77, 84, 53 +1949, 4, 89, 69, 20 +1949, 5, 75, 114, 47 +1949, 6, 100, 117, 73 +1949, 7, 116, 105, 55 +1949, 8, 116, 95, 71 +1949, 9, 69, 98, 55 +1949, 10, 66, 111, 51 +1949, 11, 60, 77, 18 +1949, 12, 56, 97, 53 +1950, 1, 79, 82, 42 +1950, 2, 55, 71, 10 +1950, 3, 59, 104, 23 +1950, 4, 77, 107, 34 +1950, 5, 58, 72, 39 +1950, 6, 101, 139, 42 +1950, 7, 102, 135, 55 +1950, 8, 111, 133, 30 +1950, 9, 61, 89, 15 +1950, 10, 86, 113, 56 +1950, 11, 72, 63, 35 +1950, 12, 59, 80, 23 +1951, 1, 55, 80, 24 +1951, 2, 53, 83, 29 +1951, 3, 71, 68, 24 +1951, 4, 67, 98, 29 +1951, 5, 80, 91, 64 +1951, 6, 96, 108, 51 +1951, 7, 125, 103, 43 +1951, 8, 102, 124, 36 +1951, 9, 61, 77, 17 +1951, 10, 67, 77, 36 +1951, 11, 40, 90, 26 +1951, 12, 64, 69, 38 +1952, 1, 62, 86, 36 +1952, 2, 31, 74, 32 +1952, 3, 65, 70, 35 +1952, 4, 59, 99, 21 +1952, 5, 88, 82, 43 +1952, 6, 124, 94, 66 +1952, 7, 99, 90, 30 +1952, 8, 127, 107, 32 +1952, 9, 54, 74, 53 +1952, 10, 92, 80, 43 +1952, 11, 50, 59, 29 +1952, 12, 79, 87, 8 +1953, 1, 55, 94, 42 +1953, 2, 33, 77, 33 +1953, 3, 55, 70, 5 +1953, 4, 97, 87, 29 +1953, 5, 56, 88, 57 +1953, 6, 83, 116, 41 +1953, 7, 99, 126, 60 +1953, 8, 105, 99, 62 +1953, 9, 66, 79, 39 +1953, 10, 65, 91, 25 +1953, 11, 58, 62, 17 +1953, 12, 40, 78, 31 +1954, 1, 59, 59, 39 +1954, 2, 73, 92, 25 +1954, 3, 67, 86, 18 +1954, 4, 54, 99, 45 +1954, 5, 64, 68, 50 +1954, 6, 122, 102, 35 +1954, 7, 113, 134, 45 +1954, 8, 123, 102, 58 +1954, 9, 84, 102, 32 +1954, 10, 90, 110, 62 +1954, 11, 45, 103, 46 +1954, 12, 62, 96, 53 +1955, 1, 55, 74, 9 +1955, 2, 67, 97, 52 +1955, 3, 42, 62, 15 +1955, 4, 85, 75, 16 +1955, 5, 80, 102, 21 +1955, 6, 81, 103, 52 +1955, 7, 97, 99, 36 +1955, 8, 82, 91, 39 +1955, 9, 98, 95, 44 +1955, 10, 56, 70, 57 +1955, 11, 53, 74, 21 +1955, 12, 32, 100, 47 +1956, 1, 43, 102, 11 +1956, 2, 62, 104, 37 +1956, 3, 64, 64, 13 +1956, 4, 89, 72, 50 +1956, 5, 74, 75, 60 +1956, 6, 114, 95, 61 +1956, 7, 123, 99, 39 +1956, 8, 104, 110, 49 +1956, 9, 81, 87, 22 +1956, 10, 88, 78, 43 +1956, 11, 36, 69, 43 +1956, 12, 53, 88, 43 +1957, 1, 69, 66, 7 +1957, 2, 79, 80, 13 +1957, 3, 38, 98, 10 +1957, 4, 93, 108, 30 +1957, 5, 80, 95, 36 +1957, 6, 125, 124, 52 +1957, 7, 96, 100, 74 +1957, 8, 85, 91, 58 +1957, 9, 81, 93, 24 +1957, 10, 70, 71, 54 +1957, 11, 32, 66, 33 +1957, 12, 49, 75, 45 +1958, 1, 43, 89, 25 +1958, 2, 55, 86, 12 +1958, 3, 73, 84, 31 +1958, 4, 57, 99, 24 +1958, 5, 81, 81, 33 +1958, 6, 108, 118, 27 +1958, 7, 112, 114, 51 +1958, 8, 96, 136, 40 +1958, 9, 77, 105, 44 +1958, 10, 73, 90, 58 +1958, 11, 59, 93, 20 +1958, 12, 47, 73, 54 +1959, 1, 64, 68, 16 +1959, 2, 55, 95, 18 +1959, 3, 71, 64, 49 +1959, 4, 94, 71, 22 +1959, 5, 83, 67, 35 +1959, 6, 95, 130, 38 +1959, 7, 101, 130, 43 +1959, 8, 93, 95, 61 +1959, 9, 58, 100, 48 +1959, 10, 69, 94, 18 +1959, 11, 36, 77, 13 +1959, 12, 60, 81, 26 +1960, 1, 58, 83, 25 +1960, 2, 69, 85, 49 +1960, 3, 43, 57, 36 +1960, 4, 90, 72, 62 +1960, 5, 94, 102, 37 +1960, 6, 121, 128, 65 +1960, 7, 88, 133, 57 +1960, 8, 87, 127, 35 +1960, 9, 62, 79, 39 +1960, 10, 54, 113, 21 +1960, 11, 64, 60, 24 +1960, 12, 54, 68, 18 +1961, 1, 70, 93, 18 +1961, 2, 63, 72, 15 +1961, 3, 43, 102, 19 +1961, 4, 53, 87, 45 +1961, 5, 52, 66, 27 +1961, 6, 110, 100, 58 +1961, 7, 92, 133, 35 +1961, 8, 116, 98, 66 +1961, 9, 93, 82, 29 +1961, 10, 85, 96, 48 +1961, 11, 74, 88, 17 +1961, 12, 32, 77, 31 +1962, 1, 69, 59, 31 +1962, 2, 42, 90, 53 +1962, 3, 33, 79, 22 +1962, 4, 67, 75, 26 +1962, 5, 91, 114, 40 +1962, 6, 118, 134, 72 +1962, 7, 128, 118, 30 +1962, 8, 84, 115, 27 +1962, 9, 75, 82, 38 +1962, 10, 52, 76, 48 +1962, 11, 45, 96, 29 +1962, 12, 71, 103, 15 +1963, 1, 75, 84, 7 +1963, 2, 42, 70, 10 +1963, 3, 36, 66, 41 +1963, 4, 51, 110, 45 +1963, 5, 59, 88, 42 +1963, 6, 118, 126, 41 +1963, 7, 123, 114, 61 +1963, 8, 96, 111, 66 +1963, 9, 91, 109, 30 +1963, 10, 93, 66, 15 +1963, 11, 62, 64, 49 +1963, 12, 68, 91, 22 +1964, 1, 43, 101, 12 +1964, 2, 33, 83, 20 +1964, 3, 36, 100, 12 +1964, 4, 81, 93, 55 +1964, 5, 81, 110, 42 +1964, 6, 93, 127, 37 +1964, 7, 122, 103, 74 +1964, 8, 118, 90, 58 +1964, 9, 76, 71, 57 +1964, 10, 84, 103, 36 +1964, 11, 51, 88, 14 +1964, 12, 56, 88, 22 +1965, 1, 38, 80, 28 +1965, 2, 73, 102, 25 +1965, 3, 67, 81, 13 +1965, 4, 84, 67, 40 +1965, 5, 93, 104, 54 +1965, 6, 92, 127, 58 +1965, 7, 123, 90, 40 +1965, 8, 91, 121, 70 +1965, 9, 55, 111, 54 +1965, 10, 54, 104, 16 +1965, 11, 71, 56, 13 +1965, 12, 45, 100, 44 +1966, 1, 41, 86, 42 +1966, 2, 70, 95, 35 +1966, 3, 37, 89, 16 +1966, 4, 50, 101, 55 +1966, 5, 81, 91, 31 +1966, 6, 111, 91, 72 +1966, 7, 110, 92, 59 +1966, 8, 91, 92, 57 +1966, 9, 60, 80, 60 +1966, 10, 70, 80, 41 +1966, 11, 48, 72, 13 +1966, 12, 48, 95, 37 +1967, 1, 74, 68, 16 +1967, 2, 61, 77, 21 +1967, 3, 62, 103, 20 +1967, 4, 72, 72, 22 +1967, 5, 81, 89, 32 +1967, 6, 88, 122, 67 +1967, 7, 90, 125, 50 +1967, 8, 88, 125, 57 +1967, 9, 59, 94, 20 +1967, 10, 94, 83, 27 +1967, 11, 74, 71, 46 +1967, 12, 72, 93, 50 +1968, 1, 58, 104, 50 +1968, 2, 37, 103, 10 +1968, 3, 68, 94, 10 +1968, 4, 94, 75, 44 +1968, 5, 55, 77, 37 +1968, 6, 85, 111, 61 +1968, 7, 87, 99, 53 +1968, 8, 87, 126, 39 +1968, 9, 64, 104, 44 +1968, 10, 64, 93, 49 +1968, 11, 37, 64, 11 +1968, 12, 40, 63, 19 +1969, 1, 56, 78, 48 +1969, 2, 56, 70, 12 +1969, 3, 32, 75, 11 +1969, 4, 52, 65, 29 +1969, 5, 67, 76, 44 +1969, 6, 107, 119, 61 +1969, 7, 115, 91, 50 +1969, 8, 85, 129, 59 +1969, 9, 60, 100, 19 +1969, 10, 93, 108, 31 +1969, 11, 67, 64, 12 +1969, 12, 47, 81, 44 +1970, 1, 42, 96, 23 +1970, 2, 73, 94, 10 +1970, 3, 34, 79, 54 +1970, 4, 59, 81, 16 +1970, 5, 99, 103, 48 +1970, 6, 82, 108, 51 +1970, 7, 99, 108, 39 +1970, 8, 99, 117, 26 +1970, 9, 96, 98, 44 +1970, 10, 92, 86, 19 +1970, 11, 33, 55, 5 +1970, 12, 78, 95, 29 +1971, 1, 56, 66, 15 +1971, 2, 67, 86, 5 +1971, 3, 77, 85, 17 +1971, 4, 64, 99, 48 +1971, 5, 74, 76, 26 +1971, 6, 94, 134, 32 +1971, 7, 110, 114, 43 +1971, 8, 84, 120, 58 +1971, 9, 85, 100, 21 +1971, 10, 87, 77, 61 +1971, 11, 69, 83, 36 +1971, 12, 51, 61, 9 +1972, 1, 62, 104, 9 +1972, 2, 32, 73, 28 +1972, 3, 77, 84, 46 +1972, 4, 82, 71, 36 +1972, 5, 55, 79, 40 +1972, 6, 124, 118, 74 +1972, 7, 85, 124, 39 +1972, 8, 112, 128, 68 +1972, 9, 51, 95, 24 +1972, 10, 73, 87, 26 +1972, 11, 66, 65, 51 +1972, 12, 65, 85, 10 +1973, 1, 68, 62, 51 +1973, 2, 78, 101, 46 +1973, 3, 43, 97, 5 +1973, 4, 81, 95, 52 +1973, 5, 77, 84, 45 +1973, 6, 103, 131, 42 +1973, 7, 105, 92, 55 +1973, 8, 121, 130, 56 +1973, 9, 82, 104, 35 +1973, 10, 98, 107, 58 +1973, 11, 67, 104, 43 +1973, 12, 63, 91, 51 +1974, 1, 65, 104, 25 +1974, 2, 62, 73, 15 +1974, 3, 69, 97, 42 +1974, 4, 89, 113, 39 +1974, 5, 75, 71, 63 +1974, 6, 112, 108, 51 +1974, 7, 116, 99, 52 +1974, 8, 87, 120, 55 +1974, 9, 77, 72, 16 +1974, 10, 97, 86, 27 +1974, 11, 33, 57, 5 +1974, 12, 43, 88, 40 +1975, 1, 54, 59, 53 +1975, 2, 75, 88, 52 +1975, 3, 50, 59, 21 +1975, 4, 55, 87, 53 +1975, 5, 91, 82, 52 +1975, 6, 96, 125, 51 +1975, 7, 116, 110, 25 +1975, 8, 117, 120, 71 +1975, 9, 98, 85, 36 +1975, 10, 82, 101, 32 +1975, 11, 70, 100, 28 +1975, 12, 32, 92, 24 +1976, 1, 33, 85, 42 +1976, 2, 40, 91, 11 +1976, 3, 69, 99, 5 +1976, 4, 68, 76, 33 +1976, 5, 56, 87, 40 +1976, 6, 113, 110, 67 +1976, 7, 80, 108, 63 +1976, 8, 88, 94, 29 +1976, 9, 84, 73, 26 +1976, 10, 95, 75, 45 +1976, 11, 79, 65, 31 +1976, 12, 75, 59, 37 +1977, 1, 30, 96, 48 +1977, 2, 60, 56, 23 +1977, 3, 60, 104, 50 +1977, 4, 77, 112, 57 +1977, 5, 81, 84, 31 +1977, 6, 129, 108, 64 +1977, 7, 88, 96, 59 +1977, 8, 123, 121, 45 +1977, 9, 89, 82, 41 +1977, 10, 62, 81, 17 +1977, 11, 77, 65, 19 +1977, 12, 48, 82, 14 +1978, 1, 57, 67, 49 +1978, 2, 41, 60, 47 +1978, 3, 33, 77, 43 +1978, 4, 83, 99, 30 +1978, 5, 69, 70, 45 +1978, 6, 107, 130, 49 +1978, 7, 98, 117, 44 +1978, 8, 105, 116, 53 +1978, 9, 66, 99, 18 +1978, 10, 69, 86, 28 +1978, 11, 44, 103, 23 +1978, 12, 70, 95, 15 +1979, 1, 33, 63, 15 +1979, 2, 59, 92, 9 +1979, 3, 39, 64, 7 +1979, 4, 59, 103, 61 +1979, 5, 61, 80, 36 +1979, 6, 99, 124, 70 +1979, 7, 121, 134, 50 +1979, 8, 82, 132, 30 +1979, 9, 76, 106, 61 +1979, 10, 69, 82, 56 +1979, 11, 42, 78, 27 +1979, 12, 39, 71, 32 +1980, 1, 60, 91, 33 +1980, 2, 79, 84, 21 +1980, 3, 41, 66, 35 +1980, 4, 93, 89, 60 +1980, 5, 93, 109, 58 +1980, 6, 96, 139, 41 +1980, 7, 114, 94, 45 +1980, 8, 127, 136, 71 +1980, 9, 99, 75, 62 +1980, 10, 97, 97, 45 +1980, 11, 47, 89, 31 +1980, 12, 73, 80, 22 +1981, 1, 69, 89, 52 +1981, 2, 34, 96, 14 +1981, 3, 38, 91, 33 +1981, 4, 82, 85, 34 +1981, 5, 83, 91, 46 +1981, 6, 95, 128, 31 +1981, 7, 98, 95, 63 +1981, 8, 90, 96, 71 +1981, 9, 57, 93, 27 +1981, 10, 52, 91, 28 +1981, 11, 50, 89, 16 +1981, 12, 65, 66, 35 +1982, 1, 49, 69, 24 +1982, 2, 53, 99, 7 +1982, 3, 74, 55, 18 +1982, 4, 81, 82, 27 +1982, 5, 55, 101, 29 +1982, 6, 107, 109, 48 +1982, 7, 117, 114, 61 +1982, 8, 105, 117, 46 +1982, 9, 51, 83, 44 +1982, 10, 74, 97, 17 +1982, 11, 75, 100, 11 +1982, 12, 45, 76, 16 +1983, 1, 52, 91, 5 +1983, 2, 74, 75, 27 +1983, 3, 56, 92, 23 +1983, 4, 97, 89, 59 +1983, 5, 68, 66, 17 +1983, 6, 83, 99, 28 +1983, 7, 119, 105, 29 +1983, 8, 120, 108, 39 +1983, 9, 97, 91, 26 +1983, 10, 75, 97, 15 +1983, 11, 55, 63, 21 +1983, 12, 65, 63, 54 +1984, 1, 68, 73, 11 +1984, 2, 65, 56, 23 +1984, 3, 44, 81, 7 +1984, 4, 55, 111, 55 +1984, 5, 75, 106, 59 +1984, 6, 92, 95, 74 +1984, 7, 115, 92, 62 +1984, 8, 112, 92, 26 +1984, 9, 99, 102, 40 +1984, 10, 58, 86, 51 +1984, 11, 66, 76, 13 +1984, 12, 63, 92, 27 +1985, 1, 63, 69, 39 +1985, 2, 60, 64, 43 +1985, 3, 73, 71, 28 +1985, 4, 76, 98, 45 +1985, 5, 80, 86, 61 +1985, 6, 116, 103, 60 +1985, 7, 122, 127, 41 +1985, 8, 115, 118, 48 +1985, 9, 53, 110, 47 +1985, 10, 70, 114, 44 +1985, 11, 66, 104, 6 +1985, 12, 32, 92, 37 +1986, 1, 68, 72, 25 +1986, 2, 73, 91, 48 +1986, 3, 76, 59, 9 +1986, 4, 69, 93, 36 +1986, 5, 90, 94, 39 +1986, 6, 101, 91, 42 +1986, 7, 110, 126, 32 +1986, 8, 87, 136, 33 +1986, 9, 65, 107, 60 +1986, 10, 88, 65, 54 +1986, 11, 65, 96, 49 +1986, 12, 34, 58, 46 +1987, 1, 63, 90, 30 +1987, 2, 33, 74, 25 +1987, 3, 75, 84, 46 +1987, 4, 86, 67, 21 +1987, 5, 63, 98, 17 +1987, 6, 81, 105, 58 +1987, 7, 106, 120, 64 +1987, 8, 85, 99, 36 +1987, 9, 97, 94, 24 +1987, 10, 61, 67, 53 +1987, 11, 77, 85, 15 +1987, 12, 72, 79, 41 +1988, 1, 72, 66, 44 +1988, 2, 65, 85, 16 +1988, 3, 31, 90, 41 +1988, 4, 78, 99, 37 +1988, 5, 68, 106, 51 +1988, 6, 88, 113, 35 +1988, 7, 121, 105, 42 +1988, 8, 84, 132, 65 +1988, 9, 69, 100, 41 +1988, 10, 83, 101, 15 +1988, 11, 30, 86, 37 +1988, 12, 72, 75, 26 +1989, 1, 74, 100, 10 +1989, 2, 69, 94, 48 +1989, 3, 46, 65, 34 +1989, 4, 50, 85, 59 +1989, 5, 82, 112, 62 +1989, 6, 126, 119, 50 +1989, 7, 124, 125, 43 +1989, 8, 108, 100, 73 +1989, 9, 87, 103, 52 +1989, 10, 86, 69, 40 +1989, 11, 78, 56, 33 +1989, 12, 78, 77, 53 +1990, 1, 67, 65, 7 +1990, 2, 40, 60, 38 +1990, 3, 55, 83, 7 +1990, 4, 50, 70, 54 +1990, 5, 71, 108, 24 +1990, 6, 84, 126, 27 +1990, 7, 117, 109, 71 +1990, 8, 109, 96, 25 +1990, 9, 83, 96, 44 +1990, 10, 92, 114, 38 +1990, 11, 62, 65, 24 +1990, 12, 76, 65, 25 +1991, 1, 37, 69, 48 +1991, 2, 35, 63, 17 +1991, 3, 66, 69, 13 +1991, 4, 78, 80, 39 +1991, 5, 95, 78, 25 +1991, 6, 127, 113, 68 +1991, 7, 88, 102, 40 +1991, 8, 125, 95, 61 +1991, 9, 54, 96, 40 +1991, 10, 85, 109, 53 +1991, 11, 75, 65, 10 +1991, 12, 72, 90, 44 +1992, 1, 33, 64, 52 +1992, 2, 39, 81, 43 +1992, 3, 68, 82, 15 +1992, 4, 72, 94, 32 +1992, 5, 97, 76, 58 +1992, 6, 125, 111, 55 +1992, 7, 127, 129, 29 +1992, 8, 128, 122, 52 +1992, 9, 81, 105, 38 +1992, 10, 99, 107, 42 +1992, 11, 54, 101, 47 +1992, 12, 35, 81, 42 +1993, 1, 53, 69, 40 +1993, 2, 77, 75, 44 +1993, 3, 59, 94, 46 +1993, 4, 90, 110, 40 +1993, 5, 95, 105, 24 +1993, 6, 126, 102, 68 +1993, 7, 98, 139, 66 +1993, 8, 113, 117, 74 +1993, 9, 87, 109, 33 +1993, 10, 96, 73, 63 +1993, 11, 42, 97, 21 +1993, 12, 36, 85, 10 +1994, 1, 36, 88, 31 +1994, 2, 67, 74, 21 +1994, 3, 40, 87, 13 +1994, 4, 95, 109, 37 +1994, 5, 56, 79, 64 +1994, 6, 127, 96, 32 +1994, 7, 87, 108, 70 +1994, 8, 106, 131, 70 +1994, 9, 58, 78, 20 +1994, 10, 58, 67, 23 +1994, 11, 75, 96, 42 +1994, 12, 31, 92, 30 +1995, 1, 62, 95, 27 +1995, 2, 30, 89, 48 +1995, 3, 71, 91, 46 +1995, 4, 56, 105, 20 +1995, 5, 83, 66, 25 +1995, 6, 84, 90, 42 +1995, 7, 128, 128, 30 +1995, 8, 97, 117, 29 +1995, 9, 93, 93, 50 +1995, 10, 83, 89, 50 +1995, 11, 70, 72, 47 +1995, 12, 33, 96, 34 +1996, 1, 38, 93, 19 +1996, 2, 69, 103, 41 +1996, 3, 31, 82, 25 +1996, 4, 96, 67, 41 +1996, 5, 76, 91, 21 +1996, 6, 98, 109, 66 +1996, 7, 90, 110, 42 +1996, 8, 97, 128, 67 +1996, 9, 70, 73, 32 +1996, 10, 65, 65, 58 +1996, 11, 45, 84, 26 +1996, 12, 48, 72, 29 +1997, 1, 42, 77, 17 +1997, 2, 48, 62, 23 +1997, 3, 57, 74, 40 +1997, 4, 69, 106, 51 +1997, 5, 77, 108, 19 +1997, 6, 126, 95, 63 +1997, 7, 121, 110, 56 +1997, 8, 129, 119, 70 +1997, 9, 66, 74, 52 +1997, 10, 72, 68, 64 +1997, 11, 77, 89, 17 +1997, 12, 37, 88, 10 +1998, 1, 49, 93, 35 +1998, 2, 55, 84, 18 +1998, 3, 64, 81, 21 +1998, 4, 75, 106, 44 +1998, 5, 97, 80, 60 +1998, 6, 83, 132, 29 +1998, 7, 99, 119, 62 +1998, 8, 92, 139, 63 +1998, 9, 77, 68, 16 +1998, 10, 66, 78, 29 +1998, 11, 38, 75, 36 +1998, 12, 70, 94, 9 +1999, 1, 69, 66, 42 +1999, 2, 76, 98, 43 +1999, 3, 34, 88, 43 +1999, 4, 69, 97, 29 +1999, 5, 57, 93, 48 +1999, 6, 127, 112, 49 +1999, 7, 125, 133, 46 +1999, 8, 116, 137, 62 +1999, 9, 74, 88, 27 +1999, 10, 93, 82, 64 +1999, 11, 75, 75, 38 +1999, 12, 51, 55, 6 +2000, 1, 55, 94, 42 +2000, 2, 41, 85, 16 +2000, 3, 51, 81, 49 +2000, 4, 86, 93, 26 +2000, 5, 98, 92, 46 +2000, 6, 86, 130, 38 +2000, 7, 108, 107, 37 +2000, 8, 112, 123, 53 +2000, 9, 93, 105, 39 +2000, 10, 54, 67, 51 +2000, 11, 69, 60, 40 +2000, 12, 64, 92, 38 +2001, 1, 35, 58, 15 +2001, 2, 69, 57, 11 +2001, 3, 60, 81, 45 +2001, 4, 68, 98, 27 +2001, 5, 78, 110, 21 +2001, 6, 124, 124, 72 +2001, 7, 94, 102, 45 +2001, 8, 124, 93, 69 +2001, 9, 62, 84, 33 +2001, 10, 56, 71, 35 +2001, 11, 63, 96, 34 +2001, 12, 76, 101, 38 +2002, 1, 46, 83, 34 +2002, 2, 57, 97, 25 +2002, 3, 33, 59, 23 +2002, 4, 67, 76, 61 +2002, 5, 52, 66, 43 +2002, 6, 103, 120, 66 +2002, 7, 96, 118, 48 +2002, 8, 84, 107, 28 +2002, 9, 74, 91, 30 +2002, 10, 62, 109, 21 +2002, 11, 73, 99, 39 +2002, 12, 49, 84, 11 +2003, 1, 51, 55, 54 +2003, 2, 74, 58, 18 +2003, 3, 45, 55, 24 +2003, 4, 56, 108, 52 +2003, 5, 94, 84, 38 +2003, 6, 113, 136, 50 +2003, 7, 112, 94, 43 +2003, 8, 120, 121, 69 +2003, 9, 99, 75, 28 +2003, 10, 60, 65, 25 +2003, 11, 50, 96, 10 +2003, 12, 35, 79, 33 +2004, 1, 44, 84, 53 +2004, 2, 38, 87, 7 +2004, 3, 77, 58, 16 +2004, 4, 84, 91, 17 +2004, 5, 72, 107, 59 +2004, 6, 108, 98, 70 +2004, 7, 97, 92, 26 +2004, 8, 109, 106, 30 +2004, 9, 99, 71, 53 +2004, 10, 95, 108, 22 +2004, 11, 42, 80, 47 +2004, 12, 32, 69, 23 +2005, 1, 72, 98, 13 +2005, 2, 54, 55, 31 +2005, 3, 43, 76, 34 +2005, 4, 92, 90, 40 +2005, 5, 55, 67, 32 +2005, 6, 124, 105, 70 +2005, 7, 126, 115, 30 +2005, 8, 106, 109, 59 +2005, 9, 79, 75, 31 +2005, 10, 86, 100, 16 +2005, 11, 69, 93, 49 +2005, 12, 56, 101, 41 +2006, 1, 70, 78, 6 +2006, 2, 52, 90, 14 +2006, 3, 50, 58, 14 +2006, 4, 85, 101, 21 +2006, 5, 79, 84, 28 +2006, 6, 112, 121, 41 +2006, 7, 97, 104, 33 +2006, 8, 109, 109, 47 +2006, 9, 62, 70, 24 +2006, 10, 60, 99, 58 +2006, 11, 74, 86, 53 +2006, 12, 74, 81, 49 +2007, 1, 49, 74, 9 +2007, 2, 45, 64, 50 +2007, 3, 59, 72, 9 +2007, 4, 74, 90, 63 +2007, 5, 86, 99, 62 +2007, 6, 84, 127, 44 +2007, 7, 101, 97, 26 +2007, 8, 82, 105, 70 +2007, 9, 88, 91, 30 +2007, 10, 53, 84, 51 +2007, 11, 67, 102, 20 +2007, 12, 61, 56, 20 +2008, 1, 38, 66, 5 +2008, 2, 35, 100, 49 +2008, 3, 69, 62, 18 +2008, 4, 69, 90, 17 +2008, 5, 78, 101, 53 +2008, 6, 99, 129, 53 +2008, 7, 89, 112, 64 +2008, 8, 91, 117, 41 +2008, 9, 69, 71, 15 +2008, 10, 73, 95, 41 +2008, 11, 31, 96, 13 +2008, 12, 37, 91, 43 +2009, 1, 55, 78, 48 +2009, 2, 64, 56, 21 +2009, 3, 46, 89, 7 +2009, 4, 61, 81, 27 +2009, 5, 70, 112, 58 +2009, 6, 124, 97, 30 +2009, 7, 91, 92, 46 +2009, 8, 122, 104, 47 +2009, 9, 79, 83, 40 +2009, 10, 68, 73, 16 +2009, 11, 51, 89, 52 +2009, 12, 32, 82, 9 +2010, 1, 39, 56, 8 +2010, 2, 63, 56, 41 +2010, 3, 65, 57, 46 +2010, 4, 98, 84, 32 +2010, 5, 71, 96, 58 +2010, 6, 113, 130, 51 +2010, 7, 105, 115, 28 +2010, 8, 93, 100, 36 +2010, 9, 76, 107, 54 +2010, 10, 64, 84, 31 +2010, 11, 73, 88, 29 +2010, 12, 43, 86, 8 +2011, 1, 76, 55, 29 +2011, 2, 77, 100, 23 +2011, 3, 33, 66, 5 +2011, 4, 52, 102, 48 +2011, 5, 97, 82, 44 +2011, 6, 117, 105, 71 +2011, 7, 92, 127, 50 +2011, 8, 83, 132, 48 +2011, 9, 54, 109, 60 +2011, 10, 53, 68, 48 +2011, 11, 75, 102, 32 +2011, 12, 30, 98, 26 +2012, 1, 44, 79, 34 +2012, 2, 69, 62, 33 +2012, 3, 67, 65, 10 +2012, 4, 70, 70, 49 +2012, 5, 50, 98, 61 +2012, 6, 92, 97, 64 +2012, 7, 91, 95, 51 +2012, 8, 107, 107, 26 +2012, 9, 64, 102, 22 +2012, 10, 75, 76, 31 +2012, 11, 66, 75, 6 +2012, 12, 33, 100, 36 diff --git a/examples/rainfall/doc/src/rainfall.qdoc b/examples/rainfall/doc/src/rainfall.qdoc index b1a4d8e0..bfe7fc36 100644 --- a/examples/rainfall/doc/src/rainfall.qdoc +++ b/examples/rainfall/doc/src/rainfall.qdoc @@ -1,27 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the documentation of the QtDataVis3D module. +** This file is part 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 +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. 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. +** a written agreement between you and Digia. ** -** 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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/rainfall/main.cpp b/examples/rainfall/main.cpp index 47acee0b..2b9b2861 100644 --- a/examples/rainfall/main.cpp +++ b/examples/rainfall/main.cpp @@ -1,327 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the documentation of the Qt Toolkit. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ -#include "q3dbars.h" -#include "qdataitem.h" - +#include "rainfallchart.h" #include <QGuiApplication> -#include <QFont> -//#include <QDebug> using namespace QtDataVis3D; -class RainfallChart : public QObject -{ -public: - explicit RainfallChart(Q3DBars *rainfall); - ~RainfallChart(); - - void addDataSet(); - void start(); - -private: - Q3DBars *m_chart; - int m_columnCount; - int m_rowCount; -}; - -RainfallChart::RainfallChart(Q3DBars *rainfall) - : m_chart(rainfall), - m_columnCount(12), - m_rowCount(13) -{ - // Set up bar specifications; make the bars as wide as they are deep, - // and add a small space between the bars - m_chart->setBarSpecs(QSizeF(1.0f, 1.0f), QSizeF(0.2f, 0.2f), true); - - // Set up sample space; make it match actual data size - m_chart->setupSampleSpace(m_columnCount, m_rowCount, - QStringLiteral("year"), QStringLiteral("month"), - QStringLiteral("rainfall (in mm)")); - - // Set bar type to cylinder - m_chart->setBarType(Cylinders, false); - - // Set shadows to medium - m_chart->setShadowQuality(ShadowMedium); - - // Set font - m_chart->setFont(QFont("Century Gothic", 40)); - - // Set selection mode to bar and column - //m_chart->setSelectionMode(ModeBarAndColumn); - m_chart->setSelectionMode(ModeZoomColumn); - - // Set theme - m_chart->setTheme(ThemeBlueNcs); - - // Set preset camera position - m_chart->setCameraPreset(PresetIsometricRightHigh); - - // Disable grid - m_chart->setGridEnabled(false); - - // Set window title - m_chart->setWindowTitle(QStringLiteral("Monthly rainfall in Northern Finland (2000-2012)")); -} - -RainfallChart::~RainfallChart() -{ - delete m_chart; -} - -void RainfallChart::start() -{ - addDataSet(); -} - -void RainfallChart::addDataSet() -{ - // Fill in rainfall per month from 2000 to 2012 in Northern Finland (Sodankylä, Utsjoki, Kuusamo) - QVector< QVector<QDataItem*> > data; - QVector<QDataItem*> row; - // TODO: Change this example to load data from file - // 2000 - row.append(new QDataItem(72, "mm")); //January 2000 - row.append(new QDataItem(47, "mm")); //February 2000 - row.append(new QDataItem(37, "mm")); //March 2000 - row.append(new QDataItem(79, "mm")); //April 2000 - row.append(new QDataItem(42, "mm")); //May 2000 - row.append(new QDataItem(73, "mm")); //June 2000 - row.append(new QDataItem(94, "mm")); //July 2000 - row.append(new QDataItem(37, "mm")); //August 2000 - row.append(new QDataItem(17, "mm")); //September 2000 - row.append(new QDataItem(69, "mm")); //October 2000 - row.append(new QDataItem(42, "mm")); //November 2000 - row.append(new QDataItem(42, "mm")); //December 2000 - data.append(row); - row.clear(); - // 2001 - row.append(new QDataItem(25, "mm")); //January 2001 - row.append(new QDataItem(47, "mm")); //February 2001 - row.append(new QDataItem(20, "mm")); //March 2001 - row.append(new QDataItem(70, "mm")); //April 2001 - row.append(new QDataItem(27, "mm")); //May 2001 - row.append(new QDataItem(40, "mm")); //June 2001 - row.append(new QDataItem(123, "mm")); //July 2001 - row.append(new QDataItem(39, "mm")); //August 2001 - row.append(new QDataItem(66, "mm")); //September 2001 - row.append(new QDataItem(55, "mm")); //October 2001 - row.append(new QDataItem(29, "mm")); //November 2001 - row.append(new QDataItem(12, "mm")); //December 2001 - data.append(row); - row.clear(); - // 2002 - row.append(new QDataItem(24, "mm")); //January 2002 - row.append(new QDataItem(45, "mm")); //February 2002 - row.append(new QDataItem(27, "mm")); //March 2002 - row.append(new QDataItem(30, "mm")); //April 2002 - row.append(new QDataItem(16, "mm")); //May 2002 - row.append(new QDataItem(98, "mm")); //June 2002 - row.append(new QDataItem(122, "mm")); //July 2002 - row.append(new QDataItem(20, "mm")); //August 2002 - row.append(new QDataItem(50, "mm")); //September 2002 - row.append(new QDataItem(24, "mm")); //October 2002 - row.append(new QDataItem(22, "mm")); //November 2002 - row.append(new QDataItem(12, "mm")); //December 2002 - data.append(row); - row.clear(); - // 2003 - row.append(new QDataItem(43, "mm")); //January 2003 - row.append(new QDataItem(17, "mm")); //February 2003 - row.append(new QDataItem(26, "mm")); //March 2003 - row.append(new QDataItem(22, "mm")); //April 2003 - row.append(new QDataItem(60, "mm")); //May 2003 - row.append(new QDataItem(14, "mm")); //June 2003 - row.append(new QDataItem(86, "mm")); //July 2003 - row.append(new QDataItem(77, "mm")); //August 2003 - row.append(new QDataItem(69, "mm")); //September 2003 - row.append(new QDataItem(49, "mm")); //October 2003 - row.append(new QDataItem(23, "mm")); //November 2003 - row.append(new QDataItem(44, "mm")); //December 2003 - data.append(row); - row.clear(); - // 2004 - row.append(new QDataItem(15, "mm")); //January 2004 - row.append(new QDataItem(19, "mm")); //February 2004 - row.append(new QDataItem(10, "mm")); //March 2004 - row.append(new QDataItem(11, "mm")); //April 2004 - row.append(new QDataItem(41, "mm")); //May 2004 - row.append(new QDataItem(29, "mm")); //June 2004 - row.append(new QDataItem(49, "mm")); //July 2004 - row.append(new QDataItem(72, "mm")); //August 2004 - row.append(new QDataItem(50, "mm")); //September 2004 - row.append(new QDataItem(18, "mm")); //October 2004 - row.append(new QDataItem(19, "mm")); //November 2004 - row.append(new QDataItem(40, "mm")); //December 2004 - data.append(row); - row.clear(); - // 2005 - row.append(new QDataItem(60, "mm")); //January 2005 - row.append(new QDataItem(24, "mm")); //February 2005 - row.append(new QDataItem(12, "mm")); //March 2005 - row.append(new QDataItem(50, "mm")); //April 2005 - row.append(new QDataItem(88, "mm")); //May 2005 - row.append(new QDataItem(32, "mm")); //June 2005 - row.append(new QDataItem(76, "mm")); //July 2005 - row.append(new QDataItem(55, "mm")); //August 2005 - row.append(new QDataItem(92, "mm")); //September 2005 - row.append(new QDataItem(35, "mm")); //October 2005 - row.append(new QDataItem(105, "mm")); //November 2005 - row.append(new QDataItem(59, "mm")); //December 2005 - data.append(row); - row.clear(); - // 2006 - row.append(new QDataItem(27, "mm")); //January 2006 - row.append(new QDataItem(18, "mm")); //February 2006 - row.append(new QDataItem(17, "mm")); //March 2006 - row.append(new QDataItem(26, "mm")); //April 2006 - row.append(new QDataItem(24, "mm")); //May 2006 - row.append(new QDataItem(18, "mm")); //June 2006 - row.append(new QDataItem(35, "mm")); //July 2006 - row.append(new QDataItem(28, "mm")); //August 2006 - row.append(new QDataItem(80, "mm")); //September 2006 - row.append(new QDataItem(52, "mm")); //October 2006 - row.append(new QDataItem(43, "mm")); //November 2006 - row.append(new QDataItem(44, "mm")); //December 2006 - data.append(row); - row.clear(); - // 2007 - row.append(new QDataItem(41, "mm")); //January 2007 - row.append(new QDataItem(21, "mm")); //February 2007 - row.append(new QDataItem(30, "mm")); //March 2007 - row.append(new QDataItem(20, "mm")); //April 2007 - row.append(new QDataItem(53, "mm")); //May 2007 - row.append(new QDataItem(29, "mm")); //June 2007 - row.append(new QDataItem(139, "mm")); //July 2007 - row.append(new QDataItem(52, "mm")); //August 2007 - row.append(new QDataItem(51, "mm")); //September 2007 - row.append(new QDataItem(24, "mm")); //October 2007 - row.append(new QDataItem(47, "mm")); //November 2007 - row.append(new QDataItem(33, "mm")); //December 2007 - data.append(row); - row.clear(); - // 2008 - row.append(new QDataItem(67, "mm")); //January 2008 - row.append(new QDataItem(19, "mm")); //February 2008 - row.append(new QDataItem(30, "mm")); //March 2008 - row.append(new QDataItem(31, "mm")); //April 2008 - row.append(new QDataItem(29, "mm")); //May 2008 - row.append(new QDataItem(79, "mm")); //June 2008 - row.append(new QDataItem(75, "mm")); //July 2008 - row.append(new QDataItem(99, "mm")); //August 2008 - row.append(new QDataItem(34, "mm")); //September 2008 - row.append(new QDataItem(52, "mm")); //October 2008 - row.append(new QDataItem(60, "mm")); //November 2008 - row.append(new QDataItem(20, "mm")); //December 2008 - data.append(row); - row.clear(); - // 2009 - row.append(new QDataItem(9, "mm")); //January 2009 - row.append(new QDataItem(22, "mm")); //February 2009 - row.append(new QDataItem(11, "mm")); //March 2009 - row.append(new QDataItem(10, "mm")); //April 2009 - row.append(new QDataItem(69, "mm")); //May 2009 - row.append(new QDataItem(30, "mm")); //June 2009 - row.append(new QDataItem(78, "mm")); //July 2009 - row.append(new QDataItem(93, "mm")); //August 2009 - row.append(new QDataItem(70, "mm")); //September 2009 - row.append(new QDataItem(32, "mm")); //October 2009 - row.append(new QDataItem(56, "mm")); //November 2009 - row.append(new QDataItem(23, "mm")); //December 2009 - data.append(row); - row.clear(); - // 2010 - row.append(new QDataItem(12, "mm")); //January 2010 - row.append(new QDataItem(28, "mm")); //February 2010 - row.append(new QDataItem(55, "mm")); //March 2010 - row.append(new QDataItem(20, "mm")); //April 2010 - row.append(new QDataItem(65, "mm")); //May 2010 - row.append(new QDataItem(26, "mm")); //June 2010 - row.append(new QDataItem(134, "mm")); //July 2010 - row.append(new QDataItem(57, "mm")); //August 2010 - row.append(new QDataItem(51, "mm")); //September 2010 - row.append(new QDataItem(53, "mm")); //October 2010 - row.append(new QDataItem(8, "mm")); //November 2010 - row.append(new QDataItem(9, "mm")); //December 2010 - data.append(row); - row.clear(); - // 2011 - row.append(new QDataItem(34, "mm")); //January 2011 - row.append(new QDataItem(20, "mm")); //February 2011 - row.append(new QDataItem(30, "mm")); //March 2011 - row.append(new QDataItem(31, "mm")); //April 2011 - row.append(new QDataItem(42, "mm")); //May 2011 - row.append(new QDataItem(78, "mm")); //June 2011 - row.append(new QDataItem(85, "mm")); //July 2011 - row.append(new QDataItem(33, "mm")); //August 2011 - row.append(new QDataItem(42, "mm")); //September 2011 - row.append(new QDataItem(87, "mm")); //October 2011 - row.append(new QDataItem(41, "mm")); //November 2011 - row.append(new QDataItem(72, "mm")); //December 2011 - data.append(row); - row.clear(); - // 2012 - row.append(new QDataItem(32, "mm")); //January 2012 - row.append(new QDataItem(42, "mm")); //February 2012 - row.append(new QDataItem(30, "mm")); //March 2012 - row.append(new QDataItem(50, "mm")); //April 2012 - row.append(new QDataItem(30, "mm")); //May 2012 - row.append(new QDataItem(70, "mm")); //June 2012 - row.append(new QDataItem(52, "mm")); //July 2012 - row.append(new QDataItem(20, "mm")); //August 2012 - row.append(new QDataItem(99, "mm")); //September 2012 - row.append(new QDataItem(70, "mm")); //October 2012 - row.append(new QDataItem(69, "mm")); //November 2012 - row.append(new QDataItem(49, "mm")); //December 2012 - data.append(row); - row.clear(); - // 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 << "2000" << "2001" << "2002" << "2003" << "2004" << "2005" << "2006" << "2007" << "2008" << "2009" << "2010" << "2011" << "2012"; - - m_chart->addDataSet(data, years, months); -} - int main(int argc, char **argv) { QGuiApplication app(argc, argv); diff --git a/examples/rainfall/rainfall.pro b/examples/rainfall/rainfall.pro index 381b3402..af7f963b 100644 --- a/examples/rainfall/rainfall.pro +++ b/examples/rainfall/rainfall.pro @@ -2,7 +2,22 @@ error( "Couldn't find the examples.pri file!" ) } -SOURCES += main.cpp -QT += datavis3d +SOURCES += main.cpp \ + rainfallchart.cpp \ + variantdataset.cpp \ + variantbardataproxy.cpp \ + variantbardatamapping.cpp \ + +HEADERS += \ + rainfallchart.h \ + variantdataset.h \ + variantbardataproxy.h \ + variantbardatamapping.h INSTALLS += target + +RESOURCES += \ + rainfall.qrc + +OTHER_FILES += data/raindata.txt + diff --git a/examples/rainfall/rainfall.qrc b/examples/rainfall/rainfall.qrc new file mode 100644 index 00000000..53cd4915 --- /dev/null +++ b/examples/rainfall/rainfall.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>data/raindata.txt</file> + </qresource> +</RCC> diff --git a/examples/rainfall/rainfallchart.cpp b/examples/rainfall/rainfallchart.cpp new file mode 100644 index 00000000..f7bcd82b --- /dev/null +++ b/examples/rainfall/rainfallchart.cpp @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "rainfallchart.h" +#include <QtDataVis3D/qcategoryaxis.h> +#include <QtDataVis3D/qvalueaxis.h> +#include <QGuiApplication> +#include <QFont> +#include <QDebug> +#include <QTextStream> +#include <QFile> + +#define CHANGE_CITY_WITH_TIMER + +using namespace QtDataVis3D; + +RainfallChart::RainfallChart(Q3DBars *rainfall) + : m_chart(rainfall), + m_city(2) +{ + // In data file the months are in numeric format, so create custom list + for (int i = 1; i <= 12; i++) + m_numericMonths << QString::number(i); + + m_columnCount = m_numericMonths.size(); + + m_proxy = new VariantBarDataProxy; + m_proxy->setItemLabelFormat(QStringLiteral(" mm")); + m_chart->setDataProxy(m_proxy); + + updateYearsList(2000, 2012); + + // Set up bar specifications; make the bars as wide as they are deep, + // and add a small space between the bars + m_chart->setBarSpecs(QSizeF(1.0f, 1.0f), QSizeF(0.2f, 0.2f), true); + + // Set axis labels and titles + QStringList months; + months << "January" << "February" << "March" << "April" << "May" << "June" << "July" << "August" << "September" << "October" << "November" << "December"; + m_chart->rowAxis()->setTitle("Year"); + m_chart->columnAxis()->setTitle("Month"); + m_chart->valueAxis()->setTitle(QString("rainfall (in mm) in city %1").arg(m_city - 1)); + m_chart->rowAxis()->setCategoryLabels(m_years); + m_chart->columnAxis()->setCategoryLabels(months); + + // Set bar type to cylinder + m_chart->setBarType(QDataVis::Cylinders, false); + + // Set shadows to medium + m_chart->setShadowQuality(QDataVis::ShadowMedium); + + // Set font + m_chart->setFont(QFont("Century Gothic", 40)); + + // Set selection mode to bar and column + //m_chart->setSelectionMode(ModeItemAndColumn); + m_chart->setSelectionMode(QDataVis::ModeZoomColumn); + + // Set theme + m_chart->setTheme(QDataVis::ThemeBlueNcs); + + // Set preset camera position + m_chart->setCameraPreset(QDataVis::PresetIsometricRightHigh); + + // Disable grid + m_chart->setGridVisible(false); + + // Set window title + m_chart->setWindowTitle(QStringLiteral("Monthly rainfall in various cities")); +} + +RainfallChart::~RainfallChart() +{ + delete m_mapping; + delete m_dataSet; + delete m_chart; +} + +void RainfallChart::start() +{ + addDataSet(); + +#ifdef CHANGE_CITY_WITH_TIMER + connect(&m_timer, &QTimer::timeout, this, &RainfallChart::timeout); + m_timer.start(3000); +#endif +} + +void RainfallChart::timeout() +{ + if (++m_city > 4) + m_city = 2; + + m_proxy->mapping()->setValueIndex(m_city); + m_chart->valueAxis()->setTitle(QString("rainfall (in mm) in city %1").arg(m_city - 1)); +} + +void RainfallChart::updateYearsList(int start, int end) +{ + m_years.clear(); + for (int i = start; i <= end; i++) + m_years << QString::number(i); + + m_rowCount = m_years.size(); + + // Set up sample space; make it match actual resolved data size + m_chart->setupSampleSpace(m_rowCount, m_columnCount); +} + +void RainfallChart::addDataSet() +{ + m_dataSet = new VariantDataSet; + VariantDataItemList *itemList = new VariantDataItemList; + QTextStream stream; + QFile dataFile(":/data/raindata.txt"); + if (dataFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + stream.setDevice(&dataFile); + while (!stream.atEnd()) { + QString line = stream.readLine(); + if (line.startsWith("#")) + continue; + QStringList strList = line.split(",", QString::SkipEmptyParts); + if (strList.size() < 5) { + qWarning() << "Invalid row read from data:" << line; + continue; + } + VariantDataItem *newItem = new VariantDataItem; + for (int i = 0; i < 2; i++) + newItem->append(strList.at(i).trimmed()); + for (int i = 2; i < 5; i++) + newItem->append(strList.at(i).trimmed().toDouble()); + itemList->append(newItem); + } + } else { + qWarning() << "Unable to open data file:" << dataFile.fileName(); + } + + m_dataSet->addItems(itemList); + + m_proxy->setDataSet(m_dataSet); + + m_mapping = new VariantBarDataMapping(0, 1, m_city, m_years, m_numericMonths); + m_proxy->setMapping(m_mapping); +} diff --git a/examples/rainfall/rainfallchart.h b/examples/rainfall/rainfallchart.h new file mode 100644 index 00000000..585f2bd0 --- /dev/null +++ b/examples/rainfall/rainfallchart.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef RAINFALLCHART_H +#define RAINFALLCHART_H + +#include "variantbardataproxy.h" +#include <QtDataVis3D/q3dbars.h> +#include <QTimer> + +using namespace QtDataVis3D; + +class RainfallChart : public QObject +{ + Q_OBJECT +public: + explicit RainfallChart(Q3DBars *rainfall); + ~RainfallChart(); + + void addDataSet(); + void start(); + +public slots: + void timeout(); +private: + + void updateYearsList(int start, int end); + Q3DBars *m_chart; + int m_columnCount; + int m_rowCount; + QStringList m_years; + QStringList m_numericMonths; + QTimer m_timer; + VariantBarDataProxy *m_proxy; + int m_city; + VariantBarDataMapping *m_mapping; + VariantDataSet *m_dataSet; +}; + + +#endif // RAINFALLCHART_H diff --git a/examples/rainfall/variantbardatamapping.cpp b/examples/rainfall/variantbardatamapping.cpp new file mode 100644 index 00000000..288a3b55 --- /dev/null +++ b/examples/rainfall/variantbardatamapping.cpp @@ -0,0 +1,133 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "variantbardatamapping.h" + +VariantBarDataMapping::VariantBarDataMapping() + : QObject(0), + m_rowIndex(0), + m_columnIndex(1), + m_valueIndex(2) +{ +} + +VariantBarDataMapping::VariantBarDataMapping(const VariantBarDataMapping &other) + : QObject(0), + m_rowIndex(0), + m_columnIndex(1), + m_valueIndex(2) +{ + operator=(other); +} + +VariantBarDataMapping::VariantBarDataMapping(int rowIndex, int columnIndex, int valueIndex, + const QStringList &rowCategories, + const QStringList &columnCategories) + : QObject(0), + m_rowIndex(0), + m_columnIndex(1), + m_valueIndex(2) +{ + m_rowIndex = rowIndex; + m_columnIndex = columnIndex; + m_valueIndex = valueIndex; + m_rowCategories = rowCategories; + m_columnCategories = columnCategories; +} + +VariantBarDataMapping::~VariantBarDataMapping() +{ +} + +VariantBarDataMapping &VariantBarDataMapping::operator=(const VariantBarDataMapping &other) +{ + m_rowIndex = other.m_rowIndex; + m_columnIndex = other.m_columnIndex; + m_valueIndex = other.m_valueIndex; + m_rowCategories = other.m_rowCategories; + m_columnCategories = other.m_columnCategories; + + return *this; +} + +void VariantBarDataMapping::setRowIndex(int index) +{ + m_rowIndex = index; + emit mappingChanged(); +} + +int VariantBarDataMapping::rowIndex() const +{ + return m_rowIndex; +} + +void VariantBarDataMapping::setColumnIndex(int index) +{ + m_columnIndex = index; + emit mappingChanged(); +} + +int VariantBarDataMapping::columnIndex() const +{ + return m_columnIndex; +} + +void VariantBarDataMapping::setValueIndex(int index) +{ + m_valueIndex = index; + emit mappingChanged(); +} + +int VariantBarDataMapping::valueIndex() const +{ + return m_valueIndex; +} + +void VariantBarDataMapping::setRowCategories(const QStringList &categories) +{ + m_rowCategories = categories; + emit mappingChanged(); +} + +const QStringList &VariantBarDataMapping::rowCategories() const +{ + return m_rowCategories; +} + +void VariantBarDataMapping::setColumnCategories(const QStringList &categories) +{ + m_columnCategories = categories; + emit mappingChanged(); +} + +const QStringList &VariantBarDataMapping::columnCategories() const +{ + return m_columnCategories; +} + +void VariantBarDataMapping::remap(int rowIndex, int columnIndex, int valueIndex, + const QStringList &rowCategories, + const QStringList &columnCategories) +{ + m_rowIndex = rowIndex; + m_columnIndex = columnIndex; + m_valueIndex = valueIndex; + m_rowCategories = rowCategories; + m_columnCategories = columnCategories; + emit mappingChanged(); +} diff --git a/examples/rainfall/variantbardatamapping.h b/examples/rainfall/variantbardatamapping.h new file mode 100644 index 00000000..616ee563 --- /dev/null +++ b/examples/rainfall/variantbardatamapping.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef VARIANTBARDATAMAPPING_H +#define VARIANTBARDATAMAPPING_H + +#include "qdatavis3denums.h" +#include <QStringList> + +using namespace QtDataVis3D; + +class VariantBarDataMapping : public QObject +{ + Q_OBJECT + Q_PROPERTY(int rowIndex READ rowIndex WRITE setRowIndex) + Q_PROPERTY(int columnIndex READ columnIndex WRITE setColumnIndex) + Q_PROPERTY(int valueIndex READ valueIndex WRITE setValueIndex) + Q_PROPERTY(QStringList rowCategories READ rowCategories WRITE setRowCategories) + Q_PROPERTY(QStringList columnCategories READ columnCategories WRITE setColumnCategories) +public: + explicit VariantBarDataMapping(); + VariantBarDataMapping(const VariantBarDataMapping &other); + VariantBarDataMapping(int rowIndex, int columnIndex, int valueIndex, + const QStringList &rowCategories, + const QStringList &columnCategories); + virtual ~VariantBarDataMapping(); + + VariantBarDataMapping &operator=(const VariantBarDataMapping &other); + + void setRowIndex(int index); + int rowIndex() const; + void setColumnIndex(int index); + int columnIndex() const; + void setValueIndex(int index); + int valueIndex() const; + + void setRowCategories(const QStringList &categories); + const QStringList &rowCategories() const; + void setColumnCategories(const QStringList &categories); + const QStringList &columnCategories() const; + + void remap(int rowIndex, int columnIndex, int valueIndex, + const QStringList &rowCategories, + const QStringList &columnCategories); +signals: + void mappingChanged(); + +private: + // Indexes of the mapped items in the VariantDataItem + int m_rowIndex; + int m_columnIndex; + int m_valueIndex; + + // For row/column items, sort items into these categories. Other categories are ignored. + QStringList m_rowCategories; + QStringList m_columnCategories; +}; + +#endif diff --git a/examples/rainfall/variantbardataproxy.cpp b/examples/rainfall/variantbardataproxy.cpp new file mode 100644 index 00000000..79b5c67f --- /dev/null +++ b/examples/rainfall/variantbardataproxy.cpp @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "variantbardataproxy.h" + +using namespace QtDataVis3D; + +VariantBarDataProxy::VariantBarDataProxy() : + QBarDataProxy() +{ +} + +VariantBarDataProxy::VariantBarDataProxy(VariantDataSet *newSet, + VariantBarDataMapping *mapping) : + QBarDataProxy() +{ + setDataSet(newSet); + setMapping(mapping); +} + +VariantBarDataProxy::~VariantBarDataProxy() +{ +} + +void VariantBarDataProxy::setDataSet(VariantDataSet *newSet) +{ + if (!m_dataSet.isNull()) + QObject::disconnect(m_dataSet.data(), 0, this, 0); + + m_dataSet = newSet; + + if (!m_dataSet.isNull()) { + QObject::connect(m_dataSet.data(), &VariantDataSet::itemsAdded, this, &VariantBarDataProxy::handleItemsAdded); + QObject::connect(m_dataSet.data(), &VariantDataSet::dataCleared, this, &VariantBarDataProxy::handleDataCleared); + } + resolveDataSet(); +} + +VariantDataSet *VariantBarDataProxy::dataSet() +{ + return m_dataSet.data(); +} + +void VariantBarDataProxy::setMapping(VariantBarDataMapping *mapping) +{ + if (!m_mapping.isNull()) + 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, &VariantBarDataProxy::handleMappingChanged); + + resolveDataSet(); +} + +VariantBarDataMapping *VariantBarDataProxy::mapping() +{ + return m_mapping.data(); +} + +void VariantBarDataProxy::handleItemsAdded(int index, int count) +{ + Q_UNUSED(index) + Q_UNUSED(count) + + // Resolve new items + resolveDataSet(); // TODO Resolving entire dataset is inefficient +} + +void VariantBarDataProxy::handleDataCleared() +{ + // Data cleared, reset array + resetArray(0); +} + +void VariantBarDataProxy::handleMappingChanged() +{ + resolveDataSet(); +} + +// Resolve entire dataset into QBarDataArray. +void VariantBarDataProxy::resolveDataSet() +{ + if (m_dataSet.isNull() || m_mapping.isNull() || !m_mapping->rowCategories().size() || !m_mapping->columnCategories().size()) { + resetArray(0); + return; + } + const VariantDataItemList &itemList = m_dataSet->itemList(); + + int rowIndex = m_mapping->rowIndex(); + int columnIndex = m_mapping->columnIndex(); + int valueIndex = m_mapping->valueIndex(); + const QStringList &rowList = m_mapping->rowCategories(); + const QStringList &columnList = m_mapping->columnCategories(); + + // Sort values into rows and columns + typedef QHash<QString, qreal> ColumnValueMap; + QHash <QString, ColumnValueMap> itemValueMap; + foreach (const VariantDataItem *item, itemList) + itemValueMap[item->at(rowIndex).toString()][item->at(columnIndex).toString()] = item->at(valueIndex).toReal(); + + // Create new data array from itemValueMap + QBarDataArray *newProxyArray = new QBarDataArray; + foreach (QString rowKey, rowList) { + QBarDataRow *newProxyRow = new QBarDataRow(columnList.size()); + for (int i = 0; i < columnList.size(); i++) + (*newProxyRow)[i].setValue(itemValueMap[rowKey][columnList.at(i)]); + newProxyArray->append(newProxyRow); + } + + resetArray(newProxyArray); +} diff --git a/examples/rainfall/variantbardataproxy.h b/examples/rainfall/variantbardataproxy.h new file mode 100644 index 00000000..2c80c0b1 --- /dev/null +++ b/examples/rainfall/variantbardataproxy.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef VARIANTBARDATAPROXY_H +#define VARIANTBARDATAPROXY_H + +#include "qbardataproxy.h" +#include "variantdataset.h" +#include "variantbardatamapping.h" +#include <QStringList> +#include <QMap> +#include <QPointer> + +using namespace QtDataVis3D; + +class VariantBarDataProxy : public QBarDataProxy +{ + Q_OBJECT + +public: + explicit VariantBarDataProxy(); + explicit VariantBarDataProxy(VariantDataSet *newSet, VariantBarDataMapping *mapping); + virtual ~VariantBarDataProxy(); + + // 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. + void setMapping(VariantBarDataMapping *mapping); + VariantBarDataMapping *mapping(); + +public slots: + void handleItemsAdded(int index, int count); + void handleDataCleared(); + void handleMappingChanged(); + +private: + void resolveDataSet(); + + QPointer<VariantDataSet> m_dataSet; + QPointer<VariantBarDataMapping> m_mapping; + + Q_DISABLE_COPY(VariantBarDataProxy) + + friend class VariantBarDataProxy; +}; + +#endif diff --git a/examples/rainfall/variantdataset.cpp b/examples/rainfall/variantdataset.cpp new file mode 100644 index 00000000..3fe4fa6b --- /dev/null +++ b/examples/rainfall/variantdataset.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "variantdataset.h" + +VariantDataSet::VariantDataSet() + : QObject(0) +{ +} + +VariantDataSet::~VariantDataSet() +{ + clear(); +} + +void VariantDataSet::clear() +{ + foreach (VariantDataItem *item, m_variantData) { + item->clear(); + delete item; + } + m_variantData.clear(); + emit dataCleared(); +} + +int VariantDataSet::addItem(VariantDataItem *item) +{ + m_variantData.append(item); + int addIndex = m_variantData.size(); + + emit itemsAdded(addIndex, 1); + return addIndex; +} + +int VariantDataSet::addItems(VariantDataItemList *itemList) +{ + int newCount = itemList->size(); + int addIndex = m_variantData.size(); + m_variantData.append(*itemList); + delete itemList; + emit itemsAdded(addIndex, newCount); + return addIndex; +} + +const VariantDataItemList &VariantDataSet::itemList() const +{ + return m_variantData; +} diff --git a/examples/rainfall/variantdataset.h b/examples/rainfall/variantdataset.h new file mode 100644 index 00000000..f3965978 --- /dev/null +++ b/examples/rainfall/variantdataset.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef VARIANTDATASET_H +#define VARIANTDATASET_H + +#include "qdatavis3denums.h" +#include <QScopedPointer> +#include <QVariantList> + +using namespace QtDataVis3D; + +typedef QVariantList VariantDataItem; +typedef QList<VariantDataItem *> VariantDataItemList; + +class VariantDataSet : public QObject +{ + Q_OBJECT + +public: + explicit VariantDataSet(); + ~VariantDataSet(); + + void clear(); + + int addItem(VariantDataItem *item); + int addItems(VariantDataItemList *itemList); + + const VariantDataItemList &itemList() const; + +signals: + void itemsAdded(int index, int count); + void dataCleared(); + +private: + VariantDataItemList m_variantData; + + Q_DISABLE_COPY(VariantDataSet) +}; + +#endif diff --git a/examples/scatterchart/doc/src/scatterchart.qdoc b/examples/scatterchart/doc/src/scatterchart.qdoc new file mode 100644 index 00000000..6e8dcd03 --- /dev/null +++ b/examples/scatterchart/doc/src/scatterchart.qdoc @@ -0,0 +1,29 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +/*! + \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..ab6eb313 --- /dev/null +++ b/examples/scatterchart/main.cpp @@ -0,0 +1,198 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "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 *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 item style")); + + QPushButton *cameraButton = new QPushButton(widget); + cameraButton->setText(QStringLiteral("Change camera preset")); + + QPushButton *clearButton = new QPushButton(widget); + clearButton->setText(QStringLiteral("Clear chart")); + + QPushButton *addOneButton = new QPushButton(widget); + addOneButton->setText(QStringLiteral("Add item")); + + QPushButton *addBunchButton = new QPushButton(widget); + addBunchButton->setText(QStringLiteral("Add bunch of items")); + + QPushButton *insertOneButton = new QPushButton(widget); + insertOneButton->setText(QStringLiteral("Insert item")); + + QPushButton *insertBunchButton = new QPushButton(widget); + insertBunchButton->setText(QStringLiteral("Insert bunch of items")); + + QPushButton *changeOneButton = new QPushButton(widget); + changeOneButton->setText(QStringLiteral("Change item")); + + QPushButton *changeBunchButton = new QPushButton(widget); + changeBunchButton->setText(QStringLiteral("Change bunch of items")); + + QPushButton *removeOneButton = new QPushButton(widget); + removeOneButton->setText(QStringLiteral("Remove item")); + + QPushButton *removeBunchButton = new QPushButton(widget); + removeBunchButton->setText(QStringLiteral("Remove bunch of items")); + + QPushButton *startTimerButton = new QPushButton(widget); + startTimerButton->setText(QStringLiteral("Start/stop timer")); + + QCheckBox *backgroundCheckBox = new QCheckBox(widget); + backgroundCheckBox->setText(QStringLiteral("Show background")); + backgroundCheckBox->setChecked(true); + + QCheckBox *gridCheckBox = new QCheckBox(widget); + gridCheckBox->setText(QStringLiteral("Show grid")); + gridCheckBox->setChecked(true); + + 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(30); + fontSizeSlider->setMaximum(200); + + 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(clearButton, 0, Qt::AlignTop); + vLayout->addWidget(addOneButton, 0, Qt::AlignTop); + vLayout->addWidget(addBunchButton, 0, Qt::AlignTop); + vLayout->addWidget(insertOneButton, 0, Qt::AlignTop); + vLayout->addWidget(insertBunchButton, 0, Qt::AlignTop); + vLayout->addWidget(changeOneButton, 0, Qt::AlignTop); + vLayout->addWidget(changeBunchButton, 0, Qt::AlignTop); + vLayout->addWidget(removeOneButton, 0, Qt::AlignTop); + vLayout->addWidget(removeBunchButton, 0, Qt::AlignTop); + vLayout->addWidget(startTimerButton, 0, Qt::AlignTop); + vLayout->addWidget(backgroundCheckBox); + 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); + + widget->show(); + + ScatterDataModifier *modifier = new ScatterDataModifier(chart); + + 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(clearButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::clear); + QObject::connect(addOneButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::addOne); + QObject::connect(addBunchButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::addBunch); + QObject::connect(insertOneButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::insertOne); + QObject::connect(insertBunchButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::insertBunch); + QObject::connect(changeOneButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::changeOne); + QObject::connect(changeBunchButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::changeBunch); + QObject::connect(removeOneButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::removeOne); + QObject::connect(removeBunchButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::removeBunch); + QObject::connect(startTimerButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::startStopTimer); + QObject::connect(themeButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::changeTheme); + QObject::connect(labelButton, &QPushButton::clicked, modifier, + &ScatterDataModifier::changeTransparency); + + 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(backgroundCheckBox, &QCheckBox::stateChanged, modifier, + &ScatterDataModifier::setBackgroundEnabled); + QObject::connect(gridCheckBox, &QCheckBox::stateChanged, modifier, + &ScatterDataModifier::setGridEnabled); + + modifier->start(); + + return app.exec(); +} diff --git a/examples/scatterchart/scatterchart.cpp b/examples/scatterchart/scatterchart.cpp new file mode 100644 index 00000000..ac8676b5 --- /dev/null +++ b/examples/scatterchart/scatterchart.cpp @@ -0,0 +1,325 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "scatterchart.h" +#include <QtDataVis3D/qscatterdataproxy.h> +#include <QtDataVis3D/qvalueaxis.h> +#include <qmath.h> +using namespace QtDataVis3D; + +//#define RANDOM_SCATTER + +const int numberOfItems = 10000; + +ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter) + : m_chart(scatter), + m_fontSize(30.0f) +{ + m_chart->setFontSize(m_fontSize); + m_chart->setObjectType(QDataVis::Spheres, true); + m_chart->setTheme(QDataVis::ThemeBrownSand); + m_chart->setShadowQuality(QDataVis::ShadowHigh); + + QScatterDataProxy *proxy = new QScatterDataProxy; + m_chart->setDataProxy(proxy); + + connect(&m_timer, &QTimer::timeout, this, &ScatterDataModifier::timeout); +} + +ScatterDataModifier::~ScatterDataModifier() +{ + delete m_chart; +} + +void ScatterDataModifier::start() +{ + addData(); +} + +void ScatterDataModifier::addData() +{ + // Add labels + m_chart->valueAxisX()->setTitle("Somethings"); + m_chart->valueAxisY()->setTitle("Values"); + m_chart->valueAxisZ()->setTitle("Others"); + m_chart->valueAxisX()->setRange(-50.0, 50.0); + m_chart->valueAxisY()->setRange(-1.0, 1.0); + m_chart->valueAxisZ()->setRange(-50.0, 50.0); + + QScatterDataArray *dataArray = new QScatterDataArray; + dataArray->resize(numberOfItems); + QScatterDataItem *ptrToDataArray = &dataArray->first(); + +#if RANDOM_SCATTER + for (int i = 0; i < numberOfItems; i++) { + ptrToDataArray->setPosition(randVector()); + ptrToDataArray++; + } +#else + float limit = qSqrt(numberOfItems) / 2.0f; + for (float i = -limit; i < limit; i++) { + for (float j = -limit; j < limit; j++) { + ptrToDataArray->setPosition(QVector3D(i, qCos(qDegreesToRadians((i * j) / 7.5)), j)); + ptrToDataArray++; + } + } +#endif + + static_cast<QScatterDataProxy *>(m_chart->dataProxy())->resetArray(dataArray); +} + +void ScatterDataModifier::changeStyle() +{ + static int model = 0; + switch (model) { + case 0: + m_chart->setObjectType(QDataVis::Dots, false); + break; + case 1: + m_chart->setObjectType(QDataVis::Dots, true); + break; + case 2: + m_chart->setObjectType(QDataVis::Spheres, false); + break; + case 3: + m_chart->setObjectType(QDataVis::Spheres, true); + break; + } + model++; + if (model > 3) + model = 0; +} + +void ScatterDataModifier::changePresetCamera() +{ + static int preset = QDataVis::PresetFrontLow; + + m_chart->setCameraPreset((QDataVis::CameraPreset)preset); + + if (++preset > QDataVis::PresetDirectlyAboveCCW45) + preset = QDataVis::PresetFrontLow; +} + +void ScatterDataModifier::changeTheme() +{ + static int theme = QDataVis::ThemeSystem; + + m_chart->setTheme((QDataVis::ColorTheme)theme); + + if (++theme > QDataVis::ThemeLight) + theme = QDataVis::ThemeSystem; +} + +void ScatterDataModifier::changeTransparency() +{ + static int transparency = QDataVis::TransparencyNone; + + m_chart->setLabelTransparency((QDataVis::LabelTransparency)transparency); + + if (++transparency > QDataVis::TransparencyNoBackground) + transparency = QDataVis::TransparencyNone; +} + +void ScatterDataModifier::changeFont(const QFont &font) +{ + QFont newFont = font; + newFont.setPointSizeF(m_fontSize); + m_chart->setFont(newFont); +} + +void ScatterDataModifier::changeFontSize(int fontsize) +{ + m_fontSize = fontsize; + m_chart->setFontSize((GLfloat)m_fontSize); +} + +void ScatterDataModifier::shadowQualityUpdatedByVisual(QDataVis::ShadowQuality sq) +{ + int quality = 0; + switch (sq) { + case QDataVis::ShadowLow: + quality = 1; + break; + case QDataVis::ShadowMedium: + quality = 2; + break; + case QDataVis::ShadowHigh: + quality = 3; + break; + } + + // Updates the UI component to show correct shadow quality + emit shadowQualityChanged(quality); +} + +void ScatterDataModifier::clear() +{ + m_chart->dataProxy()->resetArray(0); + qDebug() << m_loopCounter << "Cleared array"; +} + +void ScatterDataModifier::addOne() +{ + QScatterDataItem item(randVector()); + int addIndex = m_chart->dataProxy()->addItem(item); + qDebug() << m_loopCounter << "added one to index:" << addIndex << "array size:" << m_chart->dataProxy()->array()->size(); +} + +void ScatterDataModifier::addBunch() +{ + QScatterDataArray items(100); + for (int i = 0; i < items.size(); i++) + items[i].setPosition(randVector()); + int addIndex = m_chart->dataProxy()->addItems(items); + qDebug() << m_loopCounter << "added bunch to index:" << addIndex << "array size:" << m_chart->dataProxy()->array()->size(); +} + +void ScatterDataModifier::insertOne() +{ + QScatterDataItem item(randVector()); + m_chart->dataProxy()->insertItem(0, item); + qDebug() << m_loopCounter << "Inserted one, array size:" << m_chart->dataProxy()->array()->size(); +} + +void ScatterDataModifier::insertBunch() +{ + QScatterDataArray items(100); + for (int i = 0; i < items.size(); i++) + items[i].setPosition(randVector()); + m_chart->dataProxy()->insertItems(0, items); + qDebug() << m_loopCounter << "Inserted bunch, array size:" << m_chart->dataProxy()->array()->size(); +} + +void ScatterDataModifier::changeOne() +{ + if (m_chart->dataProxy()->array()->size()) { + QScatterDataItem item(randVector()); + m_chart->dataProxy()->setItem(0, item); + qDebug() << m_loopCounter << "Changed one, array size:" << m_chart->dataProxy()->array()->size(); + } +} + +void ScatterDataModifier::changeBunch() +{ + if (m_chart->dataProxy()->array()->size()) { + int amount = qMin(m_chart->dataProxy()->array()->size(), 100); + QScatterDataArray items(amount); + for (int i = 0; i < items.size(); i++) + items[i].setPosition(randVector()); + m_chart->dataProxy()->setItems(0, items); + qDebug() << m_loopCounter << "Changed bunch, array size:" << m_chart->dataProxy()->array()->size(); + } +} + +void ScatterDataModifier::removeOne() +{ + m_chart->dataProxy()->removeItems(0, 1); + qDebug() << m_loopCounter << "Removed one, array size:" << m_chart->dataProxy()->array()->size(); +} + +void ScatterDataModifier::removeBunch() +{ + m_chart->dataProxy()->removeItems(0, 100); + qDebug() << m_loopCounter << "Removed bunch, array size:" << m_chart->dataProxy()->array()->size(); +} + +void ScatterDataModifier::timeout() +{ + int doWhat = rand() % 8; + if (!(rand() % 100)) + doWhat = -1; + + switch (doWhat) { + case 0: + addOne(); + break; + case 1: + addBunch(); + break; + case 2: + insertOne(); + break; + case 3: + insertBunch(); + break; + case 4: + changeOne(); + break; + case 5: + changeBunch(); + break; + case 6: + removeOne(); + break; + case 7: + removeBunch(); + break; + default: + clear(); + break; + } + + m_loopCounter++; +} + +void ScatterDataModifier::startStopTimer() +{ + if (m_timer.isActive()) { + m_timer.stop(); + } else { + clear(); + m_loopCounter = 0; + m_timer.start(0); + } +} + +void ScatterDataModifier::changeShadowQuality(int quality) +{ + QDataVis::ShadowQuality sq = QDataVis::ShadowNone; + switch (quality) { + case 1: + sq = QDataVis::ShadowLow; + break; + case 2: + sq = QDataVis::ShadowMedium; + break; + case 3: + sq = QDataVis::ShadowHigh; + break; + } + m_chart->setShadowQuality(sq); + emit shadowQualityChanged(quality); +} + +void ScatterDataModifier::setBackgroundEnabled(int enabled) +{ + m_chart->setBackgroundVisible((bool)enabled); +} + +void ScatterDataModifier::setGridEnabled(int enabled) +{ + m_chart->setGridVisible((bool)enabled); +} + +QVector3D ScatterDataModifier::randVector() +{ + return QVector3D( + (float)(rand() % 100) / 2.0f - (float)(rand() % 100) / 2.0f, + (float)(rand() % 100) / 100.0f - (float)(rand() % 100) / 100.0f, + (float)(rand() % 100) / 2.0f - (float)(rand() % 100) / 2.0f); +} diff --git a/examples/scatterchart/scatterchart.h b/examples/scatterchart/scatterchart.h new file mode 100644 index 00000000..8500ef29 --- /dev/null +++ b/examples/scatterchart/scatterchart.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef SCATTERDATAMODIFIER_H +#define SCATTERDATAMODIFIER_H + +#include <QtDataVis3D/q3dscatter.h> + +#include <QFont> +#include <QDebug> +#include <QTimer> + +using namespace QtDataVis3D; + +class ScatterDataModifier : public QObject +{ + Q_OBJECT +public: + explicit ScatterDataModifier(Q3DScatter *scatter); + ~ScatterDataModifier(); + + void addData(); + void changeStyle(); + void changePresetCamera(); + void changeTheme(); + void changeTransparency(); + void changeFont(const QFont &font); + void changeFontSize(int fontsize); + void setBackgroundEnabled(int enabled); + void setGridEnabled(int enabled); + void start(); + +public slots: + void changeShadowQuality(int quality); + void shadowQualityUpdatedByVisual(QDataVis::ShadowQuality shadowQuality); + void clear(); + void addOne(); + void addBunch(); + void insertOne(); + void insertBunch(); + void changeOne(); + void changeBunch(); + void removeOne(); + void removeBunch(); + void timeout(); + void startStopTimer(); + +signals: + void shadowQualityChanged(int quality); + +private: + QVector3D randVector(); + Q3DScatter *m_chart; + int m_fontSize; + QTimer m_timer; + int m_loopCounter; +}; + +#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 diff --git a/examples/spectrum/doc/src/spectrum.qdoc b/examples/spectrum/doc/src/spectrum.qdoc index 87028e9c..612c31cd 100644 --- a/examples/spectrum/doc/src/spectrum.qdoc +++ b/examples/spectrum/doc/src/spectrum.qdoc @@ -1,27 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the documentation of the QtDataVis3D module. +** This file is part 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 +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. 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. +** a written agreement between you and Digia. ** -** 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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/spectrum/spectrum.pro b/examples/spectrum/spectrum.pro index eb431bd8..9a8d45ae 100644 --- a/examples/spectrum/spectrum.pro +++ b/examples/spectrum/spectrum.pro @@ -1,7 +1,3 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} - qtHaveModule(multimedia) { include(spectrum.pri) diff --git a/examples/spectrum/spectrumapp/engine.cpp b/examples/spectrum/spectrumapp/engine.cpp index 7016af4a..c23a4f78 100644 --- a/examples/spectrum/spectrumapp/engine.cpp +++ b/examples/spectrum/spectrumapp/engine.cpp @@ -1,40 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/spectrum/spectrumapp/engine.h b/examples/spectrum/spectrumapp/engine.h index 3d04e13b..cdd8373f 100644 --- a/examples/spectrum/spectrumapp/engine.h +++ b/examples/spectrum/spectrumapp/engine.h @@ -1,40 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the examples of QtDataVis3D. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/spectrum/spectrumapp/frequencyspectrum.cpp b/examples/spectrum/spectrumapp/frequencyspectrum.cpp index f4a4167b..013d0454 100644 --- a/examples/spectrum/spectrumapp/frequencyspectrum.cpp +++ b/examples/spectrum/spectrumapp/frequencyspectrum.cpp @@ -1,40 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/spectrum/spectrumapp/frequencyspectrum.h b/examples/spectrum/spectrumapp/frequencyspectrum.h index e7ea2e53..fac9a1b7 100644 --- a/examples/spectrum/spectrumapp/frequencyspectrum.h +++ b/examples/spectrum/spectrumapp/frequencyspectrum.h @@ -1,40 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the examples of QtDataVis3D. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/spectrum/spectrumapp/main.cpp b/examples/spectrum/spectrumapp/main.cpp index 4296a347..d0333e75 100644 --- a/examples/spectrum/spectrumapp/main.cpp +++ b/examples/spectrum/spectrumapp/main.cpp @@ -1,47 +1,28 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ -#include "q3dbars.h" #include "engine.h" #include "utils.h" +#include <QtDataVis3D/q3dbars.h> +#include <QtDataVis3D/qbardataproxy.h> +#include <QtDataVis3D/qvalueaxis.h> + #include <QGuiApplication> #include <QAudio> #include <QTimer> @@ -85,20 +66,21 @@ MainApp::MainApp(Q3DBars *window) m_lowFreq(SpectrumLowFreq), m_highFreq(SpectrumHighFreq) { - m_chart->setupSampleSpace(SpectrumNumBands, SpectrumNumBands * 2); + m_chart->setupSampleSpace(SpectrumNumBands * 2, SpectrumNumBands); // Disable grid - m_chart->setGridEnabled(false); - // Disable auto-scaling of height by defining tick count and step, even though we don't draw grid - // By setting count to 1 and step to the max we can get, we lock the scale of the bars. - m_chart->setTickCount(1, 1.0f); + m_chart->setGridVisible(false); + // Disable auto-scaling of height by defining explicit range + // By setting count to 0 we avoid getting any grid + m_chart->valueAxis()->setSegmentCount(0); + m_chart->valueAxis()->setRange(0.0, 1.0); // Disable shadows - m_chart->setShadowQuality(ShadowNone); + m_chart->setShadowQuality(QDataVis::ShadowNone); #if USE_CONES // Set bar specifications; make them a bit wider than deep and make them be drawn 75% // inside each other m_chart->setBarSpecs(QSizeF(1.0f, 0.75f), QSizeF(0.2f, -0.75f)); // Set bar type, smooth cones - m_chart->setBarType(Cones, true); + m_chart->setBarType(QDataVis::Cones, true); // Adjust zoom manually; automatic zoom level calculation does not work well with negative // spacings (in setBarSpecs) m_chart->setCameraPosition(10.0f, 5.0f, 70); @@ -106,18 +88,21 @@ MainApp::MainApp(Q3DBars *window) // Set bar specifications; make them twice as wide as they're deep m_chart->setBarSpecs(QSizeF(1.0f, 0.5f), QSizeF(0.0f, 0.0f)); // Set bar type, flat bars - m_chart->setBarType(Bars, false); + m_chart->setBarType(QDataVis::Bars, false); // Adjust camera position m_chart->setCameraPosition(10.0f, 7.5f, 75); #endif // Set color scheme m_chart->setBarColor(QColor(Qt::black), QColor(Qt::red), QColor(Qt::darkYellow)); // Disable selection - m_chart->setSelectionMode(ModeNone); + m_chart->setSelectionMode(QDataVis::ModeNone); QObject::connect(m_engine, &Engine::changedSpectrum, this, &MainApp::spectrumChanged); QObject::connect(m_engine, &Engine::stateChanged, this, &MainApp::stateChanged); m_restartTimer->setSingleShot(true); QObject::connect(m_restartTimer, &QTimer::timeout, this, &MainApp::restart); + + QBarDataProxy *proxy = new QBarDataProxy; + m_chart->setDataProxy(proxy); } MainApp::~MainApp() @@ -141,22 +126,20 @@ void MainApp::spectrumChanged(qint64 position, qint64 length, const FrequencySpe Q_UNUSED(position); Q_UNUSED(length); //qDebug() << "updating bar values" << position << length; - QVector<float> data; + QBarDataRow *data = new QBarDataRow(SpectrumNumBands); for (int bar = 0; bar < SpectrumNumBands; bar++) { // init data set - data.append(0.0f); + (*data)[bar].setValue(qreal(0.0)); } FrequencySpectrum::const_iterator i = spectrum.begin(); const FrequencySpectrum::const_iterator end = spectrum.end(); for ( ; i != end; ++i) { const FrequencySpectrum::Element e = *i; if (e.frequency >= m_lowFreq && e.frequency < m_highFreq) { - data.replace(barIndex(e.frequency) - , qMax(data.at(barIndex(e.frequency)), (float)e.amplitude)); + (*data)[barIndex(e.frequency)].setValue(qMax(data->at(barIndex(e.frequency)).value(), qreal(e.amplitude))); } } - if (data.size() > 0) - m_chart->addDataRow(data); + static_cast<QBarDataProxy *>(m_chart->dataProxy())->insertRow(0, data); } void MainApp::stateChanged(QAudio::Mode mode, QAudio::State state) diff --git a/examples/spectrum/spectrumapp/spectrum.h b/examples/spectrum/spectrumapp/spectrum.h index 244a5892..015989d5 100644 --- a/examples/spectrum/spectrumapp/spectrum.h +++ b/examples/spectrum/spectrumapp/spectrum.h @@ -1,49 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the examples of QtDataVis3D. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ #ifndef SPECTRUM_H #define SPECTRUM_H -#include <qglobal.h> #include "utils.h" #include "fftreal_wrapper.h" // For FFTLengthPowerOfTwo +#include <qglobal.h> //----------------------------------------------------------------------------- // Constants diff --git a/examples/spectrum/spectrumapp/spectrumanalyser.cpp b/examples/spectrum/spectrumapp/spectrumanalyser.cpp index 518bb6da..4cebfde9 100644 --- a/examples/spectrum/spectrumapp/spectrumanalyser.cpp +++ b/examples/spectrum/spectrumapp/spectrumanalyser.cpp @@ -1,40 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/spectrum/spectrumapp/spectrumanalyser.h b/examples/spectrum/spectrumapp/spectrumanalyser.h index 50d4fb66..6d9291ef 100644 --- a/examples/spectrum/spectrumapp/spectrumanalyser.h +++ b/examples/spectrum/spectrumapp/spectrumanalyser.h @@ -1,40 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the examples of QtDataVis3D. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/spectrum/spectrumapp/spectrumapp.pro b/examples/spectrum/spectrumapp/spectrumapp.pro index f73336a1..c2455f78 100644 --- a/examples/spectrum/spectrumapp/spectrumapp.pro +++ b/examples/spectrum/spectrumapp/spectrumapp.pro @@ -1,4 +1,10 @@ -include(../spectrum.pri) +!include( ../../examples.pri ) { + error( "Couldn't find the examples.pri file!" ) +} + +!include( ../spectrum.pri ) { + error( "Couldn't find the spectrum.pri file!" ) +} static: error(This application cannot be statically linked to the fftreal library) @@ -6,7 +12,7 @@ TEMPLATE = app TARGET = spectrum -QT += multimedia datavis3d +QT += multimedia SOURCES += main.cpp \ engine.cpp \ diff --git a/examples/spectrum/spectrumapp/utils.cpp b/examples/spectrum/spectrumapp/utils.cpp index 723dd6f6..bad6cc48 100644 --- a/examples/spectrum/spectrumapp/utils.cpp +++ b/examples/spectrum/spectrumapp/utils.cpp @@ -1,40 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the examples of the Qt Toolkit. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/spectrum/spectrumapp/utils.h b/examples/spectrum/spectrumapp/utils.h index 62215db5..f0ae5633 100644 --- a/examples/spectrum/spectrumapp/utils.h +++ b/examples/spectrum/spectrumapp/utils.h @@ -1,40 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the examples of QtDataVis3D. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/spectrum/spectrumapp/wavfile.cpp b/examples/spectrum/spectrumapp/wavfile.cpp index 0fe8833d..24482507 100644 --- a/examples/spectrum/spectrumapp/wavfile.cpp +++ b/examples/spectrum/spectrumapp/wavfile.cpp @@ -1,40 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the examples of QtDataVis3D. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/spectrum/spectrumapp/wavfile.h b/examples/spectrum/spectrumapp/wavfile.h index a9bca7e1..e408911b 100644 --- a/examples/spectrum/spectrumapp/wavfile.h +++ b/examples/spectrum/spectrumapp/wavfile.h @@ -1,40 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the examples of QtDataVis3D. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/surfacechart/chartmodifier.cpp b/examples/surfacechart/chartmodifier.cpp new file mode 100644 index 00000000..b685a680 --- /dev/null +++ b/examples/surfacechart/chartmodifier.cpp @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "chartmodifier.h" + +#include <qmath.h> + +#include <QDebug> + +QT_DATAVIS3D_USE_NAMESPACE + +ChartModifier::ChartModifier(Q3DSurface *chart) + : m_chart(chart), + m_xCount(10), + m_zCount(10) +{ +} + +ChartModifier::~ChartModifier() +{ + delete m_chart; +} + +void ChartModifier::toggleSmooth(bool enabled) +{ + qDebug() << "ChartModifier::toggleSmooth " << enabled; + m_chart->setSmoothSurface(enabled); +} + +void ChartModifier::toggleSurfaceGrid(bool enable) +{ + qDebug() << "ChartModifier::toggleSurfaceGrid" << enable; + m_chart->setSurfaceGrid(enable); +} + +void ChartModifier::toggleSqrtSin(bool enable) +{ + qreal biggest = -9999.0; + qreal smallest = 9999.0; + QList<qreal> series; + + if (enable) { + qDebug() << "Create Sqrt&Sin surface, (" << m_xCount << ", " << m_zCount << ")"; + + qreal stepZ = 16.0 / qreal(m_zCount); + qreal stepX = 16.0 / qreal(m_xCount); + + for (qreal i = -8.0 + stepZ / 2.0 ; i < 8.0 ; i += stepZ) { + for (qreal j = -8.0 + stepX / 2.0; j < 8.0; j += stepX) { + qreal R = qSqrt(i*i + j*j) + 0.01; + qreal y = (sin(R)/R + 0.24) * 1.61; + series << y; + if (y > biggest) biggest = y; + if (y < smallest) smallest = y; + } + } + + m_chart->setSegmentCount(4, 0.5f); + m_chart->appendSeries(series, m_xCount, m_zCount); + + qDebug() << "biggest = " << biggest << ", smallest = " << smallest; + } else { + qDebug() << "Remove surface"; + } +} + +void ChartModifier::togglePlane(bool enable) +{ + qDebug() << "ChartModifier::togglePlane " << enable; + if (enable) { + QList<qreal> series; + + qreal y = 2.0 / qreal(m_zCount - 1); + for (int i = 0; i < m_zCount; i++) { + for (int j = 0; j < m_xCount; j++) { + series << i * y; + } + } + + m_chart->setSegmentCount(4, 0.5f); + m_chart->appendSeries(series, m_xCount, m_zCount); + } +} + +void ChartModifier::toggleGridSliderLock(bool enable) +{ + m_gridSlidersLocked = enable; + if (m_gridSlidersLocked) { + m_gridSliderZ->setEnabled(false); + m_gridSliderZ->setValue(m_gridSliderX->value()); + } else { + m_gridSliderZ->setEnabled(true); + } +} + +void ChartModifier::adjustXCount(int count) +{ + m_xCount = count; + if (m_gridSlidersLocked) + m_gridSliderZ->setValue(count); + + qDebug() << "X count = " << count; +} + +void ChartModifier::adjustZCount(int count) +{ + m_zCount = count; + + qDebug() << "Z count = " << count; +} + diff --git a/examples/surfacechart/chartmodifier.h b/examples/surfacechart/chartmodifier.h new file mode 100644 index 00000000..3ab2d179 --- /dev/null +++ b/examples/surfacechart/chartmodifier.h @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CHARTMODIFIER_H +#define CHARTMODIFIER_H + +#include <QtDataVis3D/Q3DSurface> +#include <QSlider> + +using namespace QtDataVis3D; + +class ChartModifier : public QObject +{ + Q_OBJECT +public: + explicit ChartModifier(Q3DSurface *chart); + ~ChartModifier(); + + void toggleSmooth(bool enabled); + void toggleSurfaceGrid(bool enable); + void toggleSqrtSin(bool enable); + void togglePlane(bool enable); + void toggleGridSliderLock(bool enable); + void setGridSliderX(QSlider *slider) { m_gridSliderX = slider; } + void setGridSliderZ(QSlider *slider) { m_gridSliderZ = slider; } + void adjustXCount(int count); + void adjustZCount(int count); + +private: + Q3DSurface *m_chart; + QSlider *m_gridSliderX; + QSlider *m_gridSliderZ; + bool m_gridSlidersLocked; + int m_xCount; + int m_zCount; +}; + +#endif // CHARTMODIFIER_H diff --git a/examples/surfacechart/main.cpp b/examples/surfacechart/main.cpp new file mode 100644 index 00000000..1297d92b --- /dev/null +++ b/examples/surfacechart/main.cpp @@ -0,0 +1,171 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "chartmodifier.h" + +#include <QApplication> +#include <QApplication> +#include <QWidget> +#include <QHBoxLayout> +#include <QVBoxLayout> +#include <QPushButton> +#include <QCheckBox> +#include <QSlider> +#include <QLabel> +#include <QScreen> +#include <QPainter> +#include <QDebug> + +using namespace QtDataVis3D; + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QWidget *widget = new QWidget; + QHBoxLayout *hLayout = new QHBoxLayout(widget); + QVBoxLayout *vLayout = new QVBoxLayout(); + vLayout->setAlignment(Qt::AlignTop); + + Q3DSurface *surfaceChart = new Q3DSurface(); + QSize screenSize = surfaceChart->screen()->size(); + + QWidget *container = QWidget::createWindowContainer(surfaceChart); + 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("Surface tester")); + + hLayout->addWidget(container, 1); + hLayout->addLayout(vLayout); + + QCheckBox *smoothCB = new QCheckBox(widget); + smoothCB->setText(QStringLiteral("Smooth ")); + smoothCB->setChecked(surfaceChart->smoothSurface()); + + QCheckBox *surfaceGridCB = new QCheckBox(widget); + surfaceGridCB->setText(QStringLiteral("Surface Grid")); + surfaceGridCB->setChecked(true); + + QCheckBox *sqrtSinCB = new QCheckBox(widget); + sqrtSinCB->setText(QStringLiteral("Sqrt & Sin")); + sqrtSinCB->setChecked(false); + + QCheckBox *planeCB = new QCheckBox(widget); + planeCB->setText(QStringLiteral("Plane")); + planeCB->setChecked(false); + + QCheckBox *gridSlidersLockCB = new QCheckBox(widget); + gridSlidersLockCB->setText(QStringLiteral("Lock")); + gridSlidersLockCB->setChecked(false); + + QSlider *gridSliderX = new QSlider(Qt::Horizontal, widget); + gridSliderX->setTickInterval(1); + gridSliderX->setMinimum(2); + gridSliderX->setValue(10); + gridSliderX->setMaximum(200); + gridSliderX->setEnabled(true); + QSlider *gridSliderZ = new QSlider(Qt::Horizontal, widget); + gridSliderZ->setTickInterval(1); + gridSliderZ->setMinimum(2); + gridSliderZ->setValue(10); + gridSliderZ->setMaximum(200); + gridSliderZ->setEnabled(true); + + QLinearGradient gr(0, 0, 100, 1); + gr.setColorAt(0.0, Qt::green); + gr.setColorAt(0.5, Qt::yellow); + gr.setColorAt(1.0, Qt::red); + QPixmap pm(100, 24); + QPainter pmp(&pm); + pmp.setBrush(QBrush(gr)); + pmp.setPen(Qt::NoPen); + pmp.drawRect(0, 0, 100, 24); + //pm.save("C:\\Users\\misalmel\\Work\\test.png", "png"); + QPushButton *color = new QPushButton(); + color->setIcon(QIcon(pm)); + color->setIconSize(QSize(100, 24)); + color->setFlat(true); + + // Add controls to the layout + vLayout->addWidget(smoothCB); + vLayout->addWidget(surfaceGridCB); + vLayout->addWidget(new QLabel(QStringLiteral("Select surface sample"))); + vLayout->addWidget(sqrtSinCB); + vLayout->addWidget(planeCB); + vLayout->addWidget(new QLabel(QStringLiteral("Adjust sample count"))); + vLayout->addWidget(gridSlidersLockCB); + vLayout->addWidget(gridSliderX); + vLayout->addWidget(gridSliderZ); + vLayout->addWidget(color); + + widget->show(); + + ChartModifier *modifier = new ChartModifier(surfaceChart); + + // Connect controls to slots on modifier + QObject::connect(smoothCB, &QCheckBox::stateChanged, + modifier, &ChartModifier::toggleSmooth); + QObject::connect(surfaceGridCB, &QCheckBox::stateChanged, + modifier, &ChartModifier::toggleSurfaceGrid); + QObject::connect(sqrtSinCB, &QCheckBox::stateChanged, + modifier, &ChartModifier::toggleSqrtSin); + QObject::connect(planeCB, &QCheckBox::stateChanged, + modifier, &ChartModifier::togglePlane); + QObject::connect(gridSlidersLockCB, &QCheckBox::stateChanged, + modifier, &ChartModifier::toggleGridSliderLock); + QObject::connect(gridSliderX, &QSlider::valueChanged, + modifier, &ChartModifier::adjustXCount); + QObject::connect(gridSliderZ, &QSlider::valueChanged, + modifier, &ChartModifier::adjustZCount); + + modifier->setGridSliderZ(gridSliderZ); + modifier->setGridSliderX(gridSliderX); + modifier->toggleGridSliderLock(gridSlidersLockCB->checkState()); + +// QList<qreal> lowList; +// lowList << 15.0 << 35.0 << 55.0 << 75.0 << 80.0 << 75.0 << 55.0 << 35.0 << 15.0; +// lowList << 65.0 << 105.0 << 135.0 << 155.0 << 190.0 << 155.0 << 135.0 << 105.0 << 65.0; +// lowList << 105.0 << 170.0 << 215.0 << 240.0 << 245.0 << 240.0 << 215.0 << 170.0 << 105.0; +// lowList << 65.0 << 105.0 << 135.0 << 155.0 << 190.0 << 155.0 << 135.0 << 105.0 << 65.0; +// lowList << 15.0 << 35.0 << 55.0 << 75.0 << 80.0 << 75.0 << 55.0 << 35.0 << 16.1; + +// lowList << 15.0 << 65.0 << 105.0 << 65.0 << 15.0; +// lowList << 35.0 << 105.0 << 170.0 << 105.0 << 35; +// lowList << 55.0 << 135.0 << 215.0 << 135.0 << 55; +// lowList << 75.0 << 155.0 << 240.0 << 155.0 << 75; +// lowList << 80.0 << 190.0 << 245.0 << 190.0 << 80; +// lowList << 75.0 << 155.0 << 240.0 << 155.0 << 75.0; +// lowList << 55.0 << 135.0 << 215.0 << 135.0 << 55; +// lowList << 35.0 << 105.0 << 170.0 << 105.0 << 35.0; +// lowList << 15.0 << 65.0 << 105.0 << 65.0 << 16.1; + +// surfaceChart->appendSeries(lowList, 9, 5); + +// QList<qreal> topList; +// topList << 2.1 << 2.2; +// surfaceChart.appendSeries(topList); + +// surfaceChart.resize(screenSize.width() / 1.5, screenSize.height() / 1.5); +// surfaceChart.setPosition(screenSize.width() / 6, screenSize.height() / 6); +// surfaceChart.show(); + + return app.exec(); +} diff --git a/examples/surfacechart/surfacechart.pro b/examples/surfacechart/surfacechart.pro new file mode 100644 index 00000000..79fd967d --- /dev/null +++ b/examples/surfacechart/surfacechart.pro @@ -0,0 +1,11 @@ +!include( ../examples.pri ) { + error( "Couldn't find the examples.pri file!" ) +} + +SOURCES += main.cpp \ + chartmodifier.cpp + +INSTALLS += target + +HEADERS += \ + chartmodifier.h diff --git a/examples/widget/chart.cpp b/examples/widget/chart.cpp index c57a6752..a8c6c14a 100644 --- a/examples/widget/chart.cpp +++ b/examples/widget/chart.cpp @@ -1,46 +1,28 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the documentation of QtDataVis3D module. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ #include "chart.h" +#include <QtDataVis3D/qcategoryaxis.h> +#include <QtDataVis3D/qvalueaxis.h> +#include <QtDataVis3D/qbardataproxy.h> +#include <QTime> -using namespace QtDataVis3D; +QT_DATAVIS3D_USE_NAMESPACE const QString celsiusString = QString(QChar(0xB0)) + "C"; @@ -56,11 +38,25 @@ ChartModifier::ChartModifier(Q3DBars *barchart) m_barSpacingX(0.1f), m_barSpacingZ(0.1f), m_fontSize(20), - m_ticks(20), - m_tickStep(1), - m_minval(-15.2f) + m_segments(4), + m_subSegments(3), + m_minval(-20.0), // TODO Barchart Y-axis currently only properly supports zero-centered ranges + m_maxval(20.0) { // Don't set any styles or specifications, start from defaults + // Generate generic labels + for (int i = 0; i < 200; i++) { + if (i % 5) + m_genericRowLabels << QString(); + else + m_genericRowLabels << QStringLiteral("Row %1").arg(i); + } + for (int i = 0; i < 200; i++) { + if (i % 5) + m_genericColumnLabels << QString(); + else + m_genericColumnLabels << QStringLiteral("Column %1").arg(i); + } } ChartModifier::~ChartModifier() @@ -81,16 +77,27 @@ void ChartModifier::restart(bool dynamicData) if (m_static) { start(); // Set selection mode to zoom row - m_chart->setSelectionMode(ModeZoomRow); + m_chart->setSelectionMode(QDataVis::ModeZoomRow); m_chart->setFont(QFont("Times Roman", 20)); - m_chart->setTickCount(m_ticks, m_tickStep, m_minval); } else { + m_chart->dataProxy()->resetArray(0); // Set up sample space - m_chart->setupSampleSpace(m_columnCount, m_rowCount); + m_chart->setupSampleSpace(m_rowCount, m_columnCount); // Set selection mode to full - m_chart->setSelectionMode(ModeBarRowAndColumn); - // Reset tick count to default - m_chart->setTickCount(0, 0); + m_chart->setSelectionMode(QDataVis::ModeItemRowAndColumn); + m_chart->valueAxis()->setSegmentCount(m_segments * 2); + m_chart->valueAxis()->setSubSegmentCount(0); + m_chart->valueAxis()->setAutoAdjustRange(true); + + m_chart->rowAxis()->setTitle("Generic Row"); + m_chart->columnAxis()->setTitle("Generic Column"); + m_chart->valueAxis()->setTitle("Generic Value"); + + if (m_chart->rowAxis()->labels().size() < m_rowCount) + m_chart->rowAxis()->setCategoryLabels(m_genericRowLabels.mid(0, m_rowCount)); + + if (m_chart->columnAxis()->labels().size() < m_rowCount) + m_chart->columnAxis()->setCategoryLabels(m_genericColumnLabels.mid(0, m_columnCount)); } } @@ -103,9 +110,9 @@ void ChartModifier::addDataSet() m_chart->setWindowTitle(QStringLiteral("Average temperatures in Oulu, Finland (2006-2012)")); // Set up row and column names - QVector<QString> months; + QStringList months; months << "January" << "February" << "March" << "April" << "May" << "June" << "July" << "August" << "September" << "October" << "November" << "December"; - QVector<QString> years; + QStringList years; years << "2006" << "2007" << "2008" << "2009" << "2010" << "2011" << "2012"; // Set up data @@ -117,46 +124,126 @@ void ChartModifier::addDataSet() {-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(); + // Use default data proxy to feed data directly in expected format + QBarDataProxy *proxy = m_chart->dataProxy(); + proxy->setItemLabelFormat(celsiusString); // Add labels - dataSet->setLabels("Year", "Month", "Average temperature (" + celsiusString + ")", - years, months); + m_chart->rowAxis()->setTitle("Year"); + m_chart->columnAxis()->setTitle("Month"); + m_chart->valueAxis()->setTitle("Average temperature (" + celsiusString + ")"); + m_chart->rowAxis()->setCategoryLabels(years); + m_chart->columnAxis()->setCategoryLabels(months); + m_chart->valueAxis()->setSegmentCount(m_segments); + m_chart->valueAxis()->setSubSegmentCount(m_subSegments); + m_chart->valueAxis()->setRange(m_minval, m_maxval); // Create data rows - QDataRow *dataRow; + QBarDataArray *dataSet = new QBarDataArray; + QBarDataRow *dataRow; + + dataSet->reserve(years.size()); for (int year = 0; year < years.size(); year++) { - dataRow = new QDataRow(years.at(year)); + dataRow = new QBarDataRow(months.size()); // Create data items for (int month = 0; month < months.size(); month++) { // Add data to rows - dataRow->addItem(new QDataItem(temp[year][month], celsiusString)); + (*dataRow)[month].setValue(temp[year][month]); } // Add row to set - dataSet->addRow(dataRow); - // Get next pointer - dataRow++; + dataSet->append(dataRow); } - // Set tick count (4 steps of 5 degrees, with absolute minimum of -16C, even though we don't have quite that low temperatures in the data) - //m_chart->setTickCount(4, 5, -16.0f); - // ..or 20 steps of 1 degree, with absolute minimum of -15.2C - m_chart->setTickCount(m_ticks, m_tickStep, m_minval); - // Set up sample space based on prepared data - m_chart->setupSampleSpace(months.size(), years.size()); + m_chart->setupSampleSpace(years.size(), months.size()); + + // Add data to chart (chart assumes ownership) + proxy->resetArray(dataSet); +} + +void ChartModifier::addRow() +{ + QBarDataRow *dataRow = new QBarDataRow(m_columnCount); + for (float i = 0; i < m_columnCount; i++) { + (*dataRow)[i].setValue(((i + 1) / (float)m_columnCount) * (float)(rand() % 100)); + //(*dataRow)[i].setValue(i + m_chart->dataProxy()->rowCount()); + } + m_chart->dataProxy()->insertRow(0, dataRow); +} + +void ChartModifier::addRows() +{ + QTime timer; + timer.start(); + QBarDataArray dataArray; + for (int i = 0; i < m_rowCount; i++) { + QBarDataRow *dataRow = new QBarDataRow(m_columnCount); + for (int j = 0; j < m_columnCount; j++) + (*dataRow)[j].setValue(qreal(j + i + m_chart->dataProxy()->rowCount())); + dataArray.append(dataRow); + } + m_chart->dataProxy()->insertRows(0, dataArray); + qDebug() << "Added" << m_rowCount << "rows, time:" << timer.elapsed(); +} + +void ChartModifier::changeItem() +{ + // TODO fix to use actual selected item, for now just assume some row/column are selected + int row = qMin(4, (m_chart->dataProxy()->rowCount() - 1)); + if (row >= 0) { + int column = qMin(4, (m_chart->dataProxy()->rowAt(row)->size() - 1)); + if (column >= 0) { + QBarDataItem item(qreal(rand() % 100)); + m_chart->dataProxy()->setItem(row, column, item); + } + } +} + +void ChartModifier::changeRow() +{ + // TODO fix to use actual selected item, for now just assume some is selected + int row = qMin(4, (m_chart->dataProxy()->rowCount() - 1)); + if (row >= 0) { + QBarDataRow *newRow = new QBarDataRow(m_chart->dataProxy()->rowAt(row)->size()); + for (int i = 0; i < newRow->size(); i++) + (*newRow)[i].setValue(qreal(rand() % 100)); + m_chart->dataProxy()->setRow(row, newRow); + } +} + +void ChartModifier::changeRows() +{ + // TODO fix to use actual selected item, for now just assume some is selected + int row = qMin(4, (m_chart->dataProxy()->rowCount() - 1)); + if (row >= 0) { + int startRow = qMax(row - 2, 0); + QBarDataArray newArray; + for (int i = startRow; i <= row; i++ ) { + QBarDataRow *newRow = new QBarDataRow(m_chart->dataProxy()->rowAt(i)->size()); + for (int j = 0; j < newRow->size(); j++) + (*newRow)[j].setValue(qreal(rand() % 100)); + newArray.append(newRow); + } + m_chart->dataProxy()->setRows(startRow, newArray); + } +} - // Add data to chart - m_chart->addDataSet(dataSet); +void ChartModifier::removeRow() +{ + // TODO fix to use actual selected item, for now just assume some is selected + int row = qMin(4, (m_chart->dataProxy()->rowCount() - 1)); + if (row >= 0) + m_chart->dataProxy()->removeRows(row, 1); } -void ChartModifier::addBars() +void ChartModifier::removeRows() { - 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); + // TODO fix to use actual selected item, for now just assume some is selected + int row = qMin(4, (m_chart->dataProxy()->rowCount() - 1)); + if (row >= 0) { + int startRow = qMax(row - 2, 0); + m_chart->dataProxy()->removeRows(startRow, 3); + } } void ChartModifier::changeStyle() @@ -164,34 +251,34 @@ void ChartModifier::changeStyle() static int model = 0; switch (model) { case 0: - m_chart->setBarType(Cylinders, false); + m_chart->setBarType(QDataVis::Cylinders, false); break; case 1: - m_chart->setBarType(Cylinders, true); + m_chart->setBarType(QDataVis::Cylinders, true); break; case 2: - m_chart->setBarType(Cones, false); + m_chart->setBarType(QDataVis::Cones, false); break; case 3: - m_chart->setBarType(Cones, true); + m_chart->setBarType(QDataVis::Cones, true); break; case 4: - m_chart->setBarType(Bars, false); + m_chart->setBarType(QDataVis::Bars, false); break; case 5: - m_chart->setBarType(Bars, true); + m_chart->setBarType(QDataVis::Bars, true); break; case 6: - m_chart->setBarType(Pyramids, false); + m_chart->setBarType(QDataVis::Pyramids, false); break; case 7: - m_chart->setBarType(Pyramids, true); + m_chart->setBarType(QDataVis::Pyramids, true); break; case 8: - m_chart->setBarType(BevelBars, false); + m_chart->setBarType(QDataVis::BevelBars, false); break; case 9: - m_chart->setBarType(BevelBars, true); + m_chart->setBarType(QDataVis::BevelBars, true); break; } model++; @@ -201,42 +288,42 @@ void ChartModifier::changeStyle() void ChartModifier::changePresetCamera() { - static int preset = PresetFrontLow; + static int preset = QDataVis::PresetFrontLow; - m_chart->setCameraPreset((CameraPreset)preset); + m_chart->setCameraPreset((QDataVis::CameraPreset)preset); - if (++preset > PresetDirectlyBelow) - preset = PresetFrontLow; + if (++preset > QDataVis::PresetDirectlyBelow) + preset = QDataVis::PresetFrontLow; } void ChartModifier::changeTheme() { - static int theme = ThemeSystem; + static int theme = QDataVis::ThemeSystem; - m_chart->setTheme((ColorTheme)theme); + m_chart->setTheme((QDataVis::ColorTheme)theme); - if (++theme > ThemeLight) - theme = ThemeSystem; + if (++theme > QDataVis::ThemeLight) + theme = QDataVis::ThemeSystem; } void ChartModifier::changeTransparency() { - static int transparency = TransparencyNone; + static int transparency = QDataVis::TransparencyNone; - m_chart->setLabelTransparency((LabelTransparency)transparency); + m_chart->setLabelTransparency((QDataVis::LabelTransparency)transparency); - if (++transparency > TransparencyNoBackground) - transparency = TransparencyFromTheme; + if (++transparency > QDataVis::TransparencyNoBackground) + transparency = QDataVis::TransparencyFromTheme; } void ChartModifier::changeSelectionMode() { - static int selectionMode = ModeNone; + static int selectionMode = QDataVis::ModeNone; - m_chart->setSelectionMode((SelectionMode)selectionMode); + m_chart->setSelectionMode((QDataVis::SelectionMode)selectionMode); - if (++selectionMode > ModeZoomColumn) - selectionMode = ModeNone; + if (++selectionMode > QDataVis::ModeZoomColumn) + selectionMode = QDataVis::ModeNone; } void ChartModifier::changeFont(const QFont &font) @@ -253,31 +340,51 @@ void ChartModifier::changeFontSize(int fontsize) m_chart->setFontSize((GLfloat)m_fontSize); } +void ChartModifier::shadowQualityUpdatedByVisual(QDataVis::ShadowQuality sq) +{ + int quality = 0; + switch (sq) { + case QDataVis::ShadowLow: + quality = 1; + break; + case QDataVis::ShadowMedium: + quality = 2; + break; + case QDataVis::ShadowHigh: + quality = 3; + break; + } + + // Updates the UI component to show correct shadow quality + emit shadowQualityChanged(quality); +} + void ChartModifier::changeShadowQuality(int quality) { - ShadowQuality sq = ShadowNone; + QDataVis::ShadowQuality sq = QDataVis::ShadowNone; switch (quality) { case 1: - sq = ShadowLow; + sq = QDataVis::ShadowLow; break; case 2: - sq = ShadowMedium; + sq = QDataVis::ShadowMedium; break; case 3: - sq = ShadowHigh; + sq = QDataVis::ShadowHigh; break; } m_chart->setShadowQuality(sq); + emit shadowQualityChanged(quality); } void ChartModifier::setBackgroundEnabled(int enabled) { - m_chart->setBackgroundEnabled((bool)enabled); + m_chart->setBackgroundVisible((bool)enabled); } void ChartModifier::setGridEnabled(int enabled) { - m_chart->setGridEnabled((bool)enabled); + m_chart->setGridVisible((bool)enabled); } void ChartModifier::rotateX(int rotation) @@ -319,11 +426,15 @@ void ChartModifier::setSpacingSpecsZ(int spacing) void ChartModifier::setSampleCountX(int samples) { m_columnCount = samples; - m_chart->setupSampleSpace(m_columnCount, m_rowCount); + m_chart->setupSampleSpace(m_rowCount, m_columnCount); + if (m_chart->columnAxis()->labels().size() < m_columnCount) + m_chart->columnAxis()->setCategoryLabels(m_genericColumnLabels.mid(0, m_columnCount)); } void ChartModifier::setSampleCountZ(int samples) { m_rowCount = samples; - m_chart->setupSampleSpace(m_columnCount, m_rowCount); + m_chart->setupSampleSpace(m_rowCount, m_columnCount); + if (m_chart->rowAxis()->labels().size() < m_rowCount) + m_chart->rowAxis()->setCategoryLabels(m_genericRowLabels.mid(0, m_rowCount)); } diff --git a/examples/widget/chart.h b/examples/widget/chart.h index f4ef747b..67280e13 100644 --- a/examples/widget/chart.h +++ b/examples/widget/chart.h @@ -1,51 +1,29 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the documentation of QtDataVis3D module. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ #ifndef CHARTMODIFIER_H #define CHARTMODIFIER_H -#include "q3dbars.h" -#include "qdataset.h" +#include <QtDataVis3D/q3dbars.h> #include <QFont> #include <QDebug> +#include <QStringList> using namespace QtDataVis3D; @@ -57,7 +35,13 @@ public: ~ChartModifier(); void addDataSet(); - void addBars(); + void addRow(); + void addRows(); + void changeItem(); + void changeRow(); + void changeRows(); + void removeRow(); + void removeRows(); void changeStyle(); void changePresetCamera(); void changeTheme(); @@ -80,6 +64,10 @@ public: public slots: void changeShadowQuality(int quality); + void shadowQualityUpdatedByVisual(QDataVis::ShadowQuality shadowQuality); + +signals: + void shadowQualityChanged(int quality); private: Q3DBars *m_chart; @@ -93,9 +81,12 @@ private: float m_barSpacingX; float m_barSpacingZ; int m_fontSize; - int m_ticks; - float m_tickStep; - float m_minval; + int m_segments; + int m_subSegments; + qreal m_minval; + qreal m_maxval; + QStringList m_genericRowLabels; + QStringList m_genericColumnLabels; }; #endif diff --git a/examples/widget/doc/src/widget.qdoc b/examples/widget/doc/src/widget.qdoc index d8790a60..6645d356 100644 --- a/examples/widget/doc/src/widget.qdoc +++ b/examples/widget/doc/src/widget.qdoc @@ -1,27 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the documentation of the QtDataVis3D module. +** This file is part 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 +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. 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. +** a written agreement between you and Digia. ** -** 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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ diff --git a/examples/widget/main.cpp b/examples/widget/main.cpp index 1b33b177..47892484 100644 --- a/examples/widget/main.cpp +++ b/examples/widget/main.cpp @@ -1,40 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com ** -** This file is part of the documentation of QtDataVis3D module. +** This file is part of the QtDataVis3D module. ** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. ** -** "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$ +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com ** ****************************************************************************/ @@ -75,9 +53,33 @@ int main(int argc, char **argv) hLayout->addLayout(vLayout); QPushButton *dataButton = new QPushButton(widget); - dataButton->setText(QStringLiteral("Add a row of random data")); + dataButton->setText(QStringLiteral("Insert a row of data")); dataButton->setEnabled(false); + QPushButton *multiDataButton = new QPushButton(widget); + multiDataButton->setText(QStringLiteral("Insert many rows of data")); + multiDataButton->setEnabled(false); + + QPushButton *changeSingleDataButton = new QPushButton(widget); + changeSingleDataButton->setText(QStringLiteral("Change selected bar value")); + changeSingleDataButton->setEnabled(false); + + QPushButton *changeRowButton = new QPushButton(widget); + changeRowButton->setText(QStringLiteral("Change selected row values")); + changeRowButton->setEnabled(false); + + QPushButton *changeRowsButton = new QPushButton(widget); + changeRowsButton->setText(QStringLiteral("Change three rows from selected")); + changeRowsButton->setEnabled(false); + + QPushButton *removeRowButton = new QPushButton(widget); + removeRowButton->setText(QStringLiteral("Remove selected row")); + removeRowButton->setEnabled(false); + + QPushButton *removeRowsButton = new QPushButton(widget); + removeRowsButton->setText(QStringLiteral("remove three rows from selected")); + removeRowsButton->setEnabled(false); + QPushButton *themeButton = new QPushButton(widget); themeButton->setText(QStringLiteral("Change theme")); @@ -147,13 +149,13 @@ int main(int argc, char **argv) sampleSliderX->setTickInterval(1); sampleSliderX->setMinimum(2); sampleSliderX->setValue(10); - sampleSliderX->setMaximum(100); + sampleSliderX->setMaximum(200); sampleSliderX->setEnabled(false); QSlider *sampleSliderZ = new QSlider(Qt::Horizontal, widget); sampleSliderZ->setTickInterval(1); sampleSliderZ->setMinimum(2); sampleSliderZ->setValue(10); - sampleSliderZ->setMaximum(100); + sampleSliderZ->setMaximum(200); sampleSliderZ->setEnabled(false); QSlider *fontSizeSlider = new QSlider(Qt::Horizontal, widget); @@ -185,6 +187,12 @@ int main(int argc, char **argv) vLayout->addWidget(sampleSliderX, 0, Qt::AlignTop); vLayout->addWidget(sampleSliderZ, 1, Qt::AlignTop); vLayout->addWidget(dataButton, 0, Qt::AlignTop); + vLayout->addWidget(multiDataButton, 0, Qt::AlignTop); + vLayout->addWidget(changeSingleDataButton, 0, Qt::AlignTop); + vLayout->addWidget(changeRowButton, 0, Qt::AlignTop); + vLayout->addWidget(changeRowsButton, 0, Qt::AlignTop); + vLayout->addWidget(removeRowButton, 0, Qt::AlignTop); + vLayout->addWidget(removeRowsButton, 0, Qt::AlignTop); vLayout->addWidget(themeButton, 0, Qt::AlignTop); vLayout->addWidget(labelButton, 0, Qt::AlignTop); vLayout->addWidget(styleButton, 0, Qt::AlignTop); @@ -222,6 +230,10 @@ int main(int argc, char **argv) QObject::connect(shadowQuality, SIGNAL(currentIndexChanged(int)), modifier, SLOT(changeShadowQuality(int))); + QObject::connect(modifier, &ChartModifier::shadowQualityChanged, shadowQuality, + &QComboBox::setCurrentIndex); + QObject::connect(widgetchart, &Q3DBars::shadowQualityChanged, modifier, + &ChartModifier::shadowQualityUpdatedByVisual); QObject::connect(fontSizeSlider, &QSlider::valueChanged, modifier, &ChartModifier::changeFontSize); @@ -232,7 +244,13 @@ int main(int argc, char **argv) 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(dataButton, &QPushButton::clicked, modifier, &ChartModifier::addRow); + QObject::connect(multiDataButton, &QPushButton::clicked, modifier, &ChartModifier::addRows); + QObject::connect(changeSingleDataButton, &QPushButton::clicked, modifier, &ChartModifier::changeItem); + QObject::connect(changeRowButton, &QPushButton::clicked, modifier, &ChartModifier::changeRow); + QObject::connect(changeRowsButton, &QPushButton::clicked, modifier, &ChartModifier::changeRows); + QObject::connect(removeRowButton, &QPushButton::clicked, modifier, &ChartModifier::removeRow); + QObject::connect(removeRowsButton, &QPushButton::clicked, modifier, &ChartModifier::removeRows); QObject::connect(selectionButton, &QPushButton::clicked, modifier, &ChartModifier::changeSelectionMode); @@ -255,6 +273,18 @@ int main(int argc, char **argv) QObject::connect(staticCheckBox, &QCheckBox::stateChanged, dataButton, &QPushButton::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, multiDataButton, + &QPushButton::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeSingleDataButton, + &QPushButton::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeRowButton, + &QPushButton::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeRowsButton, + &QPushButton::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, removeRowButton, + &QPushButton::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, removeRowsButton, + &QPushButton::setEnabled); QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderX, &QSlider::setEnabled); QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderZ, diff --git a/examples/widget/widget.pro b/examples/widget/widget.pro index 1d7e91be..2b4078a4 100644 --- a/examples/widget/widget.pro +++ b/examples/widget/widget.pro @@ -5,6 +5,6 @@ SOURCES += main.cpp chart.cpp HEADERS += chart.h -QT += datavis3d widgets +QT += widgets INSTALLS += target |