diff options
Diffstat (limited to 'tests')
38 files changed, 951 insertions, 1017 deletions
diff --git a/tests/barstest/barstest.pro b/tests/barstest/barstest.pro index 108f8aa7..f213ea9e 100644 --- a/tests/barstest/barstest.pro +++ b/tests/barstest/barstest.pro @@ -6,5 +6,3 @@ SOURCES += main.cpp chart.cpp custominputhandler.cpp HEADERS += chart.h custominputhandler.h QT += widgets - -INSTALLS += target diff --git a/tests/barstest/chart.cpp b/tests/barstest/chart.cpp index 8ab619ec..e7a0e2ca 100644 --- a/tests/barstest/chart.cpp +++ b/tests/barstest/chart.cpp @@ -1095,10 +1095,8 @@ void GraphModifier::triggerRotation() } else { // Rotate the first series instead static float seriesAngle = 0.0f; - if (m_graph->seriesList().size()) { - QQuaternion rotation = QQuaternion::fromAxisAndAngle(0.0f, 1.0f, 0.0f, seriesAngle++); - m_graph->seriesList().at(0)->setMeshRotation(rotation); - } + if (m_graph->seriesList().size()) + m_graph->seriesList().at(0)->setMeshAngle(seriesAngle++); } } diff --git a/tests/directional/directional.pro b/tests/directional/directional.pro index 7138e1f2..25b2a1f6 100644 --- a/tests/directional/directional.pro +++ b/tests/directional/directional.pro @@ -6,5 +6,3 @@ SOURCES += main.cpp scatterdatamodifier.cpp HEADERS += scatterdatamodifier.h QT += widgets - -INSTALLS += target diff --git a/tests/directional/main.cpp b/tests/directional/main.cpp index f4871a70..2b077b97 100644 --- a/tests/directional/main.cpp +++ b/tests/directional/main.cpp @@ -32,11 +32,9 @@ int main(int argc, char **argv) { - //! [0] QApplication app(argc, argv); Q3DScatter *graph = new Q3DScatter(); QWidget *container = QWidget::createWindowContainer(graph); - //! [0] QSize screenSize = graph->screen()->size(); container->setMinimumSize(QSize(screenSize.width() / 2, screenSize.height() / 1.5)); @@ -44,17 +42,14 @@ int main(int argc, char **argv) container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); container->setFocusPolicy(Qt::StrongFocus); - //! [1] QWidget *widget = new QWidget; QHBoxLayout *hLayout = new QHBoxLayout(widget); QVBoxLayout *vLayout = new QVBoxLayout(); hLayout->addWidget(container, 1); hLayout->addLayout(vLayout); - //! [1] widget->setWindowTitle(QStringLiteral("Directional scatter")); - //! [4] QComboBox *themeList = new QComboBox(widget); themeList->addItem(QStringLiteral("Qt")); themeList->addItem(QStringLiteral("Primary Colors")); @@ -79,7 +74,7 @@ int main(int argc, char **argv) cameraButton->setText(QStringLiteral("Change camera preset")); QPushButton *toggleRotationButton = new QPushButton(widget); - toggleRotationButton->setText(QStringLiteral("Toggle rotation")); + toggleRotationButton->setText(QStringLiteral("Toggle animation")); QCheckBox *backgroundCheckBox = new QCheckBox(widget); backgroundCheckBox->setText(QStringLiteral("Show background")); @@ -101,9 +96,7 @@ int main(int argc, char **argv) QFontComboBox *fontList = new QFontComboBox(widget); fontList->setCurrentFont(QFont("Arial")); - //! [4] - //! [5] vLayout->addWidget(labelButton, 0, Qt::AlignTop); vLayout->addWidget(cameraButton, 0, Qt::AlignTop); vLayout->addWidget(toggleRotationButton, 0, Qt::AlignTop); @@ -117,13 +110,9 @@ int main(int argc, char **argv) vLayout->addWidget(shadowQuality); vLayout->addWidget(new QLabel(QStringLiteral("Change font"))); vLayout->addWidget(fontList, 1, Qt::AlignTop); - //! [5] - //! [2] ScatterDataModifier *modifier = new ScatterDataModifier(graph); - //! [2] - //! [6] QObject::connect(cameraButton, &QPushButton::clicked, modifier, &ScatterDataModifier::changePresetCamera); QObject::connect(toggleRotationButton, &QPushButton::clicked, modifier, @@ -159,12 +148,9 @@ int main(int argc, char **argv) QObject::connect(modifier, &ScatterDataModifier::fontChanged, fontList, &QFontComboBox::setCurrentFont); - //! [6] itemStyleList->setCurrentIndex(0); - //! [3] widget->show(); return app.exec(); - //! [3] } diff --git a/tests/directional/scatterdatamodifier.cpp b/tests/directional/scatterdatamodifier.cpp index 96a7b975..1422cebb 100644 --- a/tests/directional/scatterdatamodifier.cpp +++ b/tests/directional/scatterdatamodifier.cpp @@ -32,7 +32,7 @@ const int numberOfCols = 8; const int numberOfRows = 8; const float limit = 8.0f; const float PI = 3.14159f; -//#define HEDGEHOG +#define HEDGEHOG ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter) : m_graph(scatter), diff --git a/tests/kinectsurface/main.cpp b/tests/kinectsurface/main.cpp index 1e7fe118..60465915 100644 --- a/tests/kinectsurface/main.cpp +++ b/tests/kinectsurface/main.cpp @@ -71,46 +71,63 @@ int main(int argc, char **argv) hLayout->addLayout(vLayout); QPushButton *startButton = new QPushButton(widget); + startButton->setFont(QFont("Arial", 30)); startButton->setText(QStringLiteral("Start Kinect")); QPushButton *stopButton = new QPushButton(widget); + stopButton->setFont(QFont("Arial", 30)); stopButton->setText(QStringLiteral("Stop Kinect")); + QLabel *resolutionLabel = new QLabel(QStringLiteral("Change resolution")); + resolutionLabel->setFont(QFont("Arial", 15)); + QComboBox *resolutionBox = new QComboBox(widget); + resolutionBox->setFont(QFont("Arial", 30)); resolutionBox->addItem(QStringLiteral("Low")); resolutionBox->addItem(QStringLiteral("Medium")); resolutionBox->addItem(QStringLiteral("High")); resolutionBox->addItem(QStringLiteral("Max")); // Comment this out if demo machine is low-perf resolutionBox->setCurrentIndex(0); + QLabel *modeLabel = new QLabel(QStringLiteral("Change visualization type")); + modeLabel->setFont(QFont("Arial", 15)); + QComboBox *modeBox = new QComboBox(widget); + modeBox->setFont(QFont("Arial", 30)); modeBox->addItem(QStringLiteral("Surface Plot")); modeBox->addItem(QStringLiteral("Scatter Chart")); modeBox->addItem(QStringLiteral("Bar Chart")); modeBox->setCurrentIndex(0); + QLabel *distanceLabel = new QLabel(QStringLiteral("Adjust far distance")); + distanceLabel->setFont(QFont("Arial", 15)); + QSlider *distanceSlider = new QSlider(Qt::Horizontal, widget); + distanceSlider->setMinimumHeight(60); distanceSlider->setTickInterval(10); distanceSlider->setTickPosition(QSlider::TicksBelow); distanceSlider->setMinimum(10); distanceSlider->setValue(50); distanceSlider->setMaximum(200); + QLabel *gradientLabel = new QLabel(QStringLiteral("Change color scheme")); + gradientLabel->setFont(QFont("Arial", 15)); + QLinearGradient gradientOne(0, 0, 200, 1); gradientOne.setColorAt(0.0, Qt::black); gradientOne.setColorAt(0.33, Qt::blue); gradientOne.setColorAt(0.67, Qt::red); gradientOne.setColorAt(1.0, Qt::yellow); - QPixmap pm(200, 24); + QPixmap pm(200, 60); QPainter pmp(&pm); pmp.setBrush(QBrush(gradientOne)); pmp.setPen(Qt::NoPen); - pmp.drawRect(0, 0, 200, 24); + pmp.drawRect(0, 0, 200, 60); QPushButton *gradientOneButton = new QPushButton(widget); gradientOneButton->setIcon(QIcon(pm)); - gradientOneButton->setIconSize(QSize(200, 24)); + gradientOneButton->setIconSize(QSize(200, 60)); gradientOneButton->setToolTip(QStringLiteral("Colors: Thermal Imitation")); QLinearGradient gradientTwo(0, 0, 200, 1); @@ -120,11 +137,11 @@ int main(int argc, char **argv) pmp.setBrush(QBrush(gradientTwo)); pmp.setPen(Qt::NoPen); - pmp.drawRect(0, 0, 200, 24); + pmp.drawRect(0, 0, 200, 60); QPushButton *gradientTwoButton = new QPushButton(widget); gradientTwoButton->setIcon(QIcon(pm)); - gradientTwoButton->setIconSize(QSize(200, 24)); + gradientTwoButton->setIconSize(QSize(200, 60)); gradientTwoButton->setToolTip(QStringLiteral("Colors: Highlight Foreground")); QTextEdit *status = new QTextEdit(QStringLiteral("<b>Ready</b><br>"), widget); @@ -132,13 +149,13 @@ int main(int argc, char **argv) vLayout->addWidget(startButton); vLayout->addWidget(stopButton); - vLayout->addWidget(new QLabel(QStringLiteral("Change resolution"))); + vLayout->addWidget(resolutionLabel); vLayout->addWidget(resolutionBox); - vLayout->addWidget(new QLabel(QStringLiteral("Change visualization type"))); + vLayout->addWidget(modeLabel); vLayout->addWidget(modeBox); - vLayout->addWidget(new QLabel(QStringLiteral("Adjust far distance"))); + vLayout->addWidget(distanceLabel); vLayout->addWidget(distanceSlider); - vLayout->addWidget(new QLabel(QStringLiteral("Change color scheme"))); + vLayout->addWidget(gradientLabel); vLayout->addWidget(gradientOneButton); vLayout->addWidget(gradientTwoButton); vLayout->addWidget(status, 1, Qt::AlignBottom); diff --git a/tests/kinectsurface/surfacedata.cpp b/tests/kinectsurface/surfacedata.cpp index 85d048a5..14f37288 100644 --- a/tests/kinectsurface/surfacedata.cpp +++ b/tests/kinectsurface/surfacedata.cpp @@ -16,8 +16,6 @@ ** ****************************************************************************/ -#define NOMINMAX - #include "surfacedata.h" #include "QKinectWrapper.h" #include <QtDataVisualization/QValue3DAxis> @@ -32,44 +30,86 @@ using namespace QtDataVisualization; +//#define LOW_END_DEVICE // Uncomment for devices with limited processing/grpahics power + +#ifdef LOW_END_DEVICE +const QSize lowRes = QSize(160, 120); +const QSize medRes = QSize(192, 144); +const QSize hiRes = QSize(256, 192); +const QSize maxRes = QSize(320, 240); +#else +const QSize lowRes = QSize(320, 240); +const QSize medRes = QSize(384, 288); +const QSize hiRes = QSize(512, 384); +const QSize maxRes = QSize(640, 480); +#endif + SurfaceData::SurfaceData(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars, QTextEdit *statusArea) : + m_thermalTheme(new Q3DTheme(Q3DTheme::ThemeIsabelle)), + m_highlightTheme(new Q3DTheme(Q3DTheme::ThemeQt)), m_surface(surface), m_scatter(scatter), m_bars(bars), m_statusArea(statusArea), m_resize(true), - m_resolution(QSize(320, 240)), + m_resolution(lowRes), m_resolutionLevel(0), m_mode(Surface) { + // Initialize themes for surface + m_thermalTheme->setGridEnabled(false); + m_thermalTheme->setBackgroundEnabled(false); + m_thermalTheme->setColorStyle(Q3DTheme::ColorStyleRangeGradient); + QLinearGradient thermalGradient; + thermalGradient.setColorAt(0.0, Qt::black); + thermalGradient.setColorAt(0.33, Qt::blue); + thermalGradient.setColorAt(0.67, Qt::red); + thermalGradient.setColorAt(1.0, Qt::yellow); + QList<QLinearGradient> thermalGradients; + thermalGradients.append(thermalGradient); + m_thermalTheme->setBaseGradients(thermalGradients); + + m_highlightTheme->setGridEnabled(false); + m_highlightTheme->setBackgroundEnabled(false); + m_highlightTheme->setColorStyle(Q3DTheme::ColorStyleRangeGradient); + QLinearGradient highlightGradient; + highlightGradient.setColorAt(0.0, Qt::white); + highlightGradient.setColorAt(0.8, Qt::red); + highlightGradient.setColorAt(1.0, Qt::green); + QList<QLinearGradient> highlightGradients; + highlightGradients.append(highlightGradient); + m_highlightTheme->setBaseGradients(highlightGradients); + // Initialize surface - m_surface->activeTheme()->setType(Q3DTheme::ThemeIsabelle); + m_surface->setActiveTheme(m_thermalTheme); QLinearGradient gradient; gradient.setColorAt(0.0, Qt::black); gradient.setColorAt(0.33, Qt::blue); gradient.setColorAt(0.67, Qt::red); gradient.setColorAt(1.0, Qt::yellow); m_surface->setSelectionMode(QAbstract3DGraph::SelectionNone); - m_surface->activeTheme()->setGridEnabled(false); - m_surface->activeTheme()->setBackgroundEnabled(false); + m_surface->setShadowQuality(QAbstract3DGraph::ShadowQualityNone); m_surface->scene()->activeCamera()->setCameraPosition(0.0, 90.0, 150); m_surface->axisY()->setMax(255); QSurface3DSeries *series1 = new QSurface3DSeries(new QHeightMapSurfaceDataProxy()); series1->setFlatShadingEnabled(true); series1->setDrawMode(QSurface3DSeries::DrawSurface); - series1->setColorStyle(Q3DTheme::ColorStyleRangeGradient); - series1->setBaseGradient(gradient); m_surface->addSeries(series1); // Initialize scatter m_scatter->activeTheme()->setType(Q3DTheme::ThemeStoneMoss); m_scatter->setSelectionMode(QAbstract3DGraph::SelectionNone); m_scatter->activeTheme()->setGridEnabled(false); - m_scatter->setShadowQuality(QAbstract3DGraph::ShadowQualitySoftLow); - m_scatter->scene()->activeCamera()->setCameraPosition(0.0, 85.0, 150); + m_scatter->setShadowQuality(QAbstract3DGraph::ShadowQualityLow); + m_scatter->scene()->activeCamera()->setCameraPosition(0.0, 60.0, 150); QScatter3DSeries *series2 = new QScatter3DSeries; +#ifdef LOW_END_DEVICE series2->setMesh(QAbstract3DSeries::MeshPoint); +#else + m_scatter->activeTheme()->setColorStyle(Q3DTheme::ColorStyleRangeGradient); + series2->setMesh(QAbstract3DSeries::MeshMinimal); +#endif m_scatter->addSeries(series2); m_scatter->axisY()->setMin(-128); m_scatter->axisY()->setMax(128); @@ -79,15 +119,28 @@ SurfaceData::SurfaceData(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars m_scatter->axisZ()->setMax(m_resolution.height() / 2); // Initialize bars - m_bars->activeTheme()->setType(Q3DTheme::ThemeQt); + m_bars->activeTheme()->setType(Q3DTheme::ThemeArmyBlue); + QLinearGradient bargradient; + bargradient.setColorAt(0.48, Qt::white); + bargradient.setColorAt(0.481, Qt::red); + bargradient.setColorAt(0.52, Qt::red); + bargradient.setColorAt(0.521, Qt::black); + QList<QLinearGradient> bargradients; + bargradients.append(bargradient); + m_bars->activeTheme()->setBaseGradients(bargradients); + m_bars->activeTheme()->setColorStyle(Q3DTheme::ColorStyleRangeGradient); m_bars->setSelectionMode(QAbstract3DGraph::SelectionNone); m_bars->activeTheme()->setGridEnabled(false); + m_bars->activeTheme()->setBackgroundEnabled(false); +#ifdef LOW_END_DEVICE + m_bars->setShadowQuality(QAbstract3DGraph::ShadowQualityNone); +#else m_bars->setShadowQuality(QAbstract3DGraph::ShadowQualityLow); +#endif m_bars->setBarSpacing(QSizeF(0.0, 0.0)); - m_bars->scene()->activeCamera()->setCameraPosition(0.0, 75.0, 150); + m_bars->scene()->activeCamera()->setCameraPosition(0.0, 65.0, 130); QBar3DSeries *series3 = new QBar3DSeries; series3->setMesh(QAbstract3DSeries::MeshBar); - series3->setMeshSmooth(true); m_bars->addSeries(series3); m_bars->valueAxis()->setMax(255); @@ -115,8 +168,10 @@ void SurfaceData::updateData() if (m_mode != Surface) { setData(depthMap); } else { + static_cast<QHeightMapSurfaceDataProxy *>(m_surface->seriesList().at(0)->dataProxy())->setValueRanges( + 0, depthMap.width(), 0, depthMap.height()); static_cast<QHeightMapSurfaceDataProxy *>(m_surface->seriesList().at(0)->dataProxy())->setHeightMap( - depthMap); + depthMap); } } @@ -172,22 +227,22 @@ void SurfaceData::setResolution(int selection) switch (selection) { case 0: { m_resize = true; - m_resolution = QSize(320, 240); + m_resolution = lowRes; break; } case 1: { m_resize = true; - m_resolution = QSize(384, 288); + m_resolution = medRes; break; } case 2: { m_resize = true; - m_resolution = QSize(512, 384); + m_resolution = hiRes; break; } case 3: { m_resize = false; - m_resolution = QSize(640, 480); + m_resolution = maxRes; break; } }; @@ -225,26 +280,13 @@ void SurfaceData::scrollDown() void SurfaceData::useGradientOne() { - m_surface->activeTheme()->setType(Q3DTheme::ThemeIsabelle); - QLinearGradient gradient; - gradient.setColorAt(0.0, Qt::black); - gradient.setColorAt(0.33, Qt::blue); - gradient.setColorAt(0.67, Qt::red); - gradient.setColorAt(1.0, Qt::yellow); - m_surface->seriesList().at(0)->setBaseGradient(gradient); - m_surface->seriesList().at(0)->setColorStyle(Q3DTheme::ColorStyleRangeGradient); + m_surface->setActiveTheme(m_thermalTheme); m_statusArea->append(QStringLiteral("<b>Colors:</b> Thermal image imitation")); } void SurfaceData::useGradientTwo() { - m_surface->activeTheme()->setType(Q3DTheme::ThemeQt); - QLinearGradient gradient; - gradient.setColorAt(0.0, Qt::white); - gradient.setColorAt(0.8, Qt::red); - gradient.setColorAt(1.0, Qt::green); - m_surface->seriesList().at(0)->setBaseGradient(gradient); - m_surface->seriesList().at(0)->setColorStyle(Q3DTheme::ColorStyleRangeGradient); + m_surface->setActiveTheme(m_highlightTheme); m_statusArea->append(QStringLiteral("<b>Colors:</b> Highlight foreground")); } diff --git a/tests/kinectsurface/surfacedata.h b/tests/kinectsurface/surfacedata.h index 7193e446..b607ae76 100644 --- a/tests/kinectsurface/surfacedata.h +++ b/tests/kinectsurface/surfacedata.h @@ -19,6 +19,8 @@ #ifndef SURFACEDATA_H #define SURFACEDATA_H +#define NOMINMAX + #include "QKinectWrapper.h" #include <QtDataVisualization/Q3DScatter> #include <QtDataVisualization/Q3DBars> @@ -63,6 +65,8 @@ public slots: void changeMode(int mode); private: + Q3DTheme *m_thermalTheme; + Q3DTheme *m_highlightTheme; Q3DSurface *m_surface; Q3DScatter *m_scatter; Q3DBars *m_bars; diff --git a/tests/multigraphs/data.cpp b/tests/multigraphs/data.cpp index 1164a2f1..9fd27b96 100644 --- a/tests/multigraphs/data.cpp +++ b/tests/multigraphs/data.cpp @@ -149,6 +149,7 @@ void Data::setResolution(int selection) if (m_mode == Scatter) { m_resize = true; m_resolution /= 3; + delete m_scatterDataArray; m_scatterDataArray = new QScatterDataArray; m_scatterDataArray->resize(m_resolution.width() * m_resolution.height()); } else if (m_mode == Bars) { diff --git a/tests/multigraphs/multigraphs.pro b/tests/multigraphs/multigraphs.pro index 914a816a..f1a7cffe 100644 --- a/tests/multigraphs/multigraphs.pro +++ b/tests/multigraphs/multigraphs.pro @@ -8,7 +8,5 @@ HEADERS += data.h QT += widgets -INSTALLS += target - RESOURCES += \ multigraphs.qrc diff --git a/tests/qmlcamera/main.cpp b/tests/qmlcamera/main.cpp index c93502f7..040eaed3 100644 --- a/tests/qmlcamera/main.cpp +++ b/tests/qmlcamera/main.cpp @@ -16,30 +16,30 @@ ** ****************************************************************************/ -#include <QtDataVisualization/qutils.h> #include <QtGui/QGuiApplication> -#include "qtquick2applicationviewer.h" +#include <QtCore/QDir> +#include <QtQuick/QQuickView> +#include <QtQml/QQmlEngine> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); - QtQuick2ApplicationViewer viewer; + QQuickView viewer; - // Enable antialiasing - viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat()); - -#ifdef Q_OS_ANDROID - viewer.addImportPath(QString::fromLatin1("assets:/qml")); - viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), - QString::fromLatin1("lib"))); + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + QString extraImportPath(QStringLiteral("%1/../../../%2")); #else - viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), - QString::fromLatin1("qml"))); + QString extraImportPath(QStringLiteral("%1/../../%2")); #endif - viewer.setMainQmlFile(QStringLiteral("qml/qmlcamera/main.qml")); + viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); + + viewer.setSource(QUrl("qrc:/qml/qmlcamera/main.qml")); viewer.setResizeMode(QQuickView::SizeRootObjectToView); - viewer.showExpanded(); + viewer.show(); return app.exec(); } diff --git a/tests/qmlcamera/qml/qmlcamera/Data.qml b/tests/qmlcamera/qml/qmlcamera/Data.qml index 3c787186..bab6bf78 100644 --- a/tests/qmlcamera/qml/qmlcamera/Data.qml +++ b/tests/qmlcamera/qml/qmlcamera/Data.qml @@ -30,41 +30,44 @@ Item { rowRole: "year" columnRole: "month" valueRole: "expenses" + rotationRole: "angle" } Bar3DSeries { id: barSeries dataProxy: modelProxy itemLabelFormat: "@valueTitle for @colLabel, @rowLabel: @valueLabel" + + onMeshAngleChanged: console.log("angle changed:", angle) } ListModel { id: dataModel - ListElement{ year: "2006"; month: "Jan"; expenses: "4"; income: "5" } - ListElement{ year: "2006"; month: "Feb"; expenses: "5"; income: "6" } - ListElement{ year: "2006"; month: "Mar"; expenses: "7"; income: "4" } - ListElement{ year: "2006"; month: "Apr"; expenses: "3"; income: "2" } - ListElement{ year: "2006"; month: "May"; expenses: "4"; income: "1" } - ListElement{ year: "2006"; month: "Jun"; expenses: "2"; income: "2" } - ListElement{ year: "2006"; month: "Jul"; expenses: "1"; income: "3" } - ListElement{ year: "2006"; month: "Aug"; expenses: "5"; income: "1" } - ListElement{ year: "2006"; month: "Sep"; expenses: "2"; income: "3" } - ListElement{ year: "2006"; month: "Oct"; expenses: "5"; income: "2" } - ListElement{ year: "2006"; month: "Nov"; expenses: "8"; income: "5" } - ListElement{ year: "2006"; month: "Dec"; expenses: "3"; income: "3" } + ListElement{ year: "2006"; month: "Jan"; expenses: "4"; angle: "1"; income: "5" } + ListElement{ year: "2006"; month: "Feb"; expenses: "5"; angle: "2"; income: "6" } + ListElement{ year: "2006"; month: "Mar"; expenses: "7"; angle: "3"; income: "4" } + ListElement{ year: "2006"; month: "Apr"; expenses: "3"; angle: "4"; income: "2" } + ListElement{ year: "2006"; month: "May"; expenses: "4"; angle: "5"; income: "1" } + ListElement{ year: "2006"; month: "Jun"; expenses: "2"; angle: "6"; income: "2" } + ListElement{ year: "2006"; month: "Jul"; expenses: "1"; angle: "7"; income: "3" } + ListElement{ year: "2006"; month: "Aug"; expenses: "5"; angle: "8"; income: "1" } + ListElement{ year: "2006"; month: "Sep"; expenses: "2"; angle: "9"; income: "3" } + ListElement{ year: "2006"; month: "Oct"; expenses: "5"; angle: "10"; income: "2" } + ListElement{ year: "2006"; month: "Nov"; expenses: "8"; angle: "11"; income: "5" } + ListElement{ year: "2006"; month: "Dec"; expenses: "3"; angle: "12"; income: "3" } - ListElement{ year: "2007"; month: "Jan"; expenses: "3"; income: "1" } - ListElement{ year: "2007"; month: "Feb"; expenses: "4"; income: "2" } - ListElement{ year: "2007"; month: "Mar"; expenses: "12"; income: "4" } - ListElement{ year: "2007"; month: "Apr"; expenses: "13"; income: "6" } - ListElement{ year: "2007"; month: "May"; expenses: "14"; income: "11" } - ListElement{ year: "2007"; month: "Jun"; expenses: "7"; income: "7" } - ListElement{ year: "2007"; month: "Jul"; expenses: "6"; income: "4" } - ListElement{ year: "2007"; month: "Aug"; expenses: "4"; income: "15" } - ListElement{ year: "2007"; month: "Sep"; expenses: "2"; income: "18" } - ListElement{ year: "2007"; month: "Oct"; expenses: "29"; income: "25" } - ListElement{ year: "2007"; month: "Nov"; expenses: "23"; income: "29" } - ListElement{ year: "2007"; month: "Dec"; expenses: "5"; income: "9" } + ListElement{ year: "2007"; month: "Jan"; expenses: "3"; angle: "13"; income: "1" } + ListElement{ year: "2007"; month: "Feb"; expenses: "4"; angle: "14"; income: "2" } + ListElement{ year: "2007"; month: "Mar"; expenses: "12";angle: "15"; income: "4" } + ListElement{ year: "2007"; month: "Apr"; expenses: "13";angle: "16"; income: "6" } + ListElement{ year: "2007"; month: "May"; expenses: "14";angle: "17"; income: "11" } + ListElement{ year: "2007"; month: "Jun"; expenses: "7"; angle: "18"; income: "7" } + ListElement{ year: "2007"; month: "Jul"; expenses: "6"; angle: "19"; income: "4" } + ListElement{ year: "2007"; month: "Aug"; expenses: "4"; angle: "20"; income: "15" } + ListElement{ year: "2007"; month: "Sep"; expenses: "2"; angle: "21"; income: "18" } + ListElement{ year: "2007"; month: "Oct"; expenses: "29";angle: "22"; income: "25" } + ListElement{ year: "2007"; month: "Nov"; expenses: "23";angle: "23"; income: "29" } + ListElement{ year: "2007"; month: "Dec"; expenses: "5"; angle: "24"; income: "9" } ListElement{ year: "2008"; month: "Jan"; expenses: "3"; income: "8" } ListElement{ year: "2008"; month: "Feb"; expenses: "8"; income: "14" } @@ -79,56 +82,56 @@ Item { ListElement{ year: "2008"; month: "Nov"; expenses: "16"; income: "25" } ListElement{ year: "2008"; month: "Dec"; expenses: "2"; income: "7" } - ListElement{ year: "2009"; month: "Jan"; expenses: "4"; income: "5" } - ListElement{ year: "2009"; month: "Feb"; expenses: "4"; income: "7" } - ListElement{ year: "2009"; month: "Mar"; expenses: "11"; income: "14" } - ListElement{ year: "2009"; month: "Apr"; expenses: "16"; income: "22" } - ListElement{ year: "2009"; month: "May"; expenses: "3"; income: "5" } - ListElement{ year: "2009"; month: "Jun"; expenses: "4"; income: "8" } - ListElement{ year: "2009"; month: "Jul"; expenses: "7"; income: "9" } - ListElement{ year: "2009"; month: "Aug"; expenses: "9"; income: "13" } - ListElement{ year: "2009"; month: "Sep"; expenses: "1"; income: "6" } - ListElement{ year: "2009"; month: "Oct"; expenses: "14"; income: "25" } - ListElement{ year: "2009"; month: "Nov"; expenses: "19"; income: "29" } - ListElement{ year: "2009"; month: "Dec"; expenses: "5"; income: "7" } + ListElement{ year: "2009"; month: "Jan"; expenses: "4"; angle: "37"; income: "5" } + ListElement{ year: "2009"; month: "Feb"; expenses: "4"; angle: "38"; income: "7" } + ListElement{ year: "2009"; month: "Mar"; expenses: "11";angle: "39"; income: "14" } + ListElement{ year: "2009"; month: "Apr"; expenses: "16";angle: "40"; income: "22" } + ListElement{ year: "2009"; month: "May"; expenses: "3"; angle: "41"; income: "5" } + ListElement{ year: "2009"; month: "Jun"; expenses: "4"; angle: "42"; income: "8" } + ListElement{ year: "2009"; month: "Jul"; expenses: "7"; angle: "43"; income: "9" } + ListElement{ year: "2009"; month: "Aug"; expenses: "9"; angle: "44"; income: "13" } + ListElement{ year: "2009"; month: "Sep"; expenses: "1"; angle: "45"; income: "6" } + ListElement{ year: "2009"; month: "Oct"; expenses: "14";angle: "46"; income: "25" } + ListElement{ year: "2009"; month: "Nov"; expenses: "19";angle: "47"; income: "29" } + ListElement{ year: "2009"; month: "Dec"; expenses: "5"; angle: "48"; income: "7" } - ListElement{ year: "2010"; month: "Jan"; expenses: "14"; income: "22" } - ListElement{ year: "2010"; month: "Feb"; expenses: "5"; income: "7" } - ListElement{ year: "2010"; month: "Mar"; expenses: "1"; income: "9" } - ListElement{ year: "2010"; month: "Apr"; expenses: "1"; income: "12" } - ListElement{ year: "2010"; month: "May"; expenses: "5"; income: "9" } - ListElement{ year: "2010"; month: "Jun"; expenses: "5"; income: "8" } - ListElement{ year: "2010"; month: "Jul"; expenses: "3"; income: "7" } - ListElement{ year: "2010"; month: "Aug"; expenses: "1"; income: "5" } - ListElement{ year: "2010"; month: "Sep"; expenses: "2"; income: "4" } - ListElement{ year: "2010"; month: "Oct"; expenses: "10"; income: "13" } - ListElement{ year: "2010"; month: "Nov"; expenses: "12"; income: "17" } - ListElement{ year: "2010"; month: "Dec"; expenses: "6"; income: "9" } + ListElement{ year: "2010"; month: "Jan"; expenses: "14";angle: "49"; income: "22" } + ListElement{ year: "2010"; month: "Feb"; expenses: "5"; angle: "50"; income: "7" } + ListElement{ year: "2010"; month: "Mar"; expenses: "1"; angle: "51"; income: "9" } + ListElement{ year: "2010"; month: "Apr"; expenses: "1"; angle: "52"; income: "12" } + ListElement{ year: "2010"; month: "May"; expenses: "5"; angle: "53"; income: "9" } + ListElement{ year: "2010"; month: "Jun"; expenses: "5"; angle: "54"; income: "8" } + ListElement{ year: "2010"; month: "Jul"; expenses: "3"; angle: "55"; income: "7" } + ListElement{ year: "2010"; month: "Aug"; expenses: "1"; angle: "56"; income: "5" } + ListElement{ year: "2010"; month: "Sep"; expenses: "2"; angle: "57"; income: "4" } + ListElement{ year: "2010"; month: "Oct"; expenses: "10";angle: "58"; income: "13" } + ListElement{ year: "2010"; month: "Nov"; expenses: "12";angle: "59"; income: "17" } + ListElement{ year: "2010"; month: "Dec"; expenses: "6"; angle: "60"; income: "9" } - ListElement{ year: "2011"; month: "Jan"; expenses: "2"; income: "6" } - ListElement{ year: "2011"; month: "Feb"; expenses: "4"; income: "8" } - ListElement{ year: "2011"; month: "Mar"; expenses: "7"; income: "12" } - ListElement{ year: "2011"; month: "Apr"; expenses: "9"; income: "15" } - ListElement{ year: "2011"; month: "May"; expenses: "7"; income: "19" } - ListElement{ year: "2011"; month: "Jun"; expenses: "9"; income: "18" } - ListElement{ year: "2011"; month: "Jul"; expenses: "13"; income: "17" } - ListElement{ year: "2011"; month: "Aug"; expenses: "5"; income: "9" } - ListElement{ year: "2011"; month: "Sep"; expenses: "3"; income: "8" } - ListElement{ year: "2011"; month: "Oct"; expenses: "13"; income: "15" } - ListElement{ year: "2011"; month: "Nov"; expenses: "8"; income: "17" } - ListElement{ year: "2011"; month: "Dec"; expenses: "7"; income: "10" } + ListElement{ year: "2011"; month: "Jan"; expenses: "2"; angle: "61"; income: "6" } + ListElement{ year: "2011"; month: "Feb"; expenses: "4"; angle: "62"; income: "8" } + ListElement{ year: "2011"; month: "Mar"; expenses: "7"; angle: "63"; income: "12" } + ListElement{ year: "2011"; month: "Apr"; expenses: "9"; angle: "64"; income: "15" } + ListElement{ year: "2011"; month: "May"; expenses: "7"; angle: "65"; income: "19" } + ListElement{ year: "2011"; month: "Jun"; expenses: "9"; angle: "66"; income: "18" } + ListElement{ year: "2011"; month: "Jul"; expenses: "13";angle: "67"; income: "17" } + ListElement{ year: "2011"; month: "Aug"; expenses: "5"; angle: "68"; income: "9" } + ListElement{ year: "2011"; month: "Sep"; expenses: "3"; angle: "69"; income: "8" } + ListElement{ year: "2011"; month: "Oct"; expenses: "13";angle: "70"; income: "15" } + ListElement{ year: "2011"; month: "Nov"; expenses: "8"; angle: "71"; income: "17" } + ListElement{ year: "2011"; month: "Dec"; expenses: "7"; angle: "72"; income: "10" } - ListElement{ year: "2012"; month: "Jan"; expenses: "12"; income: "16" } - ListElement{ year: "2012"; month: "Feb"; expenses: "24"; income: "28" } - ListElement{ year: "2012"; month: "Mar"; expenses: "27"; income: "22" } - ListElement{ year: "2012"; month: "Apr"; expenses: "29"; income: "25" } - ListElement{ year: "2012"; month: "May"; expenses: "27"; income: "29" } - ListElement{ year: "2012"; month: "Jun"; expenses: "19"; income: "18" } - ListElement{ year: "2012"; month: "Jul"; expenses: "13"; income: "17" } - ListElement{ year: "2012"; month: "Aug"; expenses: "15"; income: "19" } - ListElement{ year: "2012"; month: "Sep"; expenses: "3"; income: "8" } - ListElement{ year: "2012"; month: "Oct"; expenses: "3"; income: "6" } - ListElement{ year: "2012"; month: "Nov"; expenses: "4"; income: "8" } - ListElement{ year: "2012"; month: "Dec"; expenses: "5"; income: "9" } + ListElement{ year: "2012"; month: "Jan"; expenses: "12";angle: "73"; income: "16" } + ListElement{ year: "2012"; month: "Feb"; expenses: "24";angle: "74"; income: "28" } + ListElement{ year: "2012"; month: "Mar"; expenses: "27";angle: "75"; income: "22" } + ListElement{ year: "2012"; month: "Apr"; expenses: "29";angle: "76"; income: "25" } + ListElement{ year: "2012"; month: "May"; expenses: "27";angle: "77"; income: "29" } + ListElement{ year: "2012"; month: "Jun"; expenses: "19";angle: "78"; income: "18" } + ListElement{ year: "2012"; month: "Jul"; expenses: "13";angle: "79"; income: "17" } + ListElement{ year: "2012"; month: "Aug"; expenses: "15";angle: "80"; income: "19" } + ListElement{ year: "2012"; month: "Sep"; expenses: "3"; angle: "81"; income: "8" } + ListElement{ year: "2012"; month: "Oct"; expenses: "3"; angle: "82"; income: "6" } + ListElement{ year: "2012"; month: "Nov"; expenses: "4"; angle: "83"; income: "8" } + ListElement{ year: "2012"; month: "Dec"; expenses: "5"; angle: "84"; income: "9" } } } diff --git a/tests/qmlcamera/qml/qmlcamera/main.qml b/tests/qmlcamera/qml/qmlcamera/main.qml index a5176553..264d613e 100644 --- a/tests/qmlcamera/qml/qmlcamera/main.qml +++ b/tests/qmlcamera/qml/qmlcamera/main.qml @@ -21,7 +21,7 @@ import QtQuick.Controls 1.0 import QtDataVisualization 1.0 import "." -Item { +Rectangle { id: mainview width: 1280 height: 1024 @@ -99,10 +99,10 @@ Item { y: 0 width: 298 height: 298 - minXValue: testChart.scene.activeCamera.minXRotation - minYValue: testChart.scene.activeCamera.minYRotation - maxXValue: testChart.scene.activeCamera.maxXRotation - maxYValue: testChart.scene.activeCamera.maxYRotation + minXValue: -180 + minYValue: 0 + maxXValue: 180 + maxYValue: 90 } Slider { @@ -133,24 +133,20 @@ Item { } Button { - id: shadowToggle + id: angleAdjust anchors.bottom: mappingToggle.top width: camControlArea.width - text: "Hide Shadows" + text: "Adjust angle" + property real currentAngle: 0 onClicked: { - if (testChart.shadowQuality == AbstractGraph3D.ShadowQualityNone) { - testChart.shadowQuality = AbstractGraph3D.ShadowQualityMedium; - text = "Hide Shadows" - } else { - testChart.shadowQuality = AbstractGraph3D.ShadowQualityNone; - text = "Show Shadows" - } + currentAngle += 5 + chartData.series.meshAngle = currentAngle } } Button { id: dataToggle - anchors.bottom: shadowToggle.top + anchors.bottom: angleAdjust.top width: camControlArea.width text: "Show 2010 - 2012" onClicked: { diff --git a/tests/qmlcamera/qmlcamera.desktop b/tests/qmlcamera/qmlcamera.desktop deleted file mode 100644 index 10a0a2e7..00000000 --- a/tests/qmlcamera/qmlcamera.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=qmlcamera -Exec=/opt/qmlcamera/bin/qmlcamera -Icon=qmlcamera64 -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/tests/qmlcamera/qmlcamera.pro b/tests/qmlcamera/qmlcamera.pro index 374dc012..098d7a85 100644 --- a/tests/qmlcamera/qmlcamera.pro +++ b/tests/qmlcamera/qmlcamera.pro @@ -2,34 +2,9 @@ error( "Couldn't find the tests.pri file!" ) } -# Add more folders to ship with the application, here -folder_01.source = qml/qmlcamera -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 += qmlcamera.qrc -RESOURCES += \ - qmlcamera.qrc +OTHER_FILES += qml/qmlcamera/* -OTHER_FILES += \ - qml/qmlcamera/Data.qml \ - qml/qmlcamera/Axes.qml \ - qml/qmlcamera/main.qml \ - qml/qmlcamera/ControlSurface.qml diff --git a/tests/qmlcamera/qmlcamera.qrc b/tests/qmlcamera/qmlcamera.qrc index d9b993c7..90cb0867 100644 --- a/tests/qmlcamera/qmlcamera.qrc +++ b/tests/qmlcamera/qmlcamera.qrc @@ -1,7 +1,8 @@ <RCC> - <qresource prefix="/qml"> - <file alias="main.qml">qml/qmlcamera/main.qml</file> - <file alias="Data.qml">qml/qmlcamera/Data.qml</file> - <file alias="Axes.qml">qml/qmlcamera/Axes.qml</file> + <qresource prefix="/"> + <file>qml/qmlcamera/Axes.qml</file> + <file>qml/qmlcamera/ControlSurface.qml</file> + <file>qml/qmlcamera/Data.qml</file> + <file>qml/qmlcamera/main.qml</file> </qresource> </RCC> diff --git a/tests/qmlcamera/qmlcamera64.png b/tests/qmlcamera/qmlcamera64.png Binary files differdeleted file mode 100644 index 707d5c4e..00000000 --- a/tests/qmlcamera/qmlcamera64.png +++ /dev/null diff --git a/tests/qmlcamera/qmlcamera80.png b/tests/qmlcamera/qmlcamera80.png Binary files differdeleted file mode 100644 index 6ad8096c..00000000 --- a/tests/qmlcamera/qmlcamera80.png +++ /dev/null diff --git a/tests/qmlcamera/qmlcamera_harmattan.desktop b/tests/qmlcamera/qmlcamera_harmattan.desktop deleted file mode 100644 index 8e9e9857..00000000 --- a/tests/qmlcamera/qmlcamera_harmattan.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=qmlcamera -Exec=/usr/bin/single-instance /opt/qmlcamera/bin/qmlcamera -Icon=/usr/share/icons/hicolor/80x80/apps/qmlcamera80.png -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.cpp deleted file mode 100644 index 10709d7a..00000000 --- a/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// 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/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.h b/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.h deleted file mode 100644 index cf66f140..00000000 --- a/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.h +++ /dev/null @@ -1,33 +0,0 @@ -// 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/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.pri b/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.pri deleted file mode 100644 index e5f7990f..00000000 --- a/tests/qmlcamera/qtquick2applicationviewer/qtquick2applicationviewer.pri +++ /dev/null @@ -1,180 +0,0 @@ -# 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/tests/qmldynamicdata/main.cpp b/tests/qmldynamicdata/main.cpp index 7c9bcf86..fa3ea866 100644 --- a/tests/qmldynamicdata/main.cpp +++ b/tests/qmldynamicdata/main.cpp @@ -16,32 +16,31 @@ ** ****************************************************************************/ -#include <QtDataVisualization/qutils.h> #include <QtGui/QGuiApplication> -#include "qtquick2applicationviewer.h" -#ifdef Q_OS_ANDROID -#include <QDir> -#include <QQmlEngine> -#endif -#include <QDebug> +#include <QtCore/QDir> +#include <QtQuick/QQuickView> +#include <QtQml/QQmlEngine> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); - QtQuick2ApplicationViewer viewer; - - // Enable antialiasing - viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat()); + QQuickView viewer; -#ifdef Q_OS_ANDROID - viewer.addImportPath(QString::fromLatin1("assets:/qml")); - viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), - QString::fromLatin1("lib"))); + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + QString extraImportPath(QStringLiteral("%1/../../../%2")); +#else + QString extraImportPath(QStringLiteral("%1/../../%2")); #endif + viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); + QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close); + viewer.setTitle(QStringLiteral("QML Dynamic Data Test")); - viewer.setSource(QUrl("qrc:/qml/main.qml")); + viewer.setSource(QUrl("qrc:/qml/qmldynamicdata/main.qml")); viewer.setResizeMode(QQuickView::SizeRootObjectToView); viewer.show(); diff --git a/tests/qmldynamicdata/qml/qmldynamicdata/newbutton.qml b/tests/qmldynamicdata/qml/qmldynamicdata/NewButton.qml index 0b792dbf..0b792dbf 100644 --- a/tests/qmldynamicdata/qml/qmldynamicdata/newbutton.qml +++ b/tests/qmldynamicdata/qml/qmldynamicdata/NewButton.qml diff --git a/tests/qmldynamicdata/qml/qmldynamicdata/main.qml b/tests/qmldynamicdata/qml/qmldynamicdata/main.qml index 6f0032ac..0ec9d277 100644 --- a/tests/qmldynamicdata/qml/qmldynamicdata/main.qml +++ b/tests/qmldynamicdata/qml/qmldynamicdata/main.qml @@ -20,7 +20,7 @@ import QtQuick 2.1 import QtDataVisualization 1.0 import "." -Item { +Rectangle { id: mainView width: 1280 height: 720 @@ -28,8 +28,8 @@ Item { ListModel { id: graphModel - ListElement{ xPos: 0.0; yPos: 0.0; zPos: 0.0 } - ListElement{ xPos: 1.0; yPos: 1.0; zPos: 1.0 } + ListElement{ xPos: 0.0; yPos: 0.0; zPos: 0.0; rotation: "0.92388, 0.220942, 0.220942, 0.220942"} + ListElement{ xPos: 1.0; yPos: 1.0; zPos: 1.0; rotation: "@45,1.0,1.0,1.0" } } Timer { @@ -38,19 +38,34 @@ Item { running: true repeat: true property bool isIncreasing: true + property real rotationAngle: 0 + + function generateQuaternion() { + return "@" + Math.random() * 360 + "," + Math.random() + "," + Math.random() + "," + Math.random() + } + + function appendRow() { + graphModel.append({"xPos": Math.random(), + "yPos": Math.random(), + "zPos": Math.random(), + "rotation": generateQuaternion() + }); + } onTriggered: { + rotationAngle = rotationAngle + 1 + scatterSeries.setMeshAxisAndAngle(Qt.vector3d(1,1,1), rotationAngle) if (isIncreasing) { - graphModel.append({"xPos": Math.random(), "yPos": Math.random(), "zPos": Math.random()}); - graphModel.append({"xPos": Math.random(), "yPos": Math.random(), "zPos": Math.random()}); - graphModel.append({"xPos": Math.random(), "yPos": Math.random(), "zPos": Math.random()}); - graphModel.append({"xPos": Math.random(), "yPos": Math.random(), "zPos": Math.random()}); - graphModel.append({"xPos": Math.random(), "yPos": Math.random(), "zPos": Math.random()}); - graphModel.append({"xPos": Math.random(), "yPos": Math.random(), "zPos": Math.random()}); - graphModel.append({"xPos": Math.random(), "yPos": Math.random(), "zPos": Math.random()}); - graphModel.append({"xPos": Math.random(), "yPos": Math.random(), "zPos": Math.random()}); - graphModel.append({"xPos": Math.random(), "yPos": Math.random(), "zPos": Math.random()}); - graphModel.append({"xPos": Math.random(), "yPos": Math.random(), "zPos": Math.random()}); + appendRow() + appendRow() + appendRow() + appendRow() + appendRow() + appendRow() + appendRow() + appendRow() + appendRow() + appendRow() if (graphModel.count > 5000) { scatterGraph.theme.type = Theme3D.ThemeIsabelle; isIncreasing = false; @@ -114,6 +129,7 @@ Item { xPosRole: "xPos" yPosRole: "yPos" zPosRole: "zPos" + rotationRole: "rotation" } } } diff --git a/tests/qmldynamicdata/qmldynamicdata.pro b/tests/qmldynamicdata/qmldynamicdata.pro index b95f1577..a6ffeb3d 100644 --- a/tests/qmldynamicdata/qmldynamicdata.pro +++ b/tests/qmldynamicdata/qmldynamicdata.pro @@ -2,25 +2,8 @@ error( "Couldn't find the tests.pri file!" ) } -QT += widgets - -# Add more folders to ship with the application, here -folder_01.source = qml/qmldynamicdata -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 -# Please do not modify the following two lines. Required for deployment. -include(qtquick2applicationviewer/qtquick2applicationviewer.pri) -qtcAddDeployment() - -RESOURCES += \ - qmldynamicdata.qrc +RESOURCES += qmldynamicdata.qrc -OTHER_FILES += doc/src/* \ - doc/images/* +OTHER_FILES += qml/qmldynamicdata/* diff --git a/tests/qmldynamicdata/qmldynamicdata.qrc b/tests/qmldynamicdata/qmldynamicdata.qrc index 3a13d7b4..76641cf9 100644 --- a/tests/qmldynamicdata/qmldynamicdata.qrc +++ b/tests/qmldynamicdata/qmldynamicdata.qrc @@ -1,6 +1,6 @@ <RCC> - <qresource prefix="/qml"> - <file alias="main.qml">qml/qmldynamicdata/main.qml</file> - <file alias="NewButton.qml">qml/qmldynamicdata/newbutton.qml</file> + <qresource prefix="/"> + <file>qml/qmldynamicdata/main.qml</file> + <file>qml/qmldynamicdata/NewButton.qml</file> </qresource> </RCC> diff --git a/tests/qmldynamicdata/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/tests/qmldynamicdata/qtquick2applicationviewer/qtquick2applicationviewer.cpp deleted file mode 100644 index 10709d7a..00000000 --- a/tests/qmldynamicdata/qtquick2applicationviewer/qtquick2applicationviewer.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// 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/tests/qmldynamicdata/qtquick2applicationviewer/qtquick2applicationviewer.h b/tests/qmldynamicdata/qtquick2applicationviewer/qtquick2applicationviewer.h deleted file mode 100644 index cf66f140..00000000 --- a/tests/qmldynamicdata/qtquick2applicationviewer/qtquick2applicationviewer.h +++ /dev/null @@ -1,33 +0,0 @@ -// 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/tests/qmldynamicdata/qtquick2applicationviewer/qtquick2applicationviewer.pri b/tests/qmldynamicdata/qtquick2applicationviewer/qtquick2applicationviewer.pri deleted file mode 100644 index e5f7990f..00000000 --- a/tests/qmldynamicdata/qtquick2applicationviewer/qtquick2applicationviewer.pri +++ /dev/null @@ -1,180 +0,0 @@ -# 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/tests/scattertest/scatterchart.cpp b/tests/scattertest/scatterchart.cpp index 6ee7711e..aa0c5454 100644 --- a/tests/scattertest/scatterchart.cpp +++ b/tests/scattertest/scatterchart.cpp @@ -433,19 +433,21 @@ void ScatterDataModifier::setGradient() singleHighlightGradient.setColorAt(0.25, Qt::yellow); singleHighlightGradient.setColorAt(0.0, Qt::white); - m_targetSeries->setBaseColor(Qt::green); - m_targetSeries->setSingleHighlightColor(Qt::white); - - m_targetSeries->setBaseGradient(baseGradient); - m_targetSeries->setSingleHighlightGradient(singleHighlightGradient); - - Q3DTheme::ColorStyle oldStyle = m_targetSeries->colorStyle(); - if (oldStyle == Q3DTheme::ColorStyleUniform) - m_targetSeries->setColorStyle(Q3DTheme::ColorStyleObjectGradient); - else if (oldStyle == Q3DTheme::ColorStyleObjectGradient) - m_targetSeries->setColorStyle(Q3DTheme::ColorStyleRangeGradient); - if (oldStyle == Q3DTheme::ColorStyleRangeGradient) - m_targetSeries->setColorStyle(Q3DTheme::ColorStyleUniform); + if (m_targetSeries) { + m_targetSeries->setBaseColor(Qt::green); + m_targetSeries->setSingleHighlightColor(Qt::white); + + m_targetSeries->setBaseGradient(baseGradient); + m_targetSeries->setSingleHighlightGradient(singleHighlightGradient); + + Q3DTheme::ColorStyle oldStyle = m_targetSeries->colorStyle(); + if (oldStyle == Q3DTheme::ColorStyleUniform) + m_targetSeries->setColorStyle(Q3DTheme::ColorStyleObjectGradient); + else if (oldStyle == Q3DTheme::ColorStyleObjectGradient) + m_targetSeries->setColorStyle(Q3DTheme::ColorStyleRangeGradient); + if (oldStyle == Q3DTheme::ColorStyleRangeGradient) + m_targetSeries->setColorStyle(Q3DTheme::ColorStyleUniform); + } } void ScatterDataModifier::addSeries() diff --git a/tests/scattertest/scattertest.pro b/tests/scattertest/scattertest.pro index 62fb3d39..4fec5b34 100644 --- a/tests/scattertest/scattertest.pro +++ b/tests/scattertest/scattertest.pro @@ -6,5 +6,3 @@ SOURCES += main.cpp scatterchart.cpp HEADERS += scatterchart.h QT += widgets - -INSTALLS += target diff --git a/tests/spectrum/spectrumapp/spectrumapp.pro b/tests/spectrum/spectrumapp/spectrumapp.pro index f5b52954..ab12e221 100644 --- a/tests/spectrum/spectrumapp/spectrumapp.pro +++ b/tests/spectrum/spectrumapp/spectrumapp.pro @@ -47,14 +47,6 @@ RESOURCES = spectrum.qrc } } - -android { - target.path = /libs/$$ANDROID_TARGET_ARCH -} else { - target.path = $$[QT_INSTALL_EXAMPLES]/datavisualization/spectrum -} -INSTALLS += target - # Deployment DESTDIR = ..$${spectrum_build_dir} diff --git a/tests/surfacetest/graphmodifier.cpp b/tests/surfacetest/graphmodifier.cpp index 528a803b..7f2a3ef2 100644 --- a/tests/surfacetest/graphmodifier.cpp +++ b/tests/surfacetest/graphmodifier.cpp @@ -34,14 +34,18 @@ using namespace QtDataVisualization; GraphModifier::GraphModifier(Q3DSurface *graph) : m_graph(graph), + m_series1(new QSurface3DSeries), + m_series2(new QSurface3DSeries), + m_series3(new QSurface3DSeries), + m_series4(new QSurface3DSeries), m_gridSliderX(0), m_gridSliderZ(0), m_axisRangeSliderX(0), m_axisRangeSliderZ(0), m_axisMinSliderX(0), m_axisMinSliderZ(0), - m_xCount(50), - m_zCount(50), + m_xCount(24), + m_zCount(24), m_activeSample(0), m_fontSize(40), m_rangeX(16.0), @@ -53,15 +57,50 @@ GraphModifier::GraphModifier(Q3DSurface *graph) m_insertTestIndexPos(1), m_planeArray(0), m_theSeries(new QSurface3DSeries), - m_drawMode(QSurface3DSeries::DrawSurfaceAndWireframe) + m_drawMode(QSurface3DSeries::DrawSurfaceAndWireframe), + m_drawMode2(QSurface3DSeries::DrawSurfaceAndWireframe), + m_drawMode3(QSurface3DSeries::DrawSurfaceAndWireframe), + m_drawMode4(QSurface3DSeries::DrawSurfaceAndWireframe), + m_offset(4.0f) { m_graph->setAxisX(new QValue3DAxis); + m_graph->axisX()->setTitle("X-Axis"); m_graph->setAxisY(new QValue3DAxis); + m_graph->axisY()->setTitle("Value Axis"); m_graph->setAxisZ(new QValue3DAxis); + m_graph->axisZ()->setTitle("Z-Axis"); +#ifdef MULTI_SERIES + m_limitX = float(m_xCount) / 2.0f; + m_limitZ = float(m_zCount) / 2.0f; + // Series 1 + m_multiSampleOffsetX[0] = -m_offset; + m_multiSampleOffsetZ[0] = -m_offset; + // Series 2 + m_multiSampleOffsetX[1] = -m_offset; + m_multiSampleOffsetZ[1] = m_offset; + // Series 3 + m_multiSampleOffsetX[2] = m_offset; + m_multiSampleOffsetZ[2] = -m_offset; + // Series 4 + m_multiSampleOffsetX[3] = m_offset; + m_multiSampleOffsetZ[3] = m_offset; + + m_graph->axisX()->setRange(-m_limitX - m_offset, m_limitX + m_offset); + m_graph->axisY()->setRange(-1.0f, 4.5f); + m_graph->axisZ()->setRange(-m_limitZ - m_offset, m_limitZ + m_offset); +#else m_graph->axisX()->setRange(m_minX, m_minX + m_rangeX); m_graph->axisZ()->setRange(m_minZ, m_minZ + m_rangeZ); m_graph->addSeries(m_theSeries); +#endif + for (int i = 0; i < 4; i++) { + m_multiseries[i] = new QSurface3DSeries; + m_multiseries[i]->setName(QStringLiteral("Series %1").arg(i+1)); + m_multiseries[i]->setItemLabelFormat(QStringLiteral("@seriesName: (@xLabel, @zLabel): @yLabel")); + } + + fillSeries(); changeStyle(); m_theSeries->setItemLabelFormat(QStringLiteral("@seriesName: (@xLabel, @zLabel): @yLabel")); @@ -82,10 +121,94 @@ GraphModifier::~GraphModifier() delete m_graph; } +void GraphModifier::fillSeries() +{ + float full = m_limitX * m_limitZ; + + QSurfaceDataArray *dataArray1 = new QSurfaceDataArray; + dataArray1->reserve(m_zCount); + QSurfaceDataArray *dataArray2 = new QSurfaceDataArray; + dataArray2->reserve(m_zCount); + QSurfaceDataArray *dataArray3 = new QSurfaceDataArray; + dataArray3->reserve(m_zCount); + QSurfaceDataArray *dataArray4 = new QSurfaceDataArray; + dataArray4->reserve(m_zCount); + + for (int i = 0; i < m_zCount; i++) { + QSurfaceDataRow *newRow[4]; + for (int s = 0; s < 4; s++) { + newRow[s] = new QSurfaceDataRow(m_xCount); + float z = float(i) - m_limitZ + 0.5f + m_multiSampleOffsetZ[s]; + for (int j = 0; j < m_xCount; j++) { + float x = float(j) - m_limitX + 0.5f + m_multiSampleOffsetX[s]; + float angle = (z * x) / full * 1.57f; + float y = qSin(angle * float(qPow(1.3f, s))) + 1.1f * s; + (*newRow[s])[j].setPosition(QVector3D(x, y, z)); + } + } + *dataArray1 << newRow[0]; + *dataArray2 << newRow[1]; + *dataArray3 << newRow[2]; + *dataArray4 << newRow[3]; + } + + m_multiseries[0]->dataProxy()->resetArray(dataArray1); + m_multiseries[1]->dataProxy()->resetArray(dataArray2); + m_multiseries[2]->dataProxy()->resetArray(dataArray3); + m_multiseries[3]->dataProxy()->resetArray(dataArray4); +} + +void GraphModifier::toggleSeries1(bool enabled) +{ + qDebug() << __FUNCTION__ << " enabled = " << enabled; + + if (enabled) { + m_graph->addSeries(m_multiseries[0]); + } else { + m_graph->removeSeries(m_multiseries[0]); + } +} + +void GraphModifier::toggleSeries2(bool enabled) +{ + qDebug() << __FUNCTION__ << " enabled = " << enabled; + + if (enabled) { + m_graph->addSeries(m_multiseries[1]); + } else { + m_graph->removeSeries(m_multiseries[1]); + } +} + +void GraphModifier::toggleSeries3(bool enabled) +{ + qDebug() << __FUNCTION__ << " enabled = " << enabled; + + if (enabled) { + m_graph->addSeries(m_multiseries[2]); + } else { + m_graph->removeSeries(m_multiseries[2]); + } +} + +void GraphModifier::toggleSeries4(bool enabled) +{ + qDebug() << __FUNCTION__ << " enabled = " << enabled; + + if (enabled) { + m_graph->addSeries(m_multiseries[3]); + } else { + m_graph->removeSeries(m_multiseries[3]); + } +} + void GraphModifier::toggleSmooth(bool enabled) { qDebug() << "GraphModifier::toggleSmooth " << enabled; m_theSeries->setFlatShadingEnabled(enabled); +#ifdef MULTI_SERIES + m_multiseries[0]->setFlatShadingEnabled(enabled); +#endif } void GraphModifier::toggleSurfaceGrid(bool enable) @@ -97,6 +220,9 @@ void GraphModifier::toggleSurfaceGrid(bool enable) m_drawMode &= ~QSurface3DSeries::DrawWireframe; m_theSeries->setDrawMode(m_drawMode); +#ifdef MULTI_SERIES + m_multiseries[0]->setDrawMode(m_drawMode); +#endif } void GraphModifier::toggleSurface(bool enable) @@ -108,11 +234,119 @@ void GraphModifier::toggleSurface(bool enable) m_drawMode &= ~QSurface3DSeries::DrawSurface; m_theSeries->setDrawMode(m_drawMode); +#ifdef MULTI_SERIES + m_multiseries[0]->setDrawMode(m_drawMode); +#endif } void GraphModifier::toggleSeriesVisible(bool enable) { m_theSeries->setVisible(enable); +#ifdef MULTI_SERIES + m_multiseries[0]->setVisible(enable); +#endif +} + +void GraphModifier::toggleSmoothS2(bool enabled) +{ + qDebug() << __FUNCTION__ << enabled; + m_multiseries[1]->setFlatShadingEnabled(enabled); +} + +void GraphModifier::toggleSurfaceGridS2(bool enable) +{ + qDebug() << __FUNCTION__ << enable; + if (enable) + m_drawMode2 |= QSurface3DSeries::DrawWireframe; + else + m_drawMode2 &= ~QSurface3DSeries::DrawWireframe; + + m_multiseries[1]->setDrawMode(m_drawMode2); +} + +void GraphModifier::toggleSurfaceS2(bool enable) +{ + qDebug() << __FUNCTION__ << enable; + if (enable) + m_drawMode2 |= QSurface3DSeries::DrawSurface; + else + m_drawMode2 &= ~QSurface3DSeries::DrawSurface; + + m_multiseries[1]->setDrawMode(m_drawMode2); +} + +void GraphModifier::toggleSeries2Visible(bool enable) +{ + qDebug() << __FUNCTION__ << enable; + m_multiseries[1]->setVisible(enable); +} + +void GraphModifier::toggleSmoothS3(bool enabled) +{ + qDebug() << __FUNCTION__ << enabled; + m_multiseries[2]->setFlatShadingEnabled(enabled); +} + +void GraphModifier::toggleSurfaceGridS3(bool enable) +{ + qDebug() << __FUNCTION__ << enable; + if (enable) + m_drawMode3 |= QSurface3DSeries::DrawWireframe; + else + m_drawMode3 &= ~QSurface3DSeries::DrawWireframe; + + m_multiseries[2]->setDrawMode(m_drawMode3); +} + +void GraphModifier::toggleSurfaceS3(bool enable) +{ + qDebug() << __FUNCTION__ << enable; + if (enable) + m_drawMode3 |= QSurface3DSeries::DrawSurface; + else + m_drawMode3 &= ~QSurface3DSeries::DrawSurface; + + m_multiseries[2]->setDrawMode(m_drawMode3); +} + +void GraphModifier::toggleSeries3Visible(bool enable) +{ + qDebug() << __FUNCTION__ << enable; + m_multiseries[2]->setVisible(enable); +} + +void GraphModifier::toggleSmoothS4(bool enabled) +{ + qDebug() << __FUNCTION__ << enabled; + m_multiseries[3]->setFlatShadingEnabled(enabled); +} + +void GraphModifier::toggleSurfaceGridS4(bool enable) +{ + qDebug() << __FUNCTION__ << enable; + if (enable) + m_drawMode4 |= QSurface3DSeries::DrawWireframe; + else + m_drawMode4 &= ~QSurface3DSeries::DrawWireframe; + + m_multiseries[3]->setDrawMode(m_drawMode4); +} + +void GraphModifier::toggleSurfaceS4(bool enable) +{ + qDebug() << __FUNCTION__ << enable; + if (enable) + m_drawMode4 |= QSurface3DSeries::DrawSurface; + else + m_drawMode4 &= ~QSurface3DSeries::DrawSurface; + + m_multiseries[3]->setDrawMode(m_drawMode4); +} + +void GraphModifier::toggleSeries4Visible(bool enable) +{ + qDebug() << __FUNCTION__ << enable; + m_multiseries[3]->setVisible(enable); } void GraphModifier::toggleSqrtSin(bool enable) @@ -347,9 +581,14 @@ void GraphModifier::gradientPressed() gradient.setColorAt(0.33, Qt::blue); gradient.setColorAt(0.67, Qt::red); gradient.setColorAt(1.0, Qt::yellow); - m_graph->seriesList().at(0)->setBaseGradient(gradient); - m_graph->seriesList().at(0)->setSingleHighlightColor(Qt::red); - m_graph->seriesList().at(0)->setColorStyle(Q3DTheme::ColorStyleRangeGradient); +// m_graph->seriesList().at(0)->setBaseGradient(gradient); +// m_graph->seriesList().at(0)->setSingleHighlightColor(Qt::red); +// m_graph->seriesList().at(0)->setColorStyle(Q3DTheme::ColorStyleRangeGradient); + + QList<QLinearGradient> gradients; + gradients << gradient; + m_graph->activeTheme()->setBaseGradients(gradients); + m_graph->activeTheme()->setColorStyle(Q3DTheme::ColorStyleRangeGradient); } void GraphModifier::changeFont(const QFont &font) @@ -474,10 +713,39 @@ void GraphModifier::changeRow() m_theSeries->dataProxy()->setRow(int(i), newRow); } else { +#ifdef MULTI_SERIES + static int changeRowSeries = 0; + qDebug() << "Generating new values to a row at random pos for series " << changeRowSeries; + + int row = rand() % m_zCount; + QSurfaceDataRow *newRow = createMultiRow(row, changeRowSeries, true); + m_multiseries[changeRowSeries]->dataProxy()->setRow(row, newRow); + + changeRowSeries++; + if (changeRowSeries > 3) + changeRowSeries = 0; +#else qDebug() << "Change row function active only for SqrtSin"; +#endif } } +QSurfaceDataRow *GraphModifier::createMultiRow(int row, int series, bool change) +{ + int full = m_limitX * m_limitZ; + float i = float(row); + QSurfaceDataRow *newRow = new QSurfaceDataRow(m_xCount); + float z = float(i) - m_limitZ + 0.5f + m_multiSampleOffsetZ[series]; + for (int j = 0; j < m_xCount; j++) { + float x = float(j) - m_limitX + 0.5f + m_multiSampleOffsetX[series]; + float angle = (z * x) / float(full) * 1.57f; + float y = qSin(angle * float(qPow(1.3f, series))) + 0.2f * float(change) + 1.1f *series; + (*newRow)[j].setPosition(QVector3D(x, y, z)); + } + + return newRow; +} + void GraphModifier::changeRows() { if (m_activeSample == GraphModifier::SqrtSin) { @@ -507,7 +775,24 @@ void GraphModifier::changeRows() m_theSeries->dataProxy()->setRows(int(start), dataArray); } else { +#ifdef MULTI_SERIES + static int changeRowSeries = 0; + qDebug() << "Generating new values for 3 rows at random pos for series " << changeRowSeries; + + int row = rand() % (m_zCount - 3); + QSurfaceDataArray dataArray; + for (int i = 0; i < 3; i++) { + QSurfaceDataRow *newRow = createMultiRow(row + i, changeRowSeries, true); + dataArray.append(newRow); + } + m_multiseries[changeRowSeries]->dataProxy()->setRows(row, dataArray); + + changeRowSeries++; + if (changeRowSeries > 3) + changeRowSeries = 0; +#else qDebug() << "Change row function active only for SqrtSin"; +#endif } } @@ -532,7 +817,23 @@ void GraphModifier::changeItem() m_theSeries->dataProxy()->setItem(int(i), int(j), newItem); } else { - qDebug() << "Change row function active only for SqrtSin"; +#ifdef MULTI_SERIES + static int changeItemSeries = 0; + int full = m_limitX * m_limitZ; + float i = float(rand() % m_zCount); + float j = float(rand() % m_xCount); + float x = float(j) - m_limitX + 0.5f + m_multiSampleOffsetX[changeItemSeries]; + float z = float(i) - m_limitZ + 0.5f + m_multiSampleOffsetZ[changeItemSeries]; + float angle = (z * x) / float(full) * 1.57f; + float y = qSin(angle * float(qPow(1.3f, changeItemSeries))) + 0.2f + 1.1f *changeItemSeries; + QSurfaceDataItem newItem(QVector3D(x, y, z)); + m_multiseries[changeItemSeries]->dataProxy()->setItem(int(i), int(j), newItem); + changeItemSeries++; + if (changeItemSeries > 3) + changeItemSeries = 0; +#else + qDebug() << "Change item function active only for SqrtSin"; +#endif } } @@ -572,7 +873,24 @@ void GraphModifier::addRow() m_theSeries->dataProxy()->addRow(newRow); } else { - qDebug() << "Change row function active only for SqrtSin"; +#ifdef MULTI_SERIES + qDebug() << "Adding a row into series 3"; + int full = m_limitX * m_limitZ; + int series = 2; + + QSurfaceDataRow *newRow = new QSurfaceDataRow(m_xCount); + float z = float(m_addRowCounter) - m_limitZ + 0.5f + m_multiSampleOffsetZ[series]; + for (int j = 0; j < m_xCount; j++) { + float x = float(j) - m_limitX + 0.5f + m_multiSampleOffsetX[series]; + float angle = float(z * x) / float(full) * 1.57f; + (*newRow)[j].setPosition(QVector3D(x, qSin(angle *float(qPow(1.3f, series))) + 1.1f * series, z)); + } + m_addRowCounter++; + + m_multiseries[series]->dataProxy()->addRow(newRow); +#else + qDebug() << "Add row function active only for SqrtSin"; +#endif } } @@ -605,7 +923,21 @@ void GraphModifier::addRows() m_theSeries->dataProxy()->addRows(dataArray); } else { - qDebug() << "Change row function active only for SqrtSin"; +#ifdef MULTI_SERIES + qDebug() << "Adding 3 rows into series 3"; + int changedSeries = 2; + + QSurfaceDataArray dataArray; + for (int i = 0; i < 3; i++) { + QSurfaceDataRow *newRow = createMultiRow(m_addRowCounter, changedSeries, false); + dataArray.append(newRow); + m_addRowCounter++; + } + + m_multiseries[changedSeries]->dataProxy()->addRows(dataArray); +#else + qDebug() << "Add rows function active only for SqrtSin"; +#endif } } @@ -633,7 +965,28 @@ void GraphModifier::insertRow() m_theSeries->dataProxy()->insertRow(m_insertTestIndexPos, newRow); m_insertTestIndexPos += 2; } else { - qDebug() << "Change row function active only for SqrtSin"; +#ifdef MULTI_SERIES + qDebug() << "Inserting a row into series 3"; + int full = m_limitX * m_limitZ; + int changedSeries = 2; + + QSurfaceDataRow *newRow = new QSurfaceDataRow(m_xCount); + float z = float(m_insertTestZPos) - m_limitZ + m_multiSampleOffsetZ[changedSeries]; + for (int j = 0; j < m_xCount; j++) { + float x = float(j) - m_limitX + m_multiSampleOffsetX[changedSeries]; + float angle = (z * x) / float(full) * 1.57f; + (*newRow)[j].setPosition(QVector3D(x + 0.5f, + qSin(angle * float(qPow(1.3f, changedSeries))) + 1.2f * changedSeries, + z + 1.0f)); + } + + m_insertTestZPos++; + + m_multiseries[2]->dataProxy()->insertRow(m_insertTestIndexPos, newRow); + m_insertTestIndexPos += 2; +#else + qDebug() << "Insert row function active only for SqrtSin"; +#endif } } @@ -665,15 +1018,50 @@ void GraphModifier::insertRows() m_theSeries->dataProxy()->insertRows(m_insertTestIndexPos, dataArray); m_insertTestIndexPos += 4; } else { - qDebug() << "Change row function active only for SqrtSin"; +#ifdef MULTI_SERIES + qDebug() << "Inserting 3 rows into series 3"; + int full = m_limitX * m_limitZ; + int changedSeries = 2; + + QSurfaceDataArray dataArray; + float zAdd = 0.25f; + for (int i = 0; i < 3; i++) { + QSurfaceDataRow *newRow = new QSurfaceDataRow(m_xCount); + float z = float(m_insertTestZPos) - m_limitZ + 0.5f + zAdd + m_multiSampleOffsetZ[changedSeries]; + for (int j = 0; j < m_xCount; j++) { + float x = float(j) - m_limitX + 0.5f + m_multiSampleOffsetX[changedSeries]; + float angle = (z * x) / float(full) * 1.57f; + float y = qSin(angle * float(qPow(1.3f, changedSeries))) + + 1.2f * changedSeries; + (*newRow)[j].setPosition(QVector3D(x, y, z)); + } + zAdd += 0.25f; + dataArray.append(newRow); + } + + m_insertTestZPos++; + + m_multiseries[2]->dataProxy()->insertRows(m_insertTestIndexPos, dataArray); + m_insertTestIndexPos += 4; +#else + qDebug() << "Insert rows function active only for SqrtSin"; +#endif } } void GraphModifier::removeRow() { qDebug() << "Remove an arbitrary row"; + if (m_zCount < 1) + return; + int row = rand() % m_zCount; + +#ifdef MULTI_SERIES + int series = rand() % 4; + m_multiseries[series]->dataProxy()->removeRows(row, 1); +#else m_theSeries->dataProxy()->removeRows(row, 1); +#endif m_zCount--; } diff --git a/tests/surfacetest/graphmodifier.h b/tests/surfacetest/graphmodifier.h index 8ccff62f..7d7d425e 100644 --- a/tests/surfacetest/graphmodifier.h +++ b/tests/surfacetest/graphmodifier.h @@ -25,6 +25,9 @@ #include <QSlider> #include <QTimer> #include <QLabel> +#include <QCheckBox> + +#define MULTI_SERIES using namespace QtDataVisualization; @@ -41,10 +44,27 @@ public: explicit GraphModifier(Q3DSurface *graph); ~GraphModifier(); + void toggleSeries1(bool enabled); + void toggleSeries2(bool enabled); + void toggleSeries3(bool enabled); + void toggleSeries4(bool enabled); void toggleSmooth(bool enabled); void toggleSurfaceGrid(bool enable); void toggleSurface(bool enable); void toggleSeriesVisible(bool enable); + void toggleSmoothS2(bool enabled); + void toggleSurfaceGridS2(bool enable); + void toggleSurfaceS2(bool enable); + void toggleSeries2Visible(bool enable); + void toggleSmoothS3(bool enabled); + void toggleSurfaceGridS3(bool enable); + void toggleSurfaceS3(bool enable); + void toggleSeries3Visible(bool enable); + void toggleSmoothS4(bool enabled); + void toggleSurfaceGridS4(bool enable); + void toggleSurfaceS4(bool enable); + void toggleSeries4Visible(bool enable); + void toggleSqrtSin(bool enable); void togglePlane(bool enable); void setHeightMapData(bool enable); @@ -55,6 +75,10 @@ public: void setAxisRangeSliderZ(QSlider *slider) { m_axisRangeSliderZ = slider; } void setAxisMinSliderX(QSlider *slider) { m_axisMinSliderX = slider; } void setAxisMinSliderZ(QSlider *slider) { m_axisMinSliderZ = slider; } + void setSeries1CB(QCheckBox *cb) { m_series1CB = cb; } + void setSeries2CB(QCheckBox *cb) { m_series2CB = cb; } + void setSeries3CB(QCheckBox *cb) { m_series3CB = cb; } + void setSeries4CB(QCheckBox *cb) { m_series4CB = cb; } void adjustXCount(int count); void adjustZCount(int count); void adjustXRange(int range); @@ -92,16 +116,27 @@ public slots: void handleAxisZChanged(QValue3DAxis *axis); private: + void fillSeries(); void resetArrayAndSliders(QSurfaceDataArray *array, float minZ, float maxZ, float minX, float maxX); + QSurfaceDataRow *createMultiRow(int row, int series, bool change); Q3DSurface *m_graph; + QSurface3DSeries *m_multiseries[4]; + QSurface3DSeries *m_series1; + QSurface3DSeries *m_series2; + QSurface3DSeries *m_series3; + QSurface3DSeries *m_series4; QSlider *m_gridSliderX; QSlider *m_gridSliderZ; QSlider *m_axisRangeSliderX; QSlider *m_axisRangeSliderZ; QSlider *m_axisMinSliderX; QSlider *m_axisMinSliderZ; + QCheckBox *m_series1CB; + QCheckBox *m_series2CB; + QCheckBox *m_series3CB; + QCheckBox *m_series4CB; bool m_gridSlidersLocked; int m_xCount; int m_zCount; @@ -119,6 +154,14 @@ private: QLabel *m_selectionInfoLabel; QSurface3DSeries *m_theSeries; QSurface3DSeries::DrawFlags m_drawMode; + QSurface3DSeries::DrawFlags m_drawMode2; + QSurface3DSeries::DrawFlags m_drawMode3; + QSurface3DSeries::DrawFlags m_drawMode4; + float m_limitX; + float m_limitZ; + float m_offset; + float m_multiSampleOffsetX[4]; + float m_multiSampleOffsetZ[4]; }; #endif diff --git a/tests/surfacetest/main.cpp b/tests/surfacetest/main.cpp index b31586b0..99c60893 100644 --- a/tests/surfacetest/main.cpp +++ b/tests/surfacetest/main.cpp @@ -31,6 +31,7 @@ #include <QScreen> #include <QPainter> #include <QFontComboBox> +#include <QFrame> #include <QDebug> using namespace QtDataVisualization; @@ -82,6 +83,72 @@ int main(int argc, char *argv[]) seriesVisibleCB->setText(QStringLiteral("Series Visible")); seriesVisibleCB->setChecked(true); +#ifdef MULTI_SERIES + smoothCB->setText(QStringLiteral("S1 Flat Surface")); + surfaceGridCB->setText(QStringLiteral("S1 Surface Grid")); + surfaceCB->setText(QStringLiteral("S1 Surface Visible")); + seriesVisibleCB->setText(QStringLiteral("Series 1 Visible")); + + QCheckBox *smoothS2CB = new QCheckBox(widget); + smoothS2CB->setText(QStringLiteral("S2 Flat Surface")); + smoothS2CB->setChecked(true); + + QCheckBox *surfaceGridS2CB = new QCheckBox(widget); + surfaceGridS2CB->setText(QStringLiteral("S2 Surface Grid")); + surfaceGridS2CB->setChecked(true); + + QCheckBox *surfaceS2CB = new QCheckBox(widget); + surfaceS2CB->setText(QStringLiteral("S2 Surface Visible")); + surfaceS2CB->setChecked(true); + + QCheckBox *series2VisibleCB = new QCheckBox(widget); + series2VisibleCB->setText(QStringLiteral("Series 2 Visible")); + series2VisibleCB->setChecked(true); + + QCheckBox *smoothS3CB = new QCheckBox(widget); + smoothS3CB->setText(QStringLiteral("S3 Flat Surface")); + smoothS3CB->setChecked(true); + + QCheckBox *surfaceGridS3CB = new QCheckBox(widget); + surfaceGridS3CB->setText(QStringLiteral("S3 Surface Grid")); + surfaceGridS3CB->setChecked(true); + + QCheckBox *surfaceS3CB = new QCheckBox(widget); + surfaceS3CB->setText(QStringLiteral("S3 Surface Visible")); + surfaceS3CB->setChecked(true); + + QCheckBox *series3VisibleCB = new QCheckBox(widget); + series3VisibleCB->setText(QStringLiteral("Series 3 Visible")); + series3VisibleCB->setChecked(true); + + QCheckBox *smoothS4CB = new QCheckBox(widget); + smoothS4CB->setText(QStringLiteral("S4 Flat Surface")); + smoothS4CB->setChecked(true); + + QCheckBox *surfaceGridS4CB = new QCheckBox(widget); + surfaceGridS4CB->setText(QStringLiteral("S4 Surface Grid")); + surfaceGridS4CB->setChecked(true); + + QCheckBox *surfaceS4CB = new QCheckBox(widget); + surfaceS4CB->setText(QStringLiteral("S4 Surface Visible")); + surfaceS4CB->setChecked(true); + + QCheckBox *series4VisibleCB = new QCheckBox(widget); + series4VisibleCB->setText(QStringLiteral("Series 4 Visible")); + series4VisibleCB->setChecked(true); + + QCheckBox *series1CB = new QCheckBox(widget); + series1CB->setText(QStringLiteral("Series 1")); + + QCheckBox *series2CB = new QCheckBox(widget); + series2CB->setText(QStringLiteral("Series 2")); + + QCheckBox *series3CB = new QCheckBox(widget); + series3CB->setText(QStringLiteral("Series 3")); + + QCheckBox *series4CB = new QCheckBox(widget); + series4CB->setText(QStringLiteral("Series 4")); +#else //QCheckBox *sqrtSinCB = new QCheckBox(widget); QRadioButton *sqrtSinCB = new QRadioButton(widget); sqrtSinCB->setText(QStringLiteral("Sqrt & Sin")); @@ -111,6 +178,7 @@ int main(int argc, char *argv[]) gridSliderZ->setValue(30); gridSliderZ->setMaximum(200); gridSliderZ->setEnabled(true); +#endif QSlider *axisRangeSliderX = new QSlider(Qt::Horizontal, widget); axisRangeSliderX->setTickInterval(1); @@ -187,6 +255,8 @@ int main(int argc, char *argv[]) int(QAbstract3DGraph::SelectionNone)); selectionMode->addItem(QStringLiteral("Item"), int(QAbstract3DGraph::SelectionItem)); + selectionMode->addItem(QStringLiteral("Multi: Item"), + int(QAbstract3DGraph::SelectionItem | QAbstract3DGraph::SelectionMultiSeries)); selectionMode->addItem(QStringLiteral("Row"), int(QAbstract3DGraph::SelectionRow)); selectionMode->addItem(QStringLiteral("Item and Row"), @@ -199,16 +269,24 @@ int main(int argc, char *argv[]) int(QAbstract3DGraph::SelectionRowAndColumn)); selectionMode->addItem(QStringLiteral("Item, Row and Column"), int(QAbstract3DGraph::SelectionItemRowAndColumn)); + selectionMode->addItem(QStringLiteral("Multi: Item, Row and Column"), + int(QAbstract3DGraph::SelectionItemRowAndColumn | QAbstract3DGraph::SelectionMultiSeries)); selectionMode->addItem(QStringLiteral("Slice into Row"), int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionRow)); selectionMode->addItem(QStringLiteral("Slice into Row and Item"), int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndRow)); + selectionMode->addItem(QStringLiteral("Multi: Slice, Row & Item"), + int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndRow + | QAbstract3DGraph::SelectionMultiSeries)); selectionMode->addItem(QStringLiteral("Slice into Column"), int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionColumn)); selectionMode->addItem(QStringLiteral("Slice into Column and Item"), int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndColumn)); - selectionMode->setCurrentIndex(1); + selectionMode->addItem(QStringLiteral("Multi: Slice, Column & Item"), + int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndColumn + | QAbstract3DGraph::SelectionMultiSeries)); +#ifndef MULTI_SERIES QPushButton *selectButton = new QPushButton(widget); selectButton->setText(QStringLiteral("Select random point")); @@ -216,6 +294,7 @@ int main(int argc, char *argv[]) flipViewsButton->setText(QStringLiteral("Flip Views")); QLabel *selectionInfoLabel = new QLabel(widget); +#endif QPushButton *changeRowButton = new QPushButton(widget); changeRowButton->setText(QStringLiteral("Change a row")); @@ -247,11 +326,47 @@ int main(int argc, char *argv[]) QPushButton *removeRowButton = new QPushButton(widget); removeRowButton->setText(QStringLiteral("Remove a row")); + QFrame* line = new QFrame(); + line->setFrameShape(QFrame::HLine); + line->setFrameShadow(QFrame::Sunken); + + QFrame* line2 = new QFrame(); + line2->setFrameShape(QFrame::HLine); + line2->setFrameShadow(QFrame::Sunken); + + QFrame* line3 = new QFrame(); + line3->setFrameShape(QFrame::HLine); + line3->setFrameShadow(QFrame::Sunken); + // Add controls to the layout +#ifdef MULTI_SERIES + vLayout->addWidget(series1CB); +#endif vLayout->addWidget(smoothCB); vLayout->addWidget(surfaceGridCB); vLayout->addWidget(surfaceCB); vLayout->addWidget(seriesVisibleCB); +#ifdef MULTI_SERIES + vLayout->addWidget(line); + vLayout->addWidget(series2CB); + vLayout->addWidget(smoothS2CB); + vLayout->addWidget(surfaceGridS2CB); + vLayout->addWidget(surfaceS2CB); + vLayout->addWidget(series2VisibleCB); + vLayout->addWidget(line2); + vLayout->addWidget(series3CB); + vLayout->addWidget(smoothS3CB); + vLayout->addWidget(surfaceGridS3CB); + vLayout->addWidget(surfaceS3CB); + vLayout->addWidget(series3VisibleCB); + vLayout->addWidget(line3); + vLayout->addWidget(series4CB); + vLayout->addWidget(smoothS4CB); + vLayout->addWidget(surfaceGridS4CB); + vLayout->addWidget(surfaceS4CB); + vLayout->addWidget(series4VisibleCB); +#endif +#ifndef MULTI_SERIES vLayout->addWidget(new QLabel(QStringLiteral("Select surface sample"))); vLayout->addWidget(sqrtSinCB); vLayout->addWidget(planeCB); @@ -260,27 +375,30 @@ int main(int argc, char *argv[]) vLayout->addWidget(gridSlidersLockCB); vLayout->addWidget(gridSliderX); vLayout->addWidget(gridSliderZ); +#endif vLayout->addWidget(new QLabel(QStringLiteral("Adjust axis range"))); vLayout->addWidget(axisRangeSliderX); vLayout->addWidget(axisRangeSliderZ); vLayout->addWidget(new QLabel(QStringLiteral("Adjust axis minimum"))); vLayout->addWidget(axisMinSliderX); vLayout->addWidget(axisMinSliderZ); - vLayout->addWidget(colorPB); - vLayout->addWidget(new QLabel(QStringLiteral("Change font"))); - vLayout->addWidget(fontList); - vLayout->addWidget(labelButton); - vLayout->addWidget(meshButton); - vLayout->addWidget(new QLabel(QStringLiteral("Change theme"))); - vLayout->addWidget(themeList); - vLayout->addWidget(new QLabel(QStringLiteral("Adjust shadow quality"))); - vLayout->addWidget(shadowQuality); - vLayout->addWidget(new QLabel(QStringLiteral("Selection Mode"))); - vLayout->addWidget(selectionMode); - vLayout->addWidget(selectButton); - vLayout->addWidget(selectionInfoLabel); - vLayout->addWidget(flipViewsButton); - + vLayout2->addWidget(new QLabel(QStringLiteral("Change font"))); + vLayout2->addWidget(fontList); + vLayout2->addWidget(labelButton); + vLayout2->addWidget(meshButton); + vLayout2->addWidget(new QLabel(QStringLiteral("Change theme"))); + vLayout2->addWidget(themeList); + vLayout2->addWidget(new QLabel(QStringLiteral("Adjust shadow quality"))); + vLayout2->addWidget(shadowQuality); + vLayout2->addWidget(new QLabel(QStringLiteral("Selection Mode"))); + vLayout2->addWidget(selectionMode); +#ifndef MULTI_SERIES + vLayout2->addWidget(selectButton); + vLayout2->addWidget(selectionInfoLabel); + vLayout2->addWidget(flipViewsButton); +#endif + + vLayout2->addWidget(colorPB); vLayout2->addWidget(changeRowButton); vLayout2->addWidget(changeRowsButton); vLayout2->addWidget(changeMultipleRowsButton); @@ -305,6 +423,78 @@ int main(int argc, char *argv[]) modifier, &GraphModifier::toggleSurface); QObject::connect(seriesVisibleCB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeriesVisible); +#ifdef MULTI_SERIES + QObject::connect(smoothS2CB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSmoothS2); + QObject::connect(surfaceGridS2CB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSurfaceGridS2); + QObject::connect(surfaceS2CB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSurfaceS2); + QObject::connect(series2VisibleCB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSeries2Visible); + + QObject::connect(smoothS3CB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSmoothS3); + QObject::connect(surfaceGridS3CB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSurfaceGridS3); + QObject::connect(surfaceS3CB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSurfaceS3); + QObject::connect(series3VisibleCB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSeries3Visible); + + QObject::connect(smoothS4CB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSmoothS4); + QObject::connect(surfaceGridS4CB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSurfaceGridS4); + QObject::connect(surfaceS4CB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSurfaceS4); + QObject::connect(series4VisibleCB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSeries4Visible); + + QObject::connect(series1CB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSeries1); + QObject::connect(series1CB, &QCheckBox::stateChanged, + smoothCB, &QPushButton::setEnabled); + QObject::connect(series1CB, &QCheckBox::stateChanged, + surfaceGridCB, &QPushButton::setEnabled); + QObject::connect(series1CB, &QCheckBox::stateChanged, + surfaceCB, &QPushButton::setEnabled); + QObject::connect(series1CB, &QCheckBox::stateChanged, + seriesVisibleCB, &QPushButton::setEnabled); + + QObject::connect(series2CB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSeries2); + QObject::connect(series2CB, &QCheckBox::stateChanged, + smoothS2CB, &QPushButton::setEnabled); + QObject::connect(series2CB, &QCheckBox::stateChanged, + surfaceGridS2CB, &QPushButton::setEnabled); + QObject::connect(series2CB, &QCheckBox::stateChanged, + surfaceS2CB, &QPushButton::setEnabled); + QObject::connect(series2CB, &QCheckBox::stateChanged, + series2VisibleCB, &QPushButton::setEnabled); + + QObject::connect(series3CB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSeries3); + QObject::connect(series3CB, &QCheckBox::stateChanged, + smoothS3CB, &QPushButton::setEnabled); + QObject::connect(series3CB, &QCheckBox::stateChanged, + surfaceGridS3CB, &QPushButton::setEnabled); + QObject::connect(series3CB, &QCheckBox::stateChanged, + surfaceS3CB, &QPushButton::setEnabled); + QObject::connect(series3CB, &QCheckBox::stateChanged, + series3VisibleCB, &QPushButton::setEnabled); + + QObject::connect(series4CB, &QCheckBox::stateChanged, + modifier, &GraphModifier::toggleSeries4); + QObject::connect(series4CB, &QCheckBox::stateChanged, + smoothS4CB, &QPushButton::setEnabled); + QObject::connect(series4CB, &QCheckBox::stateChanged, + surfaceGridS4CB, &QPushButton::setEnabled); + QObject::connect(series4CB, &QCheckBox::stateChanged, + surfaceS4CB, &QPushButton::setEnabled); + QObject::connect(series4CB, &QCheckBox::stateChanged, + series4VisibleCB, &QPushButton::setEnabled); +#else QObject::connect(sqrtSinCB, &QRadioButton::toggled, modifier, &GraphModifier::toggleSqrtSin); QObject::connect(planeCB, &QCheckBox::toggled, @@ -317,6 +507,7 @@ int main(int argc, char *argv[]) modifier, &GraphModifier::adjustXCount); QObject::connect(gridSliderZ, &QSlider::valueChanged, modifier, &GraphModifier::adjustZCount); +#endif QObject::connect(axisRangeSliderX, &QSlider::valueChanged, modifier, &GraphModifier::adjustXRange); QObject::connect(axisRangeSliderZ, &QSlider::valueChanged, @@ -339,10 +530,12 @@ int main(int argc, char *argv[]) modifier, SLOT(changeShadowQuality(int))); QObject::connect(selectionMode, SIGNAL(currentIndexChanged(int)), modifier, SLOT(changeSelectionMode(int))); +#ifndef MULTI_SERIES QObject::connect(selectButton, &QPushButton::clicked, modifier, &GraphModifier::selectButtonClicked); QObject::connect(flipViewsButton, &QPushButton::clicked, modifier, &GraphModifier::flipViews); +#endif QObject::connect(changeRowButton,&QPushButton::clicked, modifier, &GraphModifier::changeRow); QObject::connect(changeRowsButton,&QPushButton::clicked, @@ -364,15 +557,28 @@ int main(int argc, char *argv[]) QObject::connect(removeRowButton,&QPushButton::clicked, modifier, &GraphModifier::removeRow); - modifier->setGridSliderZ(gridSliderZ); - modifier->setGridSliderX(gridSliderX); +#ifdef MULTI_SERIES + modifier->setSeries1CB(series1CB); + modifier->setSeries2CB(series2CB); + modifier->setSeries3CB(series3CB); + modifier->setSeries4CB(series4CB); + series1CB->setChecked(true); + series2CB->setChecked(true); + series3CB->setChecked(true); + series4CB->setChecked(true); +#endif modifier->setAxisRangeSliderX(axisRangeSliderX); modifier->setAxisRangeSliderZ(axisRangeSliderZ); modifier->setAxisMinSliderX(axisMinSliderX); modifier->setAxisMinSliderZ(axisMinSliderZ); + selectionMode->setCurrentIndex(1); +#ifndef MULTI_SERIES + modifier->setGridSliderZ(gridSliderZ); + modifier->setGridSliderX(gridSliderX); modifier->toggleGridSliderLock(gridSlidersLockCB->checkState()); modifier->setSelectionInfoLabel(selectionInfoLabel); sqrtSinCB->setChecked(true); +#endif shadowQuality->setCurrentIndex(3); return app.exec(); diff --git a/tests/surfacetest/surfacetest.pro b/tests/surfacetest/surfacetest.pro index 9ab890a7..134e8a6e 100644 --- a/tests/surfacetest/surfacetest.pro +++ b/tests/surfacetest/surfacetest.pro @@ -7,8 +7,6 @@ SOURCES += main.cpp \ QT += widgets -INSTALLS += target - HEADERS += \ graphmodifier.h diff --git a/tests/tests.pri b/tests/tests.pri index 59253152..d6474f1b 100644 --- a/tests/tests.pri +++ b/tests/tests.pri @@ -1,16 +1,3 @@ -android { - target.path = /libs/$$ANDROID_TARGET_ARCH -} else { - target.path = $$[QT_INSTALL_TESTS]/datavisualization/$$TARGET -} - -win32 { - CONFIG(debug, release|debug):DESTDIR = $$OUT_PWD/debug - CONFIG(release, release|debug):DESTDIR = $$OUT_PWD/release -} else { - DESTDIR = $$OUT_PWD -} - INCLUDEPATH += ../../include LIBS += -L$$OUT_PWD/../../lib @@ -19,94 +6,9 @@ TEMPLATE = app QT += datavisualization -!static:android { - # Add Qt library to be loaded in shared android build - vis_lib_name = DataVisualization - vis_src_lib = lib$${vis_lib_name}.so - vis_lib_dir = $$OUT_PWD/../../lib/$$vis_src_lib - vis_lib_formatted = $$replace(vis_lib_dir, /, $$QMAKE_DIR_SEP) - ANDROID_EXTRA_LIBS = $$vis_lib_formatted -} - contains(TARGET, qml.*) { - uri = QtDataVisualization - lib_name = datavisualizationqml2 - - uri_replaced = $$replace(uri, \\., $$QMAKE_DIR_SEP) - make_qmldir_path = $$DESTDIR/$$uri_replaced - !exists($$make_qmldir_path) { - make_qmldir_target = \"$$replace(make_qmldir_path, /, $$QMAKE_DIR_SEP)\" - system($$QMAKE_MKDIR $$make_qmldir_target) - } - copy_qmldir.target = $$make_qmldir_path/qmldir - copy_qmldir.depends = $$_PRO_FILE_PWD_/../../src/$$lib_name/qmldir - copy_qmldir_formatted = \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\" - copy_qmldir.commands = $(COPY_FILE) $$copy_qmldir_formatted - QMAKE_EXTRA_TARGETS += copy_qmldir - PRE_TARGETDEPS += $$copy_qmldir.target - - static:contains(QT_CONFIG, static) { - # Make import scan find our copied qmldir & statically built qml lib - !win32 { - LIB_EXTENSION = a - } else { - LIB_EXTENSION = lib - } - QMLPATHS += $$DESTDIR - # We need to copy the qmldir & lib already at qmake run stage as import scan is done then - exists($$copy_qmldir.depends): system($$QMAKE_COPY $$copy_qmldir_formatted) - } else { - win32 { - LIB_EXTENSION = dll - } else { - mac|ios { - LIB_EXTENSION = dylib - } else { - LIB_EXTENSION = so - } - } - } - - win32 { - CONFIG(debug, release|debug) { - src_dir = /debug - src_lib = $${lib_name}d.$$LIB_EXTENSION - } - CONFIG(release, release|debug){ - src_dir = /release - src_lib = $${lib_name}.$$LIB_EXTENSION - } - } else { - src_dir = - mac|ios { - CONFIG(debug, release|debug) { - src_lib = lib$${lib_name}_debug.$$LIB_EXTENSION - } - CONFIG(release, release|debug){ - src_lib = lib$${lib_name}.$$LIB_EXTENSION - } - } else { - # linux, android - src_lib = lib$${lib_name}.$$LIB_EXTENSION - } - } - copy_lib.target = $$make_qmldir_path/$$src_lib - copy_lib.depends = $$OUT_PWD/../../src/$$lib_name$$src_dir/$$src_lib - copy_lib_formatted = \"$$replace(copy_lib.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_lib.target, /, $$QMAKE_DIR_SEP)\" - copy_lib.commands = $(COPY_FILE) $$copy_lib_formatted - QMAKE_EXTRA_TARGETS += copy_lib - PRE_TARGETDEPS += $$copy_lib.target - - android { - system($$QMAKE_COPY $$copy_qmldir_formatted) - android_qmldir.files = $$copy_qmldir.target - android_qmldir.path = /assets/qml/$$uri_replaced - INSTALLS += android_qmldir - } - android|ios { - system($$QMAKE_COPY $$copy_lib_formatted) - android_qmlplugin.files = $$copy_lib.target - android_qmlplugin.path = $$target.path - INSTALLS += android_qmlplugin - } + QT += qml quick } + +target.path = $$[QT_INSTALL_TESTS]/datavisualization/$$TARGET +INSTALLS += target |