diff options
Diffstat (limited to 'tests/manual')
89 files changed, 2070 insertions, 1593 deletions
diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt new file mode 100644 index 00000000..32112c6b --- /dev/null +++ b/tests/manual/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +if(TARGET Qt::Quick) + add_subdirectory(qmldynamicdata) + add_subdirectory(qmlmultitest) + add_subdirectory(qmlvolume) + add_subdirectory(qmlperf) + add_subdirectory(qmlgradient) + add_subdirectory(qmlheightmap) + add_subdirectory(qmlbarsrowcolors) +endif() +if(NOT ANDROID AND NOT IOS AND NOT WINRT) + add_subdirectory(barstest) + add_subdirectory(scattertest) + add_subdirectory(surfacetest) + add_subdirectory(multigraphs) + add_subdirectory(directional) + add_subdirectory(itemmodeltest) + add_subdirectory(volumetrictest) + add_subdirectory(minimalbars) + add_subdirectory(minimalscatter) + add_subdirectory(minimalsurface) +endif() diff --git a/tests/manual/barstest/CMakeLists.txt b/tests/manual/barstest/CMakeLists.txt new file mode 100644 index 00000000..391b98aa --- /dev/null +++ b/tests/manual/barstest/CMakeLists.txt @@ -0,0 +1,33 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(barstest + GUI + SOURCES + chart.cpp chart.h + sliderwrapper.cpp sliderwrapper.h + buttonwrapper.cpp buttonwrapper.h + custominputhandler.cpp custominputhandler.h + main.cpp + NO_PCH_SOURCES + chart.cpp # undef QT_NO_FOREACH + ) +target_link_libraries(barstest PUBLIC + Qt::Gui + Qt::Widgets + Qt::DataVisualization + ) + +set(barstest_resource_files + "shuttle.obj" + "shuttle.png" + ) + +qt_internal_add_resource(barstest "barstest" + PREFIX + "/" + FILES + ${barstest_resource_files} + ) diff --git a/tests/manual/barstest/buttonwrapper.cpp b/tests/manual/barstest/buttonwrapper.cpp new file mode 100644 index 00000000..c8eef0c7 --- /dev/null +++ b/tests/manual/barstest/buttonwrapper.cpp @@ -0,0 +1,14 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#include "buttonwrapper.h" +#include <QPushButton> + +ButtonWrapper::ButtonWrapper(QPushButton *button) +{ + m_button = button; +} + +void ButtonWrapper::setEnabled(int state) +{ + m_button->setEnabled(state); +} diff --git a/tests/manual/barstest/buttonwrapper.h b/tests/manual/barstest/buttonwrapper.h new file mode 100644 index 00000000..d0112117 --- /dev/null +++ b/tests/manual/barstest/buttonwrapper.h @@ -0,0 +1,22 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#ifndef BUTTONWRAPPER_H +#define BUTTONWRAPPER_H + +#include <QObject> +class QPushButton; + +class ButtonWrapper : public QObject +{ + Q_OBJECT +public: + ButtonWrapper(QPushButton *button); + +public Q_SLOTS: + void setEnabled(int state); + +private: + QPushButton *m_button; +}; + +#endif // BUTTONWRAPPER_H diff --git a/tests/manual/barstest/chart.cpp b/tests/manual/barstest/chart.cpp index 2cc52ecf..d427921a 100644 --- a/tests/manual/barstest/chart.cpp +++ b/tests/manual/barstest/chart.cpp @@ -1,31 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses #include "chart.h" #include "custominputhandler.h" @@ -42,8 +18,6 @@ #include <QtCore/QElapsedTimer> #include <QtCore/qmath.h> -using namespace QtDataVisualization; - const QString celsiusString = QString(QChar(0xB0)) + "C"; GraphModifier::GraphModifier(Q3DBars *barchart, QColorDialog *colorDialog) @@ -56,6 +30,8 @@ GraphModifier::GraphModifier(Q3DBars *barchart, QColorDialog *colorDialog) m_static(true), m_barSpacingX(0.1f), m_barSpacingZ(0.1f), + m_barSeriesMarginX(0.0f), + m_barSeriesMarginZ(0.0f), m_fontSize(20), m_segments(10), m_subSegments(3), @@ -268,7 +244,7 @@ void GraphModifier::start() restart(false); } -void GraphModifier::restart(bool dynamicData) +void GraphModifier::restart(int dynamicData) { m_static = !dynamicData; @@ -343,7 +319,7 @@ void GraphModifier::releaseSeries() m_graph->removeSeries(series); } -void GraphModifier::flipViews() +void GraphModifier::flipViews(bool checked) { m_graph->scene()->setSecondarySubviewOnTop(!m_graph->scene()->isSecondarySubviewOnTop()); qDebug() << "secondary subview on top:" << m_graph->scene()->isSecondarySubviewOnTop(); @@ -686,7 +662,9 @@ void GraphModifier::changeSelectionMode() { static int selectionMode = m_graph->selectionMode(); - if (++selectionMode > (QAbstract3DGraph::SelectionItemAndColumn | QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionMultiSeries)) + if (++selectionMode > (int)(QAbstract3DGraph::SelectionItemAndColumn | + QAbstract3DGraph::SelectionSlice | + QAbstract3DGraph::SelectionMultiSeries)) selectionMode = QAbstract3DGraph::SelectionNone; m_graph->setSelectionMode((QAbstract3DGraph::SelectionFlag)selectionMode); @@ -733,7 +711,7 @@ void GraphModifier::handleSelectionChange(const QPoint &position) qDebug() << "Selected bar position:" << position << "series:" << index; } -void GraphModifier::setUseNullInputHandler(bool useNull) +void GraphModifier::setUseNullInputHandler(int useNull) { qDebug() << "setUseNullInputHandler" << useNull; if (m_useNullInputHandler == useNull) @@ -826,7 +804,7 @@ QBarDataArray *GraphModifier::makeDummyData() } // Executes one step of the primary series test -void GraphModifier::primarySeriesTest() +void GraphModifier::primarySeriesTest(bool checked) { static int nextStep = 0; @@ -1048,7 +1026,7 @@ void GraphModifier::insertRemoveTestToggle() } } -void GraphModifier::toggleRotation() +void GraphModifier::toggleRotation(bool checked) { if (m_rotationTimer.isActive()) m_rotationTimer.stop(); @@ -1056,7 +1034,7 @@ void GraphModifier::toggleRotation() m_rotationTimer.start(20); } -void GraphModifier::useLogAxis() +void GraphModifier::useLogAxis(bool checked) { static int counter = -1; static QLogValue3DAxisFormatter *logFormatter = 0; @@ -1212,7 +1190,7 @@ void GraphModifier::addRemoveSeries() counter++; } -void GraphModifier::testItemAndRowChanges() +void GraphModifier::testItemAndRowChanges(bool checked) { static int counter = 0; const int rowCount = 12; @@ -1602,7 +1580,7 @@ void GraphModifier::rotateY(int rotation) m_graph->scene()->activeCamera()->setCameraPosition(m_xRotation, m_yRotation); } -void GraphModifier::setFpsMeasurement(bool enable) +void GraphModifier::setFpsMeasurement(int enable) { m_graph->setMeasureFps(enable); } @@ -1624,6 +1602,18 @@ void GraphModifier::setSpacingSpecsZ(int spacing) m_graph->setBarSpacing(QSizeF(m_barSpacingX, m_barSpacingZ)); } +void GraphModifier::setMarginX(int margin) +{ + m_barSeriesMarginX = (float)margin / 100.0f; + m_graph->setBarSeriesMargin(QSizeF(m_barSeriesMarginX, m_barSeriesMarginZ)); +} + +void GraphModifier::setMarginZ(int margin) +{ + m_barSeriesMarginZ = (float)margin / 100.0f; + m_graph->setBarSeriesMargin(QSizeF(m_barSeriesMarginX, m_barSeriesMarginZ)); +} + void GraphModifier::setSampleCountX(int samples) { m_columnCount = samples; @@ -1659,7 +1649,7 @@ void GraphModifier::setMaxY(int max) m_maxval = max; } -void GraphModifier::changeColorStyle() +void GraphModifier::changeColorStyle(bool checked) { int style = m_graph->activeTheme()->colorStyle(); @@ -1669,7 +1659,7 @@ void GraphModifier::changeColorStyle() m_graph->activeTheme()->setColorStyle(Q3DTheme::ColorStyle(style)); } -void GraphModifier::useOwnTheme() +void GraphModifier::useOwnTheme(bool checked) { // Own theme is persistent, any changes to it via UI will be remembered if (!m_ownTheme) { @@ -1708,7 +1698,7 @@ void GraphModifier::changeBaseColor(const QColor &color) m_graph->activeTheme()->setBaseColors(colors); } -void GraphModifier::setGradient() +void GraphModifier::setGradient(bool checked) { QLinearGradient barGradient(0, 0, 1, 100); barGradient.setColorAt(1.0, Qt::lightGray); @@ -1748,7 +1738,7 @@ void GraphModifier::toggleMultiseriesScaling() m_graph->setMultiSeriesUniform(!m_graph->isMultiSeriesUniform()); } -void GraphModifier::setReflection(bool enabled) +void GraphModifier::setReflection(int enabled) { m_graph->setReflection(enabled); } diff --git a/tests/manual/barstest/chart.h b/tests/manual/barstest/chart.h index eb5b948b..ae72318e 100644 --- a/tests/manual/barstest/chart.h +++ b/tests/manual/barstest/chart.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef CHARTMODIFIER_H #define CHARTMODIFIER_H @@ -42,8 +16,6 @@ #include <QTimer> #include <QLabel> -using namespace QtDataVisualization; - class GraphModifier : public QObject { Q_OBJECT @@ -70,13 +42,15 @@ public: void changeFontSize(int fontsize); void rotateX(int rotation); void rotateY(int rotation); - void setFpsMeasurement(bool enable); + void setFpsMeasurement(int state); void setBackgroundEnabled(int enabled); void setGridEnabled(int enabled); void setSpecsRatio(int barwidth); void setSpecsZ(int bardepth); void setSpacingSpecsX(int spacing); void setSpacingSpecsZ(int spacing); + void setMarginX(int margin); + void setMarginZ(int margin); void setSampleCountX(int samples); void setSampleCountZ(int samples); void setMinX(int min); @@ -84,43 +58,43 @@ public: void setMinY(int min); void setMaxY(int max); void start(); - void restart(bool dynamicData); + void restart(int dynamicData); void selectBar(); void swapAxis(); void releaseAxes(); void releaseSeries(); void createMassiveArray(); - void useOwnTheme(); + void useOwnTheme(bool checked); void changeBaseColor(const QColor &color); - void changeColorStyle(); + void changeColorStyle(bool checked); void showFiveSeries(); QBarDataArray *makeDummyData(); - void primarySeriesTest(); + void primarySeriesTest(bool checked); void insertRemoveTestToggle(); - void toggleRotation(); - void useLogAxis(); + void toggleRotation(bool checked); + void useLogAxis(bool checked); void changeValueAxisFormat(const QString & text); void changeLogBase(const QString & text); void setFpsLabel(QLabel *fpsLabel) { m_fpsLabel = fpsLabel; } void addRemoveSeries(); - void testItemAndRowChanges(); + void testItemAndRowChanges(bool checked); void reverseValueAxis(int enabled); void setInputHandlerRotationEnabled(int enabled); void setInputHandlerZoomEnabled(int enabled); void setInputHandlerSelectionEnabled(int enabled); void setInputHandlerZoomAtTargetEnabled(int enabled); - void setReflection(bool enabled); + void setReflection(int enabled); void setReflectivity(int value); void toggleCustomItem(); public Q_SLOTS: - void flipViews(); - void setGradient(); + void flipViews(bool checked); + void setGradient(bool checked); void toggleMultiseriesScaling(); void changeShadowQuality(int quality); void shadowQualityUpdatedByVisual(QAbstract3DGraph::ShadowQuality shadowQuality); void handleSelectionChange(const QPoint &position); - void setUseNullInputHandler(bool useNull); + void setUseNullInputHandler(int useNull); void changeValueAxisSegments(int value); void handleRowAxisChanged(QCategory3DAxis *axis); @@ -152,9 +126,11 @@ private: int m_rowCount; float m_xRotation; float m_yRotation; - bool m_static; + int m_static; float m_barSpacingX; float m_barSpacingZ; + float m_barSeriesMarginX; + float m_barSeriesMarginZ; int m_fontSize; int m_segments; int m_subSegments; diff --git a/tests/manual/barstest/custominputhandler.cpp b/tests/manual/barstest/custominputhandler.cpp index e6fe9aa5..2740fddb 100644 --- a/tests/manual/barstest/custominputhandler.cpp +++ b/tests/manual/barstest/custominputhandler.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "custominputhandler.h" diff --git a/tests/manual/barstest/custominputhandler.h b/tests/manual/barstest/custominputhandler.h index ef07d5ec..ee762cee 100644 --- a/tests/manual/barstest/custominputhandler.h +++ b/tests/manual/barstest/custominputhandler.h @@ -1,47 +1,19 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef CUSTOMINPUTHANDLER_H #define CUSTOMINPUTHANDLER_H #include <QtDataVisualization/QAbstract3DInputHandler> -using namespace QtDataVisualization; - class CustomInputHandler : public QAbstract3DInputHandler { Q_OBJECT public: explicit CustomInputHandler(QObject *parent = 0); - virtual void mouseMoveEvent(QMouseEvent *event, const QPoint &mousePos); - virtual void wheelEvent(QWheelEvent *event); + virtual void mouseMoveEvent(QMouseEvent *event, const QPoint &mousePos) override; + virtual void wheelEvent(QWheelEvent *event) override; }; #endif diff --git a/tests/manual/barstest/main.cpp b/tests/manual/barstest/main.cpp index 88c1884f..178b91f3 100644 --- a/tests/manual/barstest/main.cpp +++ b/tests/manual/barstest/main.cpp @@ -1,33 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "chart.h" +#include "sliderwrapper.h" +#include "buttonwrapper.h" #include <QApplication> #include <QWidget> @@ -52,6 +28,7 @@ int main(int argc, char **argv) { + qputenv("QSG_RHI_BACKEND", "opengl"); QApplication app(argc, argv); // Test creating custom items before graph is created @@ -303,6 +280,18 @@ int main(int argc, char **argv) spacingSliderZ->setValue(10); spacingSliderZ->setMaximum(200); + QSlider *marginSliderX = new QSlider(Qt::Horizontal, widget); + marginSliderX->setTickInterval(1); + marginSliderX->setMinimum(0); + marginSliderX->setValue(0); + marginSliderX->setMaximum(100); + + QSlider *marginSliderZ = new QSlider(Qt::Horizontal, widget); + marginSliderZ->setTickInterval(1); + marginSliderZ->setMinimum(0); + marginSliderZ->setValue(0); + marginSliderZ->setMaximum(100); + QSlider *sampleSliderX = new QSlider(Qt::Horizontal, widget); sampleSliderX->setTickInterval(1); sampleSliderX->setMinimum(1); @@ -432,6 +421,9 @@ int main(int argc, char **argv) vLayout2->addWidget(new QLabel(QStringLiteral("Adjust relative bar spacing")), 0, Qt::AlignTop); vLayout2->addWidget(spacingSliderX, 0, Qt::AlignTop); vLayout2->addWidget(spacingSliderZ, 0, Qt::AlignTop); + vLayout2->addWidget(new QLabel(QStringLiteral("Adjust margin")), 0, Qt::AlignTop); + vLayout2->addWidget(marginSliderX, 0, Qt::AlignTop); + vLayout2->addWidget(marginSliderZ, 0, Qt::AlignTop); vLayout2->addWidget(new QLabel(QStringLiteral("Adjust sample count")), 0, Qt::AlignTop); vLayout2->addWidget(sampleSliderX, 0, Qt::AlignTop); vLayout2->addWidget(sampleSliderZ, 0, Qt::AlignTop); @@ -471,7 +463,7 @@ int main(int argc, char **argv) vLayout3->addWidget(toggleCustomItemButton, 0, Qt::AlignTop); vLayout3->addWidget(new QLabel(QStringLiteral("Adjust floor level")), 0, Qt::AlignTop); vLayout3->addWidget(floorLevelSlider, 0, Qt::AlignTop); - vLayout3->addWidget(new QLabel(QStringLiteral("Adjust margin")), 0, Qt::AlignTop); + vLayout3->addWidget(new QLabel(QStringLiteral("Adjust bar series margin")), 0, Qt::AlignTop); vLayout3->addWidget(marginSlider, 1, Qt::AlignTop); widget->show(); @@ -488,6 +480,9 @@ int main(int argc, char **argv) QObject::connect(spacingSliderZ, &QSlider::valueChanged, modifier, &GraphModifier::setSpacingSpecsZ); + QObject::connect(marginSliderX, &QSlider::valueChanged, modifier, &GraphModifier::setMarginX); + QObject::connect(marginSliderZ, &QSlider::valueChanged, modifier, &GraphModifier::setMarginZ); + QObject::connect(sampleSliderX, &QSlider::valueChanged, modifier, &GraphModifier::setSampleCountX); QObject::connect(sampleSliderZ, &QSlider::valueChanged, modifier, @@ -594,12 +589,14 @@ int main(int argc, char **argv) QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, modifier, &GraphModifier::setUseNullInputHandler); - QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderX, - &QSlider::setEnabled); + SliderWrapper *rotationSliderWrapperX = new SliderWrapper(rotationSliderX); + SliderWrapper *rotationSliderWrapperY = new SliderWrapper(rotationSliderY); + QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderWrapperX, + &SliderWrapper::setEnabled); QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderX, &QSlider::setValue); - QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderY, - &QSlider::setEnabled); + QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderWrapperY, + &SliderWrapper::setEnabled); QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderY, &QSlider::setValue); @@ -614,40 +611,59 @@ int main(int argc, char **argv) QObject::connect(toggleCustomItemButton, &QPushButton::clicked, modifier, &GraphModifier::toggleCustomItem); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, addDataButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, addMultiDataButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, insertDataButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, insertMultiDataButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeSingleDataButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeRowButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeRowsButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, removeRowButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, removeRowsButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, massiveArrayButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderX, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderZ, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderX, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderZ, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderY, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, maxSliderY, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, swapAxisButton, - &QSlider::setEnabled); + ButtonWrapper *addDataButtonWrapper = new ButtonWrapper(addDataButton); + ButtonWrapper *addMultiDataButtonWrapper = new ButtonWrapper(addMultiDataButton); + ButtonWrapper *insertDataButtonWrapper = new ButtonWrapper(insertDataButton); + ButtonWrapper *insertMultiDataButtonWrapper = new ButtonWrapper(insertMultiDataButton); + ButtonWrapper *changeSingleDataButtonWrapper = new ButtonWrapper(changeSingleDataButton); + ButtonWrapper *changeRowButtonWrapper = new ButtonWrapper(changeRowButton); + ButtonWrapper *changeRowsButtonWrapper = new ButtonWrapper(changeRowsButton); + ButtonWrapper *massiveArrayButtonWrapper = new ButtonWrapper(massiveArrayButton); + ButtonWrapper *removeRowButtonWrapper = new ButtonWrapper(removeRowButton); + ButtonWrapper *removeRowsButtonWrapper = new ButtonWrapper(removeRowsButton); + + SliderWrapper *sampleSliderWrapperX = new SliderWrapper(sampleSliderX); + SliderWrapper *sampleSliderWrapperZ = new SliderWrapper(sampleSliderZ); + SliderWrapper *minSliderWrapperX = new SliderWrapper(minSliderX); + SliderWrapper *minSliderWrapperZ = new SliderWrapper(minSliderZ); + SliderWrapper *minSliderWrapperY = new SliderWrapper(minSliderY); + SliderWrapper *maxSliderWrapperY = new SliderWrapper(maxSliderY); + ButtonWrapper *swapAxisButtonWrapper = new ButtonWrapper(swapAxisButton); + + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, addDataButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, addMultiDataButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, insertDataButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, insertMultiDataButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeSingleDataButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeRowButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeRowsButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, removeRowButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, removeRowsButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, massiveArrayButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderWrapperX, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderWrapperZ, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderWrapperX, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderWrapperZ, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderWrapperY, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, maxSliderWrapperY, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, swapAxisButtonWrapper, + &ButtonWrapper::setEnabled); QObject::connect(staticCheckBox, &QCheckBox::stateChanged, modifier, &GraphModifier::restart); modifier->setFpsLabel(fpsLabel); diff --git a/tests/manual/barstest/sliderwrapper.cpp b/tests/manual/barstest/sliderwrapper.cpp new file mode 100644 index 00000000..bdfeb4f7 --- /dev/null +++ b/tests/manual/barstest/sliderwrapper.cpp @@ -0,0 +1,13 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#include "sliderwrapper.h" + +SliderWrapper::SliderWrapper(QSlider *slider) +{ + m_slider = slider; +} + +void SliderWrapper::setEnabled(int enabled) +{ + m_slider->setEnabled(enabled); +} diff --git a/tests/manual/barstest/sliderwrapper.h b/tests/manual/barstest/sliderwrapper.h new file mode 100644 index 00000000..f6d9404a --- /dev/null +++ b/tests/manual/barstest/sliderwrapper.h @@ -0,0 +1,23 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#ifndef SLIDERWRAPPER_H +#define SLIDERWRAPPER_H +#include <QObject> +#include <QSlider> + +class SliderWrapper : public QObject +{ + Q_OBJECT + +public: + explicit SliderWrapper(QSlider *slider); + +public Q_SLOTS: + void setEnabled(int enabled); + +private: + QSlider *m_slider = nullptr; + +}; + +#endif // SLIDERWRAPPER_H diff --git a/tests/manual/directional/CMakeLists.txt b/tests/manual/directional/CMakeLists.txt new file mode 100644 index 00000000..43b961e0 --- /dev/null +++ b/tests/manual/directional/CMakeLists.txt @@ -0,0 +1,16 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(directional + GUI + SOURCES + main.cpp + scatterdatamodifier.cpp scatterdatamodifier.h + ) +target_link_libraries(directional PUBLIC + Qt::Gui + Qt::Widgets + Qt::DataVisualization + ) diff --git a/tests/manual/directional/main.cpp b/tests/manual/directional/main.cpp index a3e7bb8b..66b80d40 100644 --- a/tests/manual/directional/main.cpp +++ b/tests/manual/directional/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "scatterdatamodifier.h" @@ -43,6 +17,7 @@ int main(int argc, char **argv) { + qputenv("QSG_RHI_BACKEND", "opengl"); QApplication app(argc, argv); Q3DScatter *graph = new Q3DScatter(); QWidget *container = QWidget::createWindowContainer(graph); diff --git a/tests/manual/directional/scatterdatamodifier.cpp b/tests/manual/directional/scatterdatamodifier.cpp index 2a98625d..b537a8a2 100644 --- a/tests/manual/directional/scatterdatamodifier.cpp +++ b/tests/manual/directional/scatterdatamodifier.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "scatterdatamodifier.h" #include <QtDataVisualization/qscatterdataproxy.h> @@ -37,8 +11,6 @@ #include <qmath.h> #include <QComboBox> -using namespace QtDataVisualization; - const int numberOfCols = 8; const int numberOfRows = 8; const float limit = 8.0f; diff --git a/tests/manual/directional/scatterdatamodifier.h b/tests/manual/directional/scatterdatamodifier.h index 447e1603..c794d17c 100644 --- a/tests/manual/directional/scatterdatamodifier.h +++ b/tests/manual/directional/scatterdatamodifier.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef SCATTERDATAMODIFIER_H #define SCATTERDATAMODIFIER_H @@ -35,8 +9,6 @@ #include <QtGui/QFont> #include <QtCore/QTimer> -using namespace QtDataVisualization; - class ScatterDataModifier : public QObject { Q_OBJECT @@ -67,7 +39,7 @@ Q_SIGNALS: void backgroundEnabledChanged(bool enabled); void gridEnabledChanged(bool enabled); void shadowQualityChanged(int quality); - void fontChanged(QFont font); + void fontChanged(const QFont &font); private: Q3DScatter *m_graph; diff --git a/tests/manual/galaxy/CMakeLists.txt b/tests/manual/galaxy/CMakeLists.txt new file mode 100644 index 00000000..f089ed7d --- /dev/null +++ b/tests/manual/galaxy/CMakeLists.txt @@ -0,0 +1,14 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +qt_add_executable(galaxy + cumulativedistributor.cpp cumulativedistributor.h + galaxydata.cpp galaxydata.h + main.cpp + star.cpp star.h + ) +target_link_libraries(galaxy PUBLIC + Qt::Gui + Qt::Widgets + ) diff --git a/tests/manual/galaxy/cumulativedistributor.cpp b/tests/manual/galaxy/cumulativedistributor.cpp index 4506480c..961583ff 100644 --- a/tests/manual/galaxy/cumulativedistributor.cpp +++ b/tests/manual/galaxy/cumulativedistributor.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only /* * Galaxy creation code obtained from http://beltoforion.de/galaxy/galaxy_en.html diff --git a/tests/manual/galaxy/cumulativedistributor.h b/tests/manual/galaxy/cumulativedistributor.h index 56276e98..60c48ccc 100644 --- a/tests/manual/galaxy/cumulativedistributor.h +++ b/tests/manual/galaxy/cumulativedistributor.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only /* * Galaxy creation code obtained from http://beltoforion.de/galaxy/galaxy_en.html diff --git a/tests/manual/galaxy/galaxydata.cpp b/tests/manual/galaxy/galaxydata.cpp index c49e07fd..73ccf9c5 100644 --- a/tests/manual/galaxy/galaxydata.cpp +++ b/tests/manual/galaxy/galaxydata.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only /* * Galaxy creation code obtained from http://beltoforion.de/galaxy/galaxy_en.html diff --git a/tests/manual/galaxy/galaxydata.h b/tests/manual/galaxy/galaxydata.h index e01db67b..6127482e 100644 --- a/tests/manual/galaxy/galaxydata.h +++ b/tests/manual/galaxy/galaxydata.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef SCATTERDATAMODIFIER_H #define SCATTERDATAMODIFIER_H diff --git a/tests/manual/galaxy/main.cpp b/tests/manual/galaxy/main.cpp index 5fb7b0ca..a0cbda52 100644 --- a/tests/manual/galaxy/main.cpp +++ b/tests/manual/galaxy/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "galaxydata.h" diff --git a/tests/manual/galaxy/star.cpp b/tests/manual/galaxy/star.cpp index ca6b66f0..5b639125 100644 --- a/tests/manual/galaxy/star.cpp +++ b/tests/manual/galaxy/star.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "star.h" diff --git a/tests/manual/galaxy/star.h b/tests/manual/galaxy/star.h index 9c5dc1ac..045a9702 100644 --- a/tests/manual/galaxy/star.h +++ b/tests/manual/galaxy/star.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef STAR_H #define STAR_H diff --git a/tests/manual/itemmodeltest/CMakeLists.txt b/tests/manual/itemmodeltest/CMakeLists.txt new file mode 100644 index 00000000..8fee8d00 --- /dev/null +++ b/tests/manual/itemmodeltest/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_manual_test(itemmodeltest + GUI + SOURCES + main.cpp + ) +target_link_libraries(itemmodeltest PUBLIC + Qt::Gui + Qt::Widgets + Qt::DataVisualization + ) diff --git a/tests/manual/itemmodeltest/main.cpp b/tests/manual/itemmodeltest/main.cpp index 90a2e74e..feebd1b1 100644 --- a/tests/manual/itemmodeltest/main.cpp +++ b/tests/manual/itemmodeltest/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtDataVisualization/q3dbars.h> #include <QtDataVisualization/q3dsurface.h> @@ -50,8 +24,6 @@ #define USE_STATIC_DATA -using namespace QtDataVisualization; - class GraphDataGenerator : public QObject { public: @@ -236,8 +208,8 @@ void GraphDataGenerator::changeSelectedButtonClicked() { // Change all selected cells to a random value 1-10 QVariant value = QVariant::fromValue(QRandomGenerator::global()->bounded(10.0) + 1); - QList<QTableWidgetItem *> selectedItems = m_tableWidget->selectedItems(); - foreach (QTableWidgetItem *item, selectedItems) { + const QList<QTableWidgetItem *> selectedItems = m_tableWidget->selectedItems(); + for (QTableWidgetItem *item : selectedItems) { QString oldData = item->data(Qt::DisplayRole).toString(); item->setData(Qt::DisplayRole, oldData.left(5) @@ -249,6 +221,7 @@ void GraphDataGenerator::changeSelectedButtonClicked() int main(int argc, char **argv) { + qputenv("QSG_RHI_BACKEND", "opengl"); QApplication app(argc, argv); Q3DBars *barGraph = new Q3DBars(); Q3DSurface *surfaceGraph = new Q3DSurface(); @@ -288,17 +261,17 @@ int main(int argc, char **argv) barProxy->setUseModelCategories(true); surfaceProxy->setUseModelCategories(true); barProxy->setRotationRole(tableWidget->model()->roleNames().value(Qt::DisplayRole)); - barProxy->setValueRolePattern(QRegExp(QStringLiteral("^(\\d*)(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$"))); - barProxy->setRotationRolePattern(QRegExp(QStringLiteral("^(\\d*)(\\/)\\d*\\/\\d*([\\.\\,]?)\\d*(\\/)(\\d*[\\.\\,]?\\d*)$"))); + barProxy->setValueRolePattern(QRegularExpression(QStringLiteral("^(\\d*)(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$"))); + barProxy->setRotationRolePattern(QRegularExpression(QStringLiteral("^(\\d*)(\\/)\\d*\\/\\d*([\\.\\,]?)\\d*(\\/)(\\d*[\\.\\,]?\\d*)$"))); barProxy->setValueRoleReplace(QStringLiteral("\\4")); barProxy->setRotationRoleReplace(QStringLiteral("\\5")); surfaceProxy->setXPosRole(tableWidget->model()->roleNames().value(Qt::DisplayRole)); - surfaceProxy->setZPosRole(tableWidget->model()->roleNames().value(Qt::DisplayRole)); - surfaceProxy->setXPosRolePattern(QRegExp(QStringLiteral("^(\\d*)\\/(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); + surfaceProxy->setYPosRole(tableWidget->model()->roleNames().value(Qt::DisplayRole)); + surfaceProxy->setXPosRolePattern(QRegularExpression(QStringLiteral("^(\\d*)\\/(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); surfaceProxy->setXPosRoleReplace(QStringLiteral("\\2")); - surfaceProxy->setYPosRolePattern(QRegExp(QStringLiteral("^\\d*(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$"))); + surfaceProxy->setYPosRolePattern(QRegularExpression(QStringLiteral("^\\d*(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$"))); surfaceProxy->setYPosRoleReplace(QStringLiteral("\\3")); - surfaceProxy->setZPosRolePattern(QRegExp(QStringLiteral("^(\\d*)(\\/)(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); + surfaceProxy->setZPosRolePattern(QRegularExpression(QStringLiteral("^(\\d*)(\\/)(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); surfaceProxy->setZPosRoleReplace(QStringLiteral("\\1")); QBar3DSeries *barSeries = new QBar3DSeries(barProxy); QSurface3DSeries *surfaceSeries = new QSurface3DSeries(surfaceProxy); diff --git a/tests/manual/minimalbars/CMakeLists.txt b/tests/manual/minimalbars/CMakeLists.txt new file mode 100644 index 00000000..50ae8a61 --- /dev/null +++ b/tests/manual/minimalbars/CMakeLists.txt @@ -0,0 +1,12 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_manual_test(MinimalBars + GUI + SOURCES + ../../../src/datavisualization/doc/snippets/doc_src_q3dbars_construction.cpp + ) +target_link_libraries(MinimalBars PUBLIC + Qt::Gui + Qt::DataVisualization + ) diff --git a/tests/manual/minimalscatter/CMakeLists.txt b/tests/manual/minimalscatter/CMakeLists.txt new file mode 100644 index 00000000..5f9c07ae --- /dev/null +++ b/tests/manual/minimalscatter/CMakeLists.txt @@ -0,0 +1,12 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_manual_test(MinimalScatter + GUI + SOURCES + ../../../src/datavisualization/doc/snippets/doc_src_q3dscatter_construction.cpp + ) +target_link_libraries(MinimalScatter PUBLIC + Qt::Gui + Qt::DataVisualization + ) diff --git a/tests/manual/minimalsurface/CMakeLists.txt b/tests/manual/minimalsurface/CMakeLists.txt new file mode 100644 index 00000000..39c3b04d --- /dev/null +++ b/tests/manual/minimalsurface/CMakeLists.txt @@ -0,0 +1,12 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_manual_test(MinimalSurface + GUI + SOURCES + ../../../src/datavisualization/doc/snippets/doc_src_q3dsurface_construction.cpp + ) +target_link_libraries(MinimalSurface PUBLIC + Qt::Gui + Qt::DataVisualization + ) diff --git a/tests/manual/multigraphs/CMakeLists.txt b/tests/manual/multigraphs/CMakeLists.txt new file mode 100644 index 00000000..8e6da82a --- /dev/null +++ b/tests/manual/multigraphs/CMakeLists.txt @@ -0,0 +1,27 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(multigraphs + GUI + SOURCES + data.cpp data.h + main.cpp + ) +target_link_libraries(multigraphs PUBLIC + Qt::Gui + Qt::Widgets + Qt::DataVisualization + ) + +set(multigraphs_resource_files + "australia.png" + ) + +qt_internal_add_resource(multigraphs "multigraphs" + PREFIX + "/" + FILES + ${multigraphs_resource_files} + ) diff --git a/tests/manual/multigraphs/data.cpp b/tests/manual/multigraphs/data.cpp index 8279e3e6..b46c6a0d 100644 --- a/tests/manual/multigraphs/data.cpp +++ b/tests/manual/multigraphs/data.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #define NOMINMAX @@ -40,8 +14,6 @@ #include <QSize> #include <QImage> -using namespace QtDataVisualization; - Data::Data(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars, QTextEdit *statusArea, QWidget *widget) : m_surface(surface), diff --git a/tests/manual/multigraphs/data.h b/tests/manual/multigraphs/data.h index 8f759f6a..a2c43452 100644 --- a/tests/manual/multigraphs/data.h +++ b/tests/manual/multigraphs/data.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef DATA_H #define DATA_H @@ -38,8 +12,6 @@ #include <QtDataVisualization/QHeightMapSurfaceDataProxy> #include <QTextEdit> -using namespace QtDataVisualization; - class Data : public QObject { Q_OBJECT diff --git a/tests/manual/multigraphs/main.cpp b/tests/manual/multigraphs/main.cpp index a4d4211f..b13dd2ce 100644 --- a/tests/manual/multigraphs/main.cpp +++ b/tests/manual/multigraphs/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "data.h" @@ -43,6 +17,7 @@ int main(int argc, char **argv) { + qputenv("QSG_RHI_BACKEND", "opengl"); QApplication app(argc, argv); QWidget *widget = new QWidget(); diff --git a/tests/manual/qmlbarsrowcolors/CMakeLists.txt b/tests/manual/qmlbarsrowcolors/CMakeLists.txt new file mode 100644 index 00000000..62a2ed98 --- /dev/null +++ b/tests/manual/qmlbarsrowcolors/CMakeLists.txt @@ -0,0 +1,31 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(qmlbarsrowcolors + GUI + SOURCES + main.cpp + ) + +target_link_libraries(qmlbarsrowcolors PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick + Qt::DataVisualization +) + +set(qmlbarsrowcolors_resource_files + "qml/qmlbarsrowcolors/Axes.qml" + "qml/qmlbarsrowcolors/Data.qml" + "qml/qmlbarsrowcolors/main.qml" +) + +qt6_add_resources(qmlbarsrowcolors "qmlbarsrowcolors" + PREFIX + "/" + FILES + ${qmlbarsrowcolors_resource_files} +) diff --git a/tests/manual/qmlbarsrowcolors/main.cpp b/tests/manual/qmlbarsrowcolors/main.cpp new file mode 100644 index 00000000..83a1a78a --- /dev/null +++ b/tests/manual/qmlbarsrowcolors/main.cpp @@ -0,0 +1,33 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QtGui/QGuiApplication> +#include <QtCore/QDir> +#include <QtQuick/QQuickView> +#include <QtQml/QQmlEngine> + +int main(int argc, char *argv[]) +{ + qputenv("QSG_RHI_BACKEND", "opengl"); + QGuiApplication app(argc, argv); + + QQuickView viewer; + + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + QString extraImportPath(QStringLiteral("%1/../../../../%2")); +#else + QString extraImportPath(QStringLiteral("%1/../../../%2")); +#endif + viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); + + viewer.setTitle(QStringLiteral("Monthly income/expenses")); + + viewer.setSource(QUrl("qrc:/qml/qmlbarsrowcolors/main.qml")); + viewer.setResizeMode(QQuickView::SizeRootObjectToView); + viewer.show(); + + return app.exec(); +} diff --git a/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Axes.qml b/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Axes.qml new file mode 100644 index 00000000..0e021c34 --- /dev/null +++ b/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Axes.qml @@ -0,0 +1,41 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtDataVisualization + +Item { + property alias column: columnAxis + property alias row: rowAxis + property alias value: valueAxis + property alias total: totalAxis + + // Custom labels for columns, since the data contains abbreviated month names. + //! [0] + CategoryAxis3D { + id: columnAxis + labels: ["January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December"] + labelAutoRotation: 30 + } + //! [0] + CategoryAxis3D { + id: totalAxis + labels: ["Yearly total"] + labelAutoRotation: 30 + } + CategoryAxis3D { + // For row labels we can use row labels from data proxy, no labels defined for rows. + id: rowAxis + labelAutoRotation: 30 + } + + ValueAxis3D { + id: valueAxis + min: 0 + max: 35 + labelFormat: "%.2f M\u20AC" + title: "Monthly income" + labelAutoRotation: 90 + } +} diff --git a/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Data.qml b/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Data.qml new file mode 100644 index 00000000..6eb27741 --- /dev/null +++ b/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Data.qml @@ -0,0 +1,118 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtQml.Models + +Item { + property alias model: dataModel + + property var modelAsJsArray: { + var arr = [] + for (var i = 0; i < dataModel.count; i++) { + var row = dataModel.get(i) + arr.push({ + timestamp: row.timestamp, + expenses: row.expenses, + income: row.income + }) + } + return arr + } + + //! [0] + ListModel { + id: dataModel + ListElement{ timestamp: "2006-01"; expenses: "-4"; income: "5" } + ListElement{ timestamp: "2006-02"; expenses: "-5"; income: "6" } + ListElement{ timestamp: "2006-03"; expenses: "-7"; income: "4" } + //! [0] + ListElement{ timestamp: "2006-04"; expenses: "-3"; income: "2" } + ListElement{ timestamp: "2006-05"; expenses: "-4"; income: "1" } + ListElement{ timestamp: "2006-06"; expenses: "-2"; income: "2" } + ListElement{ timestamp: "2006-07"; expenses: "-1"; income: "3" } + ListElement{ timestamp: "2006-08"; expenses: "-5"; income: "1" } + ListElement{ timestamp: "2006-09"; expenses: "-2"; income: "3" } + ListElement{ timestamp: "2006-10"; expenses: "-5"; income: "2" } + ListElement{ timestamp: "2006-11"; expenses: "-8"; income: "5" } + ListElement{ timestamp: "2006-12"; expenses: "-3"; income: "3" } + + ListElement{ timestamp: "2007-01"; expenses: "-3"; income: "1" } + ListElement{ timestamp: "2007-02"; expenses: "-4"; income: "2" } + ListElement{ timestamp: "2007-03"; expenses: "-12"; income: "4" } + ListElement{ timestamp: "2007-04"; expenses: "-13"; income: "6" } + ListElement{ timestamp: "2007-05"; expenses: "-14"; income: "11" } + ListElement{ timestamp: "2007-06"; expenses: "-7"; income: "7" } + ListElement{ timestamp: "2007-07"; expenses: "-6"; income: "4" } + ListElement{ timestamp: "2007-08"; expenses: "-4"; income: "15" } + ListElement{ timestamp: "2007-09"; expenses: "-2"; income: "18" } + ListElement{ timestamp: "2007-10"; expenses: "-29"; income: "25" } + ListElement{ timestamp: "2007-11"; expenses: "-23"; income: "29" } + ListElement{ timestamp: "2007-12"; expenses: "-5"; income: "9" } + + ListElement{ timestamp: "2008-01"; expenses: "-3"; income: "8" } + ListElement{ timestamp: "2008-02"; expenses: "-8"; income: "14" } + ListElement{ timestamp: "2008-03"; expenses: "-10"; income: "20" } + ListElement{ timestamp: "2008-04"; expenses: "-12"; income: "24" } + ListElement{ timestamp: "2008-05"; expenses: "-10"; income: "19" } + ListElement{ timestamp: "2008-06"; expenses: "-5"; income: "8" } + ListElement{ timestamp: "2008-07"; expenses: "-1"; income: "4" } + ListElement{ timestamp: "2008-08"; expenses: "-7"; income: "12" } + ListElement{ timestamp: "2008-09"; expenses: "-4"; income: "16" } + ListElement{ timestamp: "2008-10"; expenses: "-22"; income: "33" } + ListElement{ timestamp: "2008-11"; expenses: "-16"; income: "25" } + ListElement{ timestamp: "2008-12"; expenses: "-2"; income: "7" } + + ListElement{ timestamp: "2009-01"; expenses: "-4"; income: "5" } + ListElement{ timestamp: "2009-02"; expenses: "-4"; income: "7" } + ListElement{ timestamp: "2009-03"; expenses: "-11"; income: "14" } + ListElement{ timestamp: "2009-04"; expenses: "-16"; income: "22" } + ListElement{ timestamp: "2009-05"; expenses: "-3"; income: "5" } + ListElement{ timestamp: "2009-06"; expenses: "-4"; income: "8" } + ListElement{ timestamp: "2009-07"; expenses: "-7"; income: "9" } + ListElement{ timestamp: "2009-08"; expenses: "-9"; income: "13" } + ListElement{ timestamp: "2009-09"; expenses: "-1"; income: "6" } + ListElement{ timestamp: "2009-10"; expenses: "-14"; income: "25" } + ListElement{ timestamp: "2009-11"; expenses: "-19"; income: "29" } + ListElement{ timestamp: "2009-12"; expenses: "-5"; income: "7" } + + ListElement{ timestamp: "2010-01"; expenses: "-14"; income: "22" } + ListElement{ timestamp: "2010-02"; expenses: "-5"; income: "7" } + ListElement{ timestamp: "2010-03"; expenses: "-1"; income: "9" } + ListElement{ timestamp: "2010-04"; expenses: "-1"; income: "12" } + ListElement{ timestamp: "2010-05"; expenses: "-5"; income: "9" } + ListElement{ timestamp: "2010-06"; expenses: "-5"; income: "8" } + ListElement{ timestamp: "2010-07"; expenses: "-3"; income: "7" } + ListElement{ timestamp: "2010-08"; expenses: "-1"; income: "5" } + ListElement{ timestamp: "2010-09"; expenses: "-2"; income: "4" } + ListElement{ timestamp: "2010-10"; expenses: "-10"; income: "13" } + ListElement{ timestamp: "2010-11"; expenses: "-12"; income: "17" } + ListElement{ timestamp: "2010-12"; expenses: "-6"; income: "9" } + + ListElement{ timestamp: "2011-01"; expenses: "-2"; income: "6" } + ListElement{ timestamp: "2011-02"; expenses: "-4"; income: "8" } + ListElement{ timestamp: "2011-03"; expenses: "-7"; income: "12" } + ListElement{ timestamp: "2011-04"; expenses: "-9"; income: "15" } + ListElement{ timestamp: "2011-05"; expenses: "-7"; income: "19" } + ListElement{ timestamp: "2011-06"; expenses: "-9"; income: "18" } + ListElement{ timestamp: "2011-07"; expenses: "-13"; income: "17" } + ListElement{ timestamp: "2011-08"; expenses: "-5"; income: "9" } + ListElement{ timestamp: "2011-09"; expenses: "-3"; income: "8" } + ListElement{ timestamp: "2011-10"; expenses: "-13"; income: "15" } + ListElement{ timestamp: "2011-11"; expenses: "-8"; income: "17" } + ListElement{ timestamp: "2011-12"; expenses: "-7"; income: "10" } + + ListElement{ timestamp: "2012-01"; expenses: "-12"; income: "16" } + ListElement{ timestamp: "2012-02"; expenses: "-24"; income: "28" } + ListElement{ timestamp: "2012-03"; expenses: "-27"; income: "22" } + ListElement{ timestamp: "2012-04"; expenses: "-29"; income: "25" } + ListElement{ timestamp: "2012-05"; expenses: "-27"; income: "29" } + ListElement{ timestamp: "2012-06"; expenses: "-19"; income: "18" } + ListElement{ timestamp: "2012-07"; expenses: "-13"; income: "17" } + ListElement{ timestamp: "2012-08"; expenses: "-15"; income: "19" } + ListElement{ timestamp: "2012-09"; expenses: "-3"; income: "8" } + ListElement{ timestamp: "2012-10"; expenses: "-3"; income: "6" } + ListElement{ timestamp: "2012-11"; expenses: "-4"; income: "8" } + ListElement{ timestamp: "2012-12"; expenses: "-5"; income: "9" } + } +} diff --git a/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/main.qml b/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/main.qml new file mode 100644 index 00000000..2f15b453 --- /dev/null +++ b/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/main.qml @@ -0,0 +1,392 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtDataVisualization +import QtQuick.Window +import Qt.labs.qmlmodels +import "." + +Item { + id: mainview + + property int buttonLayoutHeight: 180; + property int currentRow + property Bar3DSeries selectedSeries + + function toggleRowColorsForBarSeries(enable) { + if (enable) + barSeries.rowColors = [color1, color2, color3] + else + barSeries.rowColors = [] + } + + function toggleRowColorsForSecondarySeries(enable) { + if (enable) + secondarySeries.rowColors = [color4, color5, color6] + else + secondarySeries.rowColors = [] + } + + function handleSelectionChange(series, position) { + if (position !== series.invalidSelectionPosition) + selectedSeries = series + + // Set tableView current row to selected bar + var rowRole = series.dataProxy.rowLabels[position.x]; + var colRole + if (barGraph.columnAxis === graphAxes.total) + colRole = "01"; + else + colRole = series.dataProxy.columnLabels[position.y]; + var checkTimestamp = rowRole + "-" + colRole + + if (currentRow === -1 || checkTimestamp !== graphData.model.get(currentRow).timestamp) { + var totalRows = tableView.rows; + for (var i = 0; i < totalRows; i++) { + var modelTimestamp = graphData.model.get(i).timestamp + if (modelTimestamp === checkTimestamp) { + currentRow = i + break + } + } + } + } + + width: 1280 + height: 1024 + + state: Screen.width < Screen.height ? "portrait" : "landscape" + selectedSeries: barSeries + + onCurrentRowChanged: { + var timestamp = graphData.model.get(currentRow).timestamp + var pattern = /(\d\d\d\d)-(\d\d)/ + var matches = pattern.exec(timestamp) + var rowIndex = modelProxy.rowCategoryIndex(matches[1]) + var colIndex + if (barGraph.columnAxis === graphAxes.total) + colIndex = 0 // Just one column when showing yearly totals + else + colIndex = modelProxy.columnCategoryIndex(matches[2]) + if (selectedSeries.visible) + mainview.selectedSeries.selectedBar = Qt.point(rowIndex, colIndex) + else if (barSeries.visible) + barSeries.selectedBar = Qt.point(rowIndex, colIndex) + else + secondarySeries.selectedBar = Qt.point(rowIndex, colIndex) + } + + Data { + id: graphData + } + + Axes { + id: graphAxes + } + + ThemeColor { + id: color1 + color: "green" + } + + ThemeColor { + id: color2 + color: "blue" + } + + ThemeColor { + id: color3 + color: "red" + } + + ThemeColor { + id: color4 + color: "yellow" + } + + ThemeColor { + id: color5 + color: "purple" + } + + ThemeColor { + id: color6 + color: "orange" + } + + Theme3D { + id: theme1 + type: Theme3D.ThemeRetro + labelBorderEnabled: true + font.pointSize: 35 + labelBackgroundEnabled: true + colorStyle: Theme3D.ColorStyleUniform + } + + Theme3D { + id: theme2 + type: Theme3D.ThemeArmyBlue + labelBorderEnabled: true + font.pointSize: 35 + labelBackgroundEnabled: true + colorStyle: Theme3D.ColorStyleUniform + } + + Item { + id: dataView + anchors.right: mainview.right; + anchors.bottom: mainview.bottom + + Bars3D { + id: barGraph + width: dataView.width + height: dataView.height + shadowQuality: AbstractGraph3D.ShadowQualityMedium + selectionMode: AbstractGraph3D.SelectionItem + theme: theme1 + barThickness: 0.7 + barSpacing: Qt.size(0.5, 0.5) + barSpacingRelative: false + scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeftHigh + columnAxis: graphAxes.column + rowAxis: graphAxes.row + valueAxis: graphAxes.value + + Bar3DSeries { + id: secondarySeries + visible: false + itemLabelFormat: "Expenses, @colLabel, @rowLabel: -@valueLabel" + rowColors: [color4 , color5, color6] + + onSelectedBarChanged: (position)=> handleSelectionChange(secondarySeries, position) + + ItemModelBarDataProxy { + id: secondaryProxy + itemModel: graphData.model + rowRole: "timestamp" + columnRole: "timestamp" + valueRole: "expenses" + rowRolePattern: /^(\d\d\d\d).*$/ + columnRolePattern: /^.*-(\d\d)$/ + valueRolePattern: /-/ + rowRoleReplace: "\\1" + columnRoleReplace: "\\1" + multiMatchBehavior: ItemModelBarDataProxy.MMBCumulative + } + } + + Bar3DSeries { + id: barSeries + itemLabelFormat: "Income, @colLabel, @rowLabel: @valueLabel" + rowColors: [color1, color2, color3] + + onSelectedBarChanged: (position)=> handleSelectionChange(barSeries, position) + + ItemModelBarDataProxy { + id: modelProxy + itemModel: graphData.model + rowRole: "timestamp" + columnRole: "timestamp" + valueRole: "income" + rowRolePattern: /^(\d\d\d\d).*$/ + columnRolePattern: /^.*-(\d\d)$/ + rowRoleReplace: "\\1" + columnRoleReplace: "\\1" + multiMatchBehavior: ItemModelBarDataProxy.MMBCumulative + } + } + } + } + + ColumnLayout { + id: tableViewLayout + + anchors.top: parent.top + anchors.left: parent.left + + HorizontalHeaderView { + id: header + property var columnNames: ["Month", "Expenses", "Income"] + + syncView: tableView + Layout.fillWidth: true + delegate: Text { + padding: 3 + text: header.columnNames[index] + } + + } + + TableView { + id: tableView + Layout.fillWidth: true + Layout.fillHeight: true + + reuseItems: false + clip: true + + model: TableModel { + id: tableModel + TableModelColumn { display: "timestamp" } + TableModelColumn { display: "expenses" } + TableModelColumn { display: "income" } + + rows: graphData.modelAsJsArray + } + + delegate: Rectangle { + implicitHeight: 30 + implicitWidth: tableView.width / 3 + color: row === currentRow ? "#e0e0e0" : "#ffffff" + MouseArea { + anchors.fill: parent + onClicked: currentRow = row + } + + Text { + id: delegateText + anchors.verticalCenter: parent.verticalCenter + width: parent.width + anchors.leftMargin: 4 + anchors.left: parent.left + anchors.right: parent.right + text: formattedText + property string formattedText: { + if (column === 0) { + if (display !== "") { + var pattern = /(\d\d\d\d)-(\d\d)/ + var matches = pattern.exec(display) + var colIndex = parseInt(matches[2], 10) - 1 + return matches[1] + " - " + graphAxes.column.labels[colIndex] + } + } else { + return display + } + } + } + } + } + } + + ColumnLayout { + id: controlLayout + spacing: 0 + + Button { + id: seriesToggle + Layout.fillWidth: true + Layout.fillHeight: true + text: "Show Expenses" + clip: true + + onClicked: { + if (text === "Show Expenses") { + barSeries.visible = false + secondarySeries.visible = true + barGraph.valueAxis.labelFormat = "-%.2f M\u20AC" + secondarySeries.itemLabelFormat = "Expenses, @colLabel, @rowLabel: @valueLabel" + text = "Show Both" + } else if (text === "Show Both") { + barSeries.visible = true + barGraph.valueAxis.labelFormat = "%.2f M\u20AC" + secondarySeries.itemLabelFormat = "Expenses, @colLabel, @rowLabel: -@valueLabel" + text = "Show Income" + } else { // text === "Show Income" + secondarySeries.visible = false + text = "Show Expenses" + } + } + } + + Button { + id: themeToggle + Layout.fillWidth: true + Layout.fillHeight: true + text: "Use theme 2" + clip: true + + onClicked: { + if (text === "Use theme 2") { + barGraph.theme = theme2 + text = "Use theme 1" + } else { + barGraph.theme = theme1 + text = "Use theme 2" + } + } + } + + Button { + id: barSeriesRowColorToggle + Layout.fillWidth: true + Layout.fillHeight: true + text: "Disable row colors" + + onClicked: { + if (text === "Disable row colors") { + toggleRowColorsForBarSeries(false) + toggleRowColorsForSecondarySeries(false) + text = "Enable row colors" + } else { + toggleRowColorsForBarSeries(true) + toggleRowColorsForSecondarySeries(true) + text = "Disable row colors" + } + } + } + } + + states: [ + State { + name: "landscape" + PropertyChanges { + target: dataView + width: mainview.width / 4 * 3 + height: mainview.height + } + PropertyChanges { + target: tableViewLayout + height: mainview.height - buttonLayoutHeight + anchors.right: dataView.left + anchors.left: mainview.left + anchors.bottom: undefined + } + PropertyChanges { + target: controlLayout + width: mainview.width / 4 + height: buttonLayoutHeight + anchors.top: tableViewLayout.bottom + anchors.bottom: mainview.bottom + anchors.left: mainview.left + anchors.right: dataView.left + } + }, + State { + name: "portrait" + PropertyChanges { + target: dataView + width: mainview.height / 4 * 3 + height: mainview.width + } + PropertyChanges { + target: tableViewLayout + height: mainview.width + anchors.right: controlLayout.left + anchors.left: mainview.left + anchors.bottom: dataView.top + } + PropertyChanges { + target: controlLayout + width: mainview.height / 4 + height: mainview.width / 4 + anchors.top: mainview.top + anchors.bottom: dataView.top + anchors.left: undefined + anchors.right: mainview.right + } + } + ] +} diff --git a/tests/manual/qmldynamicdata/CMakeLists.txt b/tests/manual/qmldynamicdata/CMakeLists.txt new file mode 100644 index 00000000..739ecd15 --- /dev/null +++ b/tests/manual/qmldynamicdata/CMakeLists.txt @@ -0,0 +1,25 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_manual_test(qmldynamicdata + GUI + SOURCES + main.cpp + ) +target_link_libraries(qmldynamicdata PUBLIC + Qt::Gui + Qt::Qml + Qt::Quick + Qt::DataVisualization + ) + +set(qmldynamicdata_resource_files + "qml/qmldynamicdata/main.qml" + ) + +qt_internal_add_resource(qmldynamicdata "qmldynamicdata" + PREFIX + "/" + FILES + ${qmldynamicdata_resource_files} + ) diff --git a/tests/manual/qmldynamicdata/main.cpp b/tests/manual/qmldynamicdata/main.cpp index 3a69ca8f..6a416829 100644 --- a/tests/manual/qmldynamicdata/main.cpp +++ b/tests/manual/qmldynamicdata/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtGui/QGuiApplication> #include <QtCore/QDir> @@ -34,6 +8,7 @@ int main(int argc, char *argv[]) { + qputenv("QSG_RHI_BACKEND", "opengl"); QGuiApplication app(argc, argv); QQuickView viewer; diff --git a/tests/manual/qmldynamicdata/qml/qmldynamicdata/NewButton.qml b/tests/manual/qmldynamicdata/qml/qmldynamicdata/NewButton.qml deleted file mode 100644 index 54cdce24..00000000 --- a/tests/manual/qmldynamicdata/qml/qmldynamicdata/NewButton.qml +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Controls 1.0 - -Item { - id: newbutton - - property alias text: buttonText.text - - signal clicked - - height: 80 - - Button { - width: parent.width - height: parent.height - Text { - id: buttonText - wrapMode: Text.WordWrap - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - anchors.fill: parent - } - onClicked: newbutton.clicked() - } -} diff --git a/tests/manual/qmldynamicdata/qml/qmldynamicdata/main.qml b/tests/manual/qmldynamicdata/qml/qmldynamicdata/main.qml index a49a1184..1d0e65bf 100644 --- a/tests/manual/qmldynamicdata/qml/qmldynamicdata/main.qml +++ b/tests/manual/qmldynamicdata/qml/qmldynamicdata/main.qml @@ -1,37 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -import QtQuick 2.1 -import QtDataVisualization 1.0 +import QtQuick +import QtDataVisualization 1.2 +import QtQuick.Controls import "." -Rectangle { +Item { id: mainView width: 1280 height: 720 @@ -154,15 +129,15 @@ Rectangle { anchors.fill: parent hoverEnabled: true acceptedButtons: Qt.LeftButton | Qt.RightButton - property int mouseX: -1 - property int mouseY: -1 + property int mouseXPos: -1 + property int mouseYPos: -1 - onPositionChanged: { - mouseX = mouse.x; - mouseY = mouse.y; + onPositionChanged: (mouse)=> { + mouseXPos = mouse.x; + mouseYPos = mouse.y; } - onWheel: { + onWheel: (wheel)=> { // Adjust zoom level based on what zoom range we're in. var zoomLevel = scatterGraph.scene.activeCamera.zoomLevel; if (zoomLevel > 100) @@ -186,7 +161,8 @@ Rectangle { running: true repeat: true onTriggered: { - scatterGraph.scene.selectionQueryPosition = Qt.point(inputArea.mouseX, inputArea.mouseY); + scatterGraph.scene.selectionQueryPosition = Qt.point(inputArea.mouseXPos, + inputArea.mouseYPos); } } } @@ -227,7 +203,7 @@ Rectangle { } } - NewButton { + Button { id: shadowToggle width: parent.width / 3 // We're adding 3 buttons and want to divide them equally text: "Hide Shadows" @@ -244,7 +220,7 @@ Rectangle { } } - NewButton { + Button { id: cameraToggle width: parent.width / 3 text: "Pause Camera" @@ -261,11 +237,11 @@ Rectangle { } } - NewButton { + Button { id: exitButton width: parent.width / 3 text: "Quit" anchors.left: cameraToggle.right - onClicked: Qt.quit(0); + onClicked: Qt.quit(); } } diff --git a/tests/manual/qmldynamicdata/qmldynamicdata.qrc b/tests/manual/qmldynamicdata/qmldynamicdata.qrc index 76641cf9..e1997ffc 100644 --- a/tests/manual/qmldynamicdata/qmldynamicdata.qrc +++ b/tests/manual/qmldynamicdata/qmldynamicdata.qrc @@ -1,6 +1,5 @@ <RCC> <qresource prefix="/"> <file>qml/qmldynamicdata/main.qml</file> - <file>qml/qmldynamicdata/NewButton.qml</file> </qresource> </RCC> diff --git a/tests/manual/qmlgradient/CMakeLists.txt b/tests/manual/qmlgradient/CMakeLists.txt new file mode 100644 index 00000000..8288e1b2 --- /dev/null +++ b/tests/manual/qmlgradient/CMakeLists.txt @@ -0,0 +1,30 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_manual_test(qmlgradient + GUI + SOURCES + main.cpp + ) +target_link_libraries(qmlgradient PUBLIC + Qt::Gui + Qt::Qml + Qt::Quick + Qt::DataVisualization + ) + +set(qmlgradient_resource_files + "qml/qmlgradient/main.qml" + "crater.png" + ) + +set_source_files_properties("crater.png" + PROPERTIES QT_RESOURCE_ALIAS "map" + ) + +qt_internal_add_resource(qmlgradient "qmlgradient" + PREFIX + "/" + FILES + ${qmlgradient_resource_files} + ) diff --git a/tests/manual/qmlgradient/crater.png b/tests/manual/qmlgradient/crater.png Binary files differnew file mode 100644 index 00000000..91bba197 --- /dev/null +++ b/tests/manual/qmlgradient/crater.png diff --git a/tests/manual/qmlgradient/main.cpp b/tests/manual/qmlgradient/main.cpp new file mode 100644 index 00000000..b3a65f0f --- /dev/null +++ b/tests/manual/qmlgradient/main.cpp @@ -0,0 +1,37 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QtGui/QGuiApplication> +#include <QtCore/QDir> +#include <QtQuick/QQuickView> +#include <QtQml/QQmlEngine> + +int main(int argc, char *argv[]) +{ + qputenv("QSG_RHI_BACKEND", "opengl"); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif + + QGuiApplication app(argc, argv); + + QQuickView viewer; + + const QUrl url(QStringLiteral("qrc:/qml/qmlgradient/main.qml")); + + // 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.setSource(url); + viewer.show(); + viewer.setResizeMode(QQuickView::SizeRootObjectToView); + return app.exec(); +} diff --git a/tests/manual/qmlgradient/qml.qrc b/tests/manual/qmlgradient/qml.qrc new file mode 100644 index 00000000..cd67689c --- /dev/null +++ b/tests/manual/qmlgradient/qml.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>qml/qmlgradient/main.qml</file> + </qresource> +</RCC> diff --git a/tests/manual/qmlgradient/qml/qmlgradient/main.qml b/tests/manual/qmlgradient/qml/qmlgradient/main.qml new file mode 100644 index 00000000..650dd087 --- /dev/null +++ b/tests/manual/qmlgradient/qml/qmlgradient/main.qml @@ -0,0 +1,191 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtQuick.Window +import QtQuick.Layouts +import QtQuick.Controls +import QtDataVisualization 1.2 +import "." + +Item { + id: mainwindow + + function updateinfoLabels() + { + if (surfaceGraph.theme.baseGradients[0] === mainGradient) + gradientLabel.text = "Main gradient"; + else if (surfaceGraph.theme.baseGradients[0] === secondaryGradient) + gradientLabel.text = "Secondary gradient"; + } + + width: 1024 + height: 768 + visible: true + + Item { + id: surfaceview + width: mainwindow.width + height: mainwindow.height + + anchors.top: mainwindow.top + anchors.left: mainwindow.left + + ColorGradient { + id: mainGradient + ColorGradientStop { position: 0.0; color: "red"} + ColorGradientStop { position: 0.5; color: "green"} + ColorGradientStop { position: 0.8; color: "blue"} + ColorGradientStop { position: 0.6; color: "yellow"} + ColorGradientStop { position: 0.8; color: "black"} + ColorGradientStop { position: 1.0; color: "peru"} + } + + ColorGradient { + id: secondaryGradient + ColorGradientStop { position: 0.0; color: "crimson"} + ColorGradientStop { position: 0.5; color: "chartreuse"} + ColorGradientStop { position: 0.8; color: "blueviolet"} + ColorGradientStop { position: 0.6; color: "gold"} + ColorGradientStop { position: 0.8; color: "darkslategrey"} + ColorGradientStop { position: 1.0; color: "seagreen"} + } + + ColorGradient { + id: seriesGradient + ColorGradientStop { position: 0.0; color: "gold" } + ColorGradientStop { position: 0.5; color: "crimson" } + ColorGradientStop { position: 1.0; color: "blueviolet" } + } + + Theme3D { + id: mainTheme + type: Q3DTheme.ThemeStoneMoss + + colorStyle: Q3DTheme.ColorStyleRangeGradient + baseGradients: [mainGradient] + } + + Theme3D { + id: secondaryTheme + type: Q3DTheme.ThemeArmyBlue + baseGradients: [secondaryGradient] + } + + Surface3D { + id: surfaceGraph + width: surfaceview.width + height: surfaceview.height + theme: mainTheme + + shadowQuality: AbstractGraph3D.ShadowQualityMedium + selectionMode: AbstractGraph3D.SelectionSlice | AbstractGraph3D.SelectionItemAndRow + scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeft + axisY.min: 0.0 + axisY.max: 500.0 + axisX.segmentCount: 10 + axisX.subSegmentCount: 2 + axisX.labelFormat: "%i" + axisZ.segmentCount: 10 + axisZ.subSegmentCount: 2 + axisZ.labelFormat: "%i" + axisY.segmentCount: 5 + axisY.subSegmentCount: 2 + axisY.labelFormat: "%i" + axisY.title: "Height" + axisX.title: "Latitude" + axisZ.title: "Longitude" + + Surface3DSeries { + id: heightSeries + drawMode: Surface3DSeries.DrawSurface + visible: true + flatShadingEnabled: false + + HeightMapSurfaceDataProxy { + heightMapFile: ":/map" + } + } + } + + RowLayout { + id: buttonLayout + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + + Button { + id: toggleTheme + Layout.fillWidth: true + Layout.fillHeight: true + + text: qsTr("Toggle theme") + onClicked: { + if (surfaceGraph.theme == mainTheme) { + surfaceGraph.theme = secondaryTheme; + themeLabel.text = "Secondary theme"; + updateinfoLabels(); + } else if (surfaceGraph.theme == secondaryTheme) { + surfaceGraph.theme = mainTheme; + updateinfoLabels(); + themeLabel.text = "Main theme"; + } + } + } + + Button { + id: toggleGradient + Layout.fillWidth: true + Layout.fillHeight: true + + text: qsTr("Toggle theme gradient") + onClicked: { + if (surfaceGraph.theme.baseGradients[0] === mainGradient) { + surfaceGraph.theme.baseGradients[0] = secondaryGradient; + updateinfoLabels(); + } else if (surfaceGraph.theme.baseGradients[0] === secondaryGradient) { + surfaceGraph.theme.baseGradients[0] = mainGradient; + updateinfoLabels(); + } + } + } + + Button { + id: toggleSeriesGradient + Layout.fillWidth: true + Layout.fillHeight: true + + text: qsTr("Override theme gradient with series gradient") + + onClicked: { + heightSeries.baseGradient = seriesGradient; + gradientLabel.text = "Series gradient"; + } + } + } + + ColumnLayout { + id: infoLayout + anchors.top: buttonLayout.bottom + anchors.left: parent.left + + Rectangle { + Layout.minimumHeight: 20 + + Label { + id: themeLabel + text: qsTr("Main theme") + } + } + + Rectangle { + Layout.minimumHeight: 20 + + Label { + id: gradientLabel + text: qsTr("Main gradient") + } + } + } + } +} diff --git a/tests/manual/qmlheightmap/CMakeLists.txt b/tests/manual/qmlheightmap/CMakeLists.txt new file mode 100644 index 00000000..17e7f3f2 --- /dev/null +++ b/tests/manual/qmlheightmap/CMakeLists.txt @@ -0,0 +1,43 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(qmlheightmap + GUI + SOURCES + main.cpp + ) +target_link_libraries(qmlheightmap PUBLIC + Qt::Gui + Qt::Qml + Qt::Quick + Qt::DataVisualization + ) + +set_source_files_properties("gradientGRAY8.png" + PROPERTIES QT_RESOURCE_ALIAS "mapGRAY8" + ) +set_source_files_properties("gradientGRAY16.png" + PROPERTIES QT_RESOURCE_ALIAS "mapGRAY16" + ) +set_source_files_properties("gradientRGB8.png" + PROPERTIES QT_RESOURCE_ALIAS "mapRGB8" + ) +set_source_files_properties("gradientRGB16.png" + PROPERTIES QT_RESOURCE_ALIAS "mapRGB16" + ) + +set(qmlheightmap_resource_files + "qml/qmlheightmap/main.qml" + "gradientGRAY8.png" + "gradientGRAY16.png" + "gradientRGB8.png" + "gradientRGB16.png" + ) +qt_internal_add_resource(qmlheightmap "qmlheightmap" + PREFIX + "/" + FILES + ${qmlheightmap_resource_files} + ) diff --git a/tests/manual/qmlheightmap/gradientGRAY16.png b/tests/manual/qmlheightmap/gradientGRAY16.png Binary files differnew file mode 100644 index 00000000..28df3673 --- /dev/null +++ b/tests/manual/qmlheightmap/gradientGRAY16.png diff --git a/tests/manual/qmlheightmap/gradientGRAY8.png b/tests/manual/qmlheightmap/gradientGRAY8.png Binary files differnew file mode 100644 index 00000000..6696e57c --- /dev/null +++ b/tests/manual/qmlheightmap/gradientGRAY8.png diff --git a/tests/manual/qmlheightmap/gradientRGB16.png b/tests/manual/qmlheightmap/gradientRGB16.png Binary files differnew file mode 100644 index 00000000..b62e510b --- /dev/null +++ b/tests/manual/qmlheightmap/gradientRGB16.png diff --git a/tests/manual/qmlheightmap/gradientRGB8.png b/tests/manual/qmlheightmap/gradientRGB8.png Binary files differnew file mode 100644 index 00000000..79879f35 --- /dev/null +++ b/tests/manual/qmlheightmap/gradientRGB8.png diff --git a/tests/manual/qmlheightmap/main.cpp b/tests/manual/qmlheightmap/main.cpp new file mode 100644 index 00000000..371b78a8 --- /dev/null +++ b/tests/manual/qmlheightmap/main.cpp @@ -0,0 +1,37 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include <QtGui/QGuiApplication> +#include <QtCore/QDir> +#include <QtQuick/QQuickView> +#include <QtQml/QQmlEngine> + +int main(int argc, char *argv[]) +{ + qputenv("QSG_RHI_BACKEND", "opengl"); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif + + QGuiApplication app(argc, argv); + + QQuickView viewer; + + const QUrl url(QStringLiteral("qrc:/qml/qmlheightmap/main.qml")); + + // 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.setSource(url); + viewer.show(); + viewer.setResizeMode(QQuickView::SizeRootObjectToView); + return app.exec(); +} diff --git a/tests/manual/qmlheightmap/qml.qrc b/tests/manual/qmlheightmap/qml.qrc new file mode 100644 index 00000000..b1cbc545 --- /dev/null +++ b/tests/manual/qmlheightmap/qml.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>qml/qmlheightmap/qml/main.qml</file> + </qresource> +</RCC> diff --git a/tests/manual/qmlheightmap/qml/qmlheightmap/main.qml b/tests/manual/qmlheightmap/qml/qmlheightmap/main.qml new file mode 100644 index 00000000..53003b59 --- /dev/null +++ b/tests/manual/qmlheightmap/qml/qmlheightmap/main.qml @@ -0,0 +1,181 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtQuick.Window +import QtQuick.Layouts +import QtQuick.Controls +import QtDataVisualization +import "." + +Item { + id: mainwindow + + width: 1024 + height: 768 + visible: true + + Item { + id: surfaceview + width: mainwindow.width + height: mainwindow.height + + anchors.top: mainwindow.top + anchors.left: mainwindow.left + + ColorGradient { + id: surfaceGradient + ColorGradientStop { position: 0.0; color: "darkslategray" } + ColorGradientStop { id: middleGradient; position: 0.50; color: "peru" } + ColorGradientStop { position: 1.0; color: "red" } + } + + Theme3D { + id: mainTheme + type: Q3DTheme.ThemeStoneMoss + colorStyle: Q3DTheme.ColorStyleRangeGradient + baseGradients: [surfaceGradient] + } + + Surface3D { + id: surfaceGraph + width: surfaceview.width + height: surfaceview.height + theme: mainTheme + shadowQuality: AbstractGraph3D.ShadowQualityMedium + selectionMode: AbstractGraph3D.SelectionSlice | AbstractGraph3D.SelectionItemAndRow + scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeft + axisY.min: 0.0 + axisY.max: 500.0 + axisX.segmentCount: 10 + axisX.subSegmentCount: 2 + axisX.labelFormat: "%i" + axisZ.segmentCount: 10 + axisZ.subSegmentCount: 2 + axisZ.labelFormat: "%i" + axisY.segmentCount: 5 + axisY.subSegmentCount: 2 + axisY.labelFormat: "%i" + axisY.title: "Y" + axisX.title: "X" + axisZ.title: "Z" + + Surface3DSeries { + id: heightSeriesRGB8 + drawMode: Surface3DSeries.DrawSurface + visible: true + flatShadingEnabled: false + + HeightMapSurfaceDataProxy { + heightMapFile: ":/mapRGB8" + minYValue: surfaceGraph.axisY.min + maxYValue: surfaceGraph.axisY.max + } + } + + Surface3DSeries { + id: heightSeriesRGB16 + drawMode: Surface3DSeries.DrawSurface + visible: false + flatShadingEnabled: false + + HeightMapSurfaceDataProxy { + heightMapFile: ":/mapRGB16" + minYValue: surfaceGraph.axisY.min + maxYValue: surfaceGraph.axisY.max + } + } + + Surface3DSeries { + id: heightSeriesGRAY8 + drawMode: Surface3DSeries.DrawSurface + visible: false + flatShadingEnabled: false + + HeightMapSurfaceDataProxy { + heightMapFile: ":/mapGRAY8" + minYValue: surfaceGraph.axisY.min + maxYValue: surfaceGraph.axisY.max + } + } + + Surface3DSeries { + id: heightSeriesGRAY16 + drawMode: Surface3DSeries.DrawSurface + visible: false + flatShadingEnabled: false + + HeightMapSurfaceDataProxy { + heightMapFile: ":/mapGRAY16" + minYValue: surfaceGraph.axisY.min + maxYValue: surfaceGraph.axisY.max + } + } + } + + RowLayout { + id: buttonLayout + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + + Button { + id: toggleHeightSeries + Layout.fillWidth: true + Layout.fillHeight: true + + text: qsTr("Use 16-bit rgb map") + onClicked: { + if (heightSeriesRGB8.visible === true) { + heightSeriesRGB8.visible = false + heightSeriesRGB16.visible = true + heightSeriesGRAY8.visible = false + heightSeriesGRAY16.visible = false + text = "Use 8-bit grayscale map" + } else if (heightSeriesRGB16.visible === true){ + heightSeriesRGB8.visible = false + heightSeriesRGB16.visible = false + heightSeriesGRAY8.visible = true + heightSeriesGRAY16.visible = false + text = "Use 16-bit grayscale map" + } else if (heightSeriesGRAY8.visible === true){ + heightSeriesRGB8.visible = false + heightSeriesRGB16.visible = false + heightSeriesGRAY8.visible = false + heightSeriesGRAY16.visible = true + text = "Use 8-bit rgb map" + } else if (heightSeriesGRAY16.visible === true){ + heightSeriesRGB8.visible = true + heightSeriesRGB16.visible = false + heightSeriesGRAY8.visible = false + heightSeriesGRAY16.visible = false + text = "Use 16-bit rgb map" + } + } + } + + Button { + id: toggleAutoScaleY + Layout.fillWidth: true + Layout.fillHeight: true + + text: qsTr("Enable autoScaleY") + onClicked: { + if (text === "Enable autoScaleY") { + heightSeriesRGB8.dataProxy.autoScaleY = true + heightSeriesRGB16.dataProxy.autoScaleY = true + heightSeriesGRAY8.dataProxy.autoScaleY = true + heightSeriesGRAY16.dataProxy.autoScaleY = true + text = "Disable autoScaleY" + } else { + heightSeriesRGB8.dataProxy.autoScaleY = false + heightSeriesRGB16.dataProxy.autoScaleY = false + heightSeriesGRAY8.dataProxy.autoScaleY = false + heightSeriesGRAY16.dataProxy.autoScaleY = false + text = "Enable autoScaleY" + } + } + } + } + } +} diff --git a/tests/manual/qmlmultitest/CMakeLists.txt b/tests/manual/qmlmultitest/CMakeLists.txt new file mode 100644 index 00000000..a92ff8db --- /dev/null +++ b/tests/manual/qmlmultitest/CMakeLists.txt @@ -0,0 +1,26 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_internal_add_manual_test(qmlmultitest + GUI + SOURCES + main.cpp + ) +target_link_libraries(qmlmultitest PUBLIC + Qt::Gui + Qt::Qml + Qt::Quick + Qt::DataVisualization + ) + +set(qmlmultitest_resource_files + "qml/qmlmultitest/Data.qml" + "qml/qmlmultitest/main.qml" + ) + +qt_internal_add_resource(qmlmultitest "qmlmultitest" + PREFIX + "/" + FILES + ${qmlmultitest_resource_files} + ) diff --git a/tests/manual/qmlmultitest/main.cpp b/tests/manual/qmlmultitest/main.cpp index e6010697..555dff63 100644 --- a/tests/manual/qmlmultitest/main.cpp +++ b/tests/manual/qmlmultitest/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtGui/QGuiApplication> #include <QtCore/QDir> @@ -34,6 +8,7 @@ int main(int argc, char *argv[]) { + qputenv("QSG_RHI_BACKEND", "opengl"); QGuiApplication app(argc, argv); QQuickView viewer; diff --git a/tests/manual/qmlmultitest/qml/qmlmultitest/Data.qml b/tests/manual/qmlmultitest/qml/qmlmultitest/Data.qml index 9bbbd7f8..78e65575 100644 --- a/tests/manual/qmlmultitest/qml/qmlmultitest/Data.qml +++ b/tests/manual/qmlmultitest/qml/qmlmultitest/Data.qml @@ -1,33 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -import QtQuick 2.1 +import QtQuick Item { property alias sharedData: dataModel diff --git a/tests/manual/qmlmultitest/qml/qmlmultitest/NewButton.qml b/tests/manual/qmlmultitest/qml/qmlmultitest/NewButton.qml deleted file mode 100644 index 19309cca..00000000 --- a/tests/manual/qmlmultitest/qml/qmlmultitest/NewButton.qml +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Controls 1.0 -import QtQuick.Controls.Styles 1.0 - -Item { - id: newbutton - - property alias text: buttonText.text - - signal clicked - - implicitWidth: buttonText.implicitWidth + 5 - implicitHeight: buttonText.implicitHeight + 10 - - Button { - id: buttonText - width: parent.width - height: parent.height - - style: ButtonStyle { - label: Component { - Text { - text: buttonText.text - clip: true - wrapMode: Text.WordWrap - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - anchors.fill: parent - } - } - } - onClicked: newbutton.clicked() - } -} diff --git a/tests/manual/qmlmultitest/qml/qmlmultitest/main.qml b/tests/manual/qmlmultitest/qml/qmlmultitest/main.qml index 388cf391..493feb79 100644 --- a/tests/manual/qmlmultitest/qml/qmlmultitest/main.qml +++ b/tests/manual/qmlmultitest/qml/qmlmultitest/main.qml @@ -1,38 +1,13 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -import QtQuick 2.1 -import QtQuick.Layouts 1.0 -import QtDataVisualization 1.1 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import QtDataVisualization 1.2 import "." -Rectangle { +Item { id: mainView width: 800 height: 600 @@ -56,6 +31,7 @@ Rectangle { Layout.fillWidth: true border.color: surfaceGraph.theme.gridLineColor border.width: 2 + color: "#00000000" Surface3D { id: surfaceGraph @@ -106,7 +82,7 @@ Rectangle { anchors.bottom: parent.bottom columns: 2 - NewButton { + Button { Layout.minimumWidth: parent.width / 2 Layout.fillHeight: true Layout.fillWidth: true @@ -114,22 +90,22 @@ Rectangle { onClicked: clearSelections() // call a helper function to keep button itself simpler } - NewButton { + Button { Layout.minimumWidth: parent.width / 2 Layout.fillHeight: true Layout.fillWidth: true text: "Quit" - onClicked: Qt.quit(0); + onClicked: Qt.quit(); } - NewButton { + Button { Layout.fillHeight: true Layout.fillWidth: true text: "Reset Cameras" onClicked: resetCameras() // call a helper function to keep button itself simpler } - NewButton { + Button { id: mmbButton Layout.fillHeight: true Layout.fillWidth: true @@ -144,6 +120,7 @@ Rectangle { Layout.fillWidth: true border.color: scatterGraph.theme.gridLineColor border.width: 2 + color: "#00000000" Scatter3D { id: scatterGraph @@ -184,6 +161,7 @@ Rectangle { Layout.fillWidth: true border.color: barGraph.theme.gridLineColor border.width: 2 + color: "#00000000" Bars3D { id: barGraph diff --git a/tests/manual/qmlmultitest/qmlmultitest.qrc b/tests/manual/qmlmultitest/qmlmultitest.qrc index 7fc9ade2..ae52b7e7 100644 --- a/tests/manual/qmlmultitest/qmlmultitest.qrc +++ b/tests/manual/qmlmultitest/qmlmultitest.qrc @@ -2,6 +2,5 @@ <qresource prefix="/"> <file>qml/qmlmultitest/Data.qml</file> <file>qml/qmlmultitest/main.qml</file> - <file>qml/qmlmultitest/NewButton.qml</file> </qresource> </RCC> diff --git a/tests/manual/qmlperf/CMakeLists.txt b/tests/manual/qmlperf/CMakeLists.txt new file mode 100644 index 00000000..31235e32 --- /dev/null +++ b/tests/manual/qmlperf/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(qmlperf + GUI + SOURCES + datagenerator.cpp datagenerator.h + main.cpp + ) +target_link_libraries(qmlperf PUBLIC + Qt::Gui + Qt::Qml + Qt::Quick + Qt::DataVisualization + ) + +set(qmlperf_resource_files + "qml/qmlperf/main.qml" + ) + +qt_internal_add_resource(qmlperf "qmlperf" + PREFIX + "/" + FILES + ${qmlperf_resource_files} + ) diff --git a/tests/manual/qmlperf/datagenerator.cpp b/tests/manual/qmlperf/datagenerator.cpp index 0d8cf9b2..df00d483 100644 --- a/tests/manual/qmlperf/datagenerator.cpp +++ b/tests/manual/qmlperf/datagenerator.cpp @@ -1,38 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "datagenerator.h" #include <QDebug> #include <QRandomGenerator> -using namespace QtDataVisualization; - Q_DECLARE_METATYPE(QScatter3DSeries *) DataGenerator::DataGenerator(QObject *parent) : diff --git a/tests/manual/qmlperf/datagenerator.h b/tests/manual/qmlperf/datagenerator.h index affcebbb..99a9dbf7 100644 --- a/tests/manual/qmlperf/datagenerator.h +++ b/tests/manual/qmlperf/datagenerator.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef DATAGENERATOR_H #define DATAGENERATOR_H @@ -33,8 +7,6 @@ #include <QtDataVisualization/QScatter3DSeries> #include <QtCore/QFile> -using namespace QtDataVisualization; - class DataGenerator : public QObject { Q_OBJECT diff --git a/tests/manual/qmlperf/main.cpp b/tests/manual/qmlperf/main.cpp index 27a9fb3a..2566fc7d 100644 --- a/tests/manual/qmlperf/main.cpp +++ b/tests/manual/qmlperf/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "datagenerator.h" @@ -37,6 +11,7 @@ int main(int argc, char *argv[]) { + qputenv("QSG_RHI_BACKEND", "opengl"); QGuiApplication app(argc, argv); QQuickView viewer; diff --git a/tests/manual/qmlperf/qml/qmlperf/main.qml b/tests/manual/qmlperf/qml/qmlperf/main.qml index 43c6c5bf..4562e538 100644 --- a/tests/manual/qmlperf/qml/qmlperf/main.qml +++ b/tests/manual/qmlperf/qml/qmlperf/main.qml @@ -1,39 +1,13 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only -import QtQuick 2.1 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.0 -import QtDataVisualization 1.1 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import QtDataVisualization 1.2 import "." -Rectangle { +Item { id: mainview width: 1280 height: 1024 @@ -136,17 +110,17 @@ Rectangle { fpsText.text = itemCount + " : " + scatterPlot.currentFps.toFixed(1); } -// theme: Theme3D { -// type: Theme3D.ThemeRetro -// colorStyle: Theme3D.ColorStyleRangeGradient -// baseGradients: customGradient + theme: Theme3D { + type: Theme3D.ThemeRetro + colorStyle: Theme3D.ColorStyleRangeGradient + baseGradients: customGradient -// ColorGradient { -// id: customGradient -// ColorGradientStop { position: 1.0; color: "red" } -// ColorGradientStop { position: 0.0; color: "blue" } -// } -// } + ColorGradient { + id: customGradient + ColorGradientStop { position: 1.0; color: "red" } + ColorGradientStop { position: 0.0; color: "blue" } + } + } Scatter3DSeries { id: scatterSeries diff --git a/tests/manual/qmlvolume/CMakeLists.txt b/tests/manual/qmlvolume/CMakeLists.txt new file mode 100644 index 00000000..5a0e446a --- /dev/null +++ b/tests/manual/qmlvolume/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(qmlvolume + GUI + SOURCES + datasource.cpp datasource.h + main.cpp + ) +target_link_libraries(qmlvolume PUBLIC + Qt::Gui + Qt::Qml + Qt::Quick + Qt::DataVisualization + ) + +set(qmlvolume_resource_files + "qml/qmlvolume/main.qml" + ) + +qt_internal_add_resource(qmlvolume "qmlvolume" + PREFIX + "/" + FILES + ${qmlvolume_resource_files} + ) diff --git a/tests/manual/qmlvolume/datasource.cpp b/tests/manual/qmlvolume/datasource.cpp index a06ea6d9..6a16278e 100644 --- a/tests/manual/qmlvolume/datasource.cpp +++ b/tests/manual/qmlvolume/datasource.cpp @@ -1,39 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "datasource.h" #include <QtCore/qmath.h> #include <QtGui/QRgb> #include <QtGui/QVector3D> -using namespace QtDataVisualization; - Q_DECLARE_METATYPE(QCustom3DVolume *) DataSource::DataSource(QObject *parent) : @@ -52,7 +24,7 @@ void DataSource::fillVolume(QCustom3DVolume *volumeItem) // This can take a while if the dimensions are large, so we support incremental data generation. int index = 0; - int textureSize = 256; + int textureSize = 1024; QVector3D midPoint(float(textureSize) / 2.0f, float(textureSize) / 2.0f, float(textureSize) / 2.0f); diff --git a/tests/manual/qmlvolume/datasource.h b/tests/manual/qmlvolume/datasource.h index cd7ca2d6..de502337 100644 --- a/tests/manual/qmlvolume/datasource.h +++ b/tests/manual/qmlvolume/datasource.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef DATASOURCE_H #define DATASOURCE_H @@ -33,8 +7,6 @@ #include <QtDataVisualization/QCustom3DVolume> #include <QtCore/QObject> -using namespace QtDataVisualization; - class DataSource : public QObject { Q_OBJECT diff --git a/tests/manual/qmlvolume/main.cpp b/tests/manual/qmlvolume/main.cpp index ac69d4f1..1c4e4492 100644 --- a/tests/manual/qmlvolume/main.cpp +++ b/tests/manual/qmlvolume/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "datasource.h" @@ -39,6 +13,7 @@ int main(int argc, char *argv[]) { + qputenv("QSG_RHI_BACKEND", "opengl"); QGuiApplication app(argc, argv); QQuickView viewer; diff --git a/tests/manual/qmlvolume/qml/qmlvolume/NewButton.qml b/tests/manual/qmlvolume/qml/qmlvolume/NewButton.qml deleted file mode 100644 index 19309cca..00000000 --- a/tests/manual/qmlvolume/qml/qmlvolume/NewButton.qml +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Controls 1.0 -import QtQuick.Controls.Styles 1.0 - -Item { - id: newbutton - - property alias text: buttonText.text - - signal clicked - - implicitWidth: buttonText.implicitWidth + 5 - implicitHeight: buttonText.implicitHeight + 10 - - Button { - id: buttonText - width: parent.width - height: parent.height - - style: ButtonStyle { - label: Component { - Text { - text: buttonText.text - clip: true - wrapMode: Text.WordWrap - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - anchors.fill: parent - } - } - } - onClicked: newbutton.clicked() - } -} diff --git a/tests/manual/qmlvolume/qml/qmlvolume/main.qml b/tests/manual/qmlvolume/qml/qmlvolume/main.qml index 24946a12..da061483 100644 --- a/tests/manual/qmlvolume/qml/qmlvolume/main.qml +++ b/tests/manual/qmlvolume/qml/qmlvolume/main.qml @@ -1,35 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.0 +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls import QtDataVisualization 1.2 import "." @@ -50,15 +24,7 @@ Item { width: dataView.width height: dataView.height orthoProjection: true - //measureFps: true - - onCurrentFpsChanged: { - if (fps > 10) - fpsText.text = "FPS: " + Math.round(surfaceGraph.currentFps) - else - fpsText.text = "FPS: " + Math.round(surfaceGraph.currentFps * 10.0) / 10.0 - } - + measureFps : false Surface3DSeries { id: surfaceSeries drawMode: Surface3DSeries.DrawSurface; @@ -68,7 +34,7 @@ Item { itemLabelVisible: false onItemLabelChanged: { - if (surfaceSeries.selectedPoint === surfaceSeries.invalidSelectionPosition) + if (surfaceSeries.selectedPoint == surfaceSeries.invalidSelectionPosition) selectionText.text = "No selection" else selectionText.text = surfaceSeries.itemLabel @@ -92,12 +58,9 @@ Item { anchors.fill: parent RowLayout { id: sliderLayout - anchors.top: parent.top - Layout.fillHeight: true - Layout.fillWidth: true - Layout.minimumHeight: 150 + Layout.fillHeight: false spacing: 0 - + visible: surfaceGraph.measureFps Rectangle { Layout.fillHeight: true Layout.fillWidth: true @@ -116,19 +79,21 @@ Item { anchors.fill: parent verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter + text: { + return "FPS: " + surfaceGraph.currentFps > 10 + ? Math.round(surfaceGraph.currentFps) + : Math.round(surfaceGraph.currentFps * 10.0) / 10.0 + } } } } RowLayout { id: buttonLayout - Layout.fillHeight: true - Layout.fillWidth: true Layout.minimumHeight: 50 - anchors.bottom: parent.bottom spacing: 0 - NewButton { + Button { id: sliceButton Layout.fillHeight: true Layout.fillWidth: true @@ -136,7 +101,7 @@ Item { text: "Slice" onClicked: { - if (volumeItem.sliceIndexZ == -1) { + if (volumeItem.sliceIndexZ === -1) { volumeItem.sliceIndexZ = 128 volumeItem.drawSlices = true volumeItem.drawSliceFrames = true @@ -147,18 +112,38 @@ Item { } } } - NewButton { + Button { id: exitButton Layout.fillHeight: true Layout.fillWidth: true text: "Quit" - onClicked: Qt.quit(0); + onClicked: Qt.quit(); } } } + } + + SequentialAnimation { + running: volumeItem.drawSlices + loops: Animation.Infinite + PropertyAnimation { + target: volumeItem + property: "sliceIndexZ" + from: 0 + to: 1024 + duration: 5000 + } + + PropertyAnimation { + target: volumeItem + property: "sliceIndexZ" + from: 1024 + to: 0 + duration: 5000 + } } Custom3DVolume { diff --git a/tests/manual/qmlvolume/qmlvolume.qrc b/tests/manual/qmlvolume/qmlvolume.qrc index 18fe57e1..b1cb2997 100644 --- a/tests/manual/qmlvolume/qmlvolume.qrc +++ b/tests/manual/qmlvolume/qmlvolume.qrc @@ -1,6 +1,5 @@ <RCC> <qresource prefix="/"> <file>qml/qmlvolume/main.qml</file> - <file>qml/qmlvolume/NewButton.qml</file> </qresource> </RCC> diff --git a/tests/manual/scattertest/CMakeLists.txt b/tests/manual/scattertest/CMakeLists.txt new file mode 100644 index 00000000..89013c12 --- /dev/null +++ b/tests/manual/scattertest/CMakeLists.txt @@ -0,0 +1,18 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(scattertest + GUI + SOURCES + main.cpp + scatterchart.cpp scatterchart.h + NO_PCH_SOURCES + scatterchart.cpp # undef QT_NO_FOREACH + ) +target_link_libraries(scattertest PUBLIC + Qt::Gui + Qt::Widgets + Qt::DataVisualization + ) diff --git a/tests/manual/scattertest/main.cpp b/tests/manual/scattertest/main.cpp index d7e349bc..af4d477f 100644 --- a/tests/manual/scattertest/main.cpp +++ b/tests/manual/scattertest/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "scatterchart.h" @@ -46,6 +20,7 @@ int main(int argc, char **argv) { + qputenv("QSG_RHI_BACKEND", "opengl"); QApplication app(argc, argv); //QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); diff --git a/tests/manual/scattertest/scatterchart.cpp b/tests/manual/scattertest/scatterchart.cpp index c6775df2..fce115d4 100644 --- a/tests/manual/scattertest/scatterchart.cpp +++ b/tests/manual/scattertest/scatterchart.cpp @@ -1,31 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses #include "scatterchart.h" #include <QtDataVisualization/qscatterdataproxy.h> @@ -37,7 +13,6 @@ #include <QtDataVisualization/Q3DInputHandler> #include <qmath.h> #include <qrandom.h> -using namespace QtDataVisualization; //#define RANDOM_SCATTER @@ -245,7 +220,7 @@ void ScatterDataModifier::massiveTestAppendAndScroll() m_chart->axisZ()->setRange(min, max); } -void ScatterDataModifier::setFpsMeasurement(bool enable) +void ScatterDataModifier::setFpsMeasurement(int enable) { m_chart->setMeasureFps(enable); } @@ -974,14 +949,14 @@ void ScatterDataModifier::changeRadialLabelOffset(int offset) m_chart->setRadialLabelOffset(float(offset) / 100.0f); } -void ScatterDataModifier::toggleAxisTitleVisibility(bool enabled) +void ScatterDataModifier::toggleAxisTitleVisibility(int enabled) { m_chart->axisX()->setTitleVisible(enabled); m_chart->axisY()->setTitleVisible(enabled); m_chart->axisZ()->setTitleVisible(enabled); } -void ScatterDataModifier::toggleAxisTitleFixed(bool enabled) +void ScatterDataModifier::toggleAxisTitleFixed(int enabled) { m_chart->axisX()->setTitleFixed(enabled); m_chart->axisY()->setTitleFixed(enabled); @@ -1010,12 +985,12 @@ void ScatterDataModifier::renderToImage() } } -void ScatterDataModifier::togglePolar(bool enable) +void ScatterDataModifier::togglePolar(int enable) { m_chart->setPolar(enable); } -void ScatterDataModifier::toggleStatic(bool enable) +void ScatterDataModifier::toggleStatic(int enable) { if (enable) m_chart->setOptimizationHints(QAbstract3DGraph::OptimizationStatic); @@ -1023,7 +998,7 @@ void ScatterDataModifier::toggleStatic(bool enable) m_chart->setOptimizationHints(QAbstract3DGraph::OptimizationDefault); } -void ScatterDataModifier::toggleOrtho(bool enable) +void ScatterDataModifier::toggleOrtho(int enable) { m_chart->setOrthoProjection(enable); } diff --git a/tests/manual/scattertest/scatterchart.h b/tests/manual/scattertest/scatterchart.h index 05fb0b03..2771a9a4 100644 --- a/tests/manual/scattertest/scatterchart.h +++ b/tests/manual/scattertest/scatterchart.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef SCATTERDATAMODIFIER_H #define SCATTERDATAMODIFIER_H @@ -38,8 +12,6 @@ #include <QTimer> #include <QLabel> -using namespace QtDataVisualization; - class ScatterDataModifier : public QObject { Q_OBJECT @@ -69,7 +41,7 @@ public: void massiveDataTest(); void massiveTestScroll(); void massiveTestAppendAndScroll(); - void setFpsMeasurement(bool enable); + void setFpsMeasurement(int enable); void setFpsLabel(QLabel *fpsLabel) { m_fpsLabel = fpsLabel; } void testItemChanges(); void testAxisReverse(); @@ -103,12 +75,12 @@ public Q_SLOTS: void handleFpsChange(qreal fps); void changeLabelRotation(int rotation); void changeRadialLabelOffset(int offset); - void toggleAxisTitleVisibility(bool enabled); - void toggleAxisTitleFixed(bool enabled); + void toggleAxisTitleVisibility(int enabled); + void toggleAxisTitleFixed(int enabled); void renderToImage(); - void togglePolar(bool enable); - void toggleStatic(bool enable); - void toggleOrtho(bool enable); + void togglePolar(int enable); + void toggleStatic(int enable); + void toggleOrtho(int enable); void setCameraTargetX(int value); void setCameraTargetY(int value); void setCameraTargetZ(int value); diff --git a/tests/manual/surfacetest/CMakeLists.txt b/tests/manual/surfacetest/CMakeLists.txt new file mode 100644 index 00000000..bb3f0500 --- /dev/null +++ b/tests/manual/surfacetest/CMakeLists.txt @@ -0,0 +1,38 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(surfacetest + GUI + SOURCES + buttonwrapper.cpp buttonwrapper.h + checkboxwrapper.cpp checkboxwrapper.h + graphmodifier.cpp graphmodifier.h + main.cpp + NO_PCH_SOURCES + graphmodifier.cpp # undef QT_NO_FOREACH + ) +target_link_libraries(surfacetest PUBLIC + Qt::Gui + Qt::Widgets + Qt::DataVisualization + ) + +set_source_files_properties("Heightmap.png" + PROPERTIES QT_RESOURCE_ALIAS "map" + ) +set_source_files_properties("mapimage.png" + PROPERTIES QT_RESOURCE_ALIAS "mapimage" + ) +set(surfacetest_resource_files + "Heightmap.png" + "mapimage.png" + ) + +qt_internal_add_resource(surfacetest "surfacetest" + PREFIX + "/maps" + FILES + ${surfacetest_resource_files} + ) diff --git a/tests/manual/surfacetest/buttonwrapper.cpp b/tests/manual/surfacetest/buttonwrapper.cpp new file mode 100644 index 00000000..c8eef0c7 --- /dev/null +++ b/tests/manual/surfacetest/buttonwrapper.cpp @@ -0,0 +1,14 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#include "buttonwrapper.h" +#include <QPushButton> + +ButtonWrapper::ButtonWrapper(QPushButton *button) +{ + m_button = button; +} + +void ButtonWrapper::setEnabled(int state) +{ + m_button->setEnabled(state); +} diff --git a/tests/manual/surfacetest/buttonwrapper.h b/tests/manual/surfacetest/buttonwrapper.h new file mode 100644 index 00000000..d0112117 --- /dev/null +++ b/tests/manual/surfacetest/buttonwrapper.h @@ -0,0 +1,22 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#ifndef BUTTONWRAPPER_H +#define BUTTONWRAPPER_H + +#include <QObject> +class QPushButton; + +class ButtonWrapper : public QObject +{ + Q_OBJECT +public: + ButtonWrapper(QPushButton *button); + +public Q_SLOTS: + void setEnabled(int state); + +private: + QPushButton *m_button; +}; + +#endif // BUTTONWRAPPER_H diff --git a/tests/manual/surfacetest/checkboxwrapper.cpp b/tests/manual/surfacetest/checkboxwrapper.cpp new file mode 100644 index 00000000..37bd3ded --- /dev/null +++ b/tests/manual/surfacetest/checkboxwrapper.cpp @@ -0,0 +1,14 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#include "checkboxwrapper.h" +#include <QCheckBox> + +CheckBoxWrapper::CheckBoxWrapper(QCheckBox *cb) +{ + m_checkbox = cb; +} + +void CheckBoxWrapper::setEnabled(int enabled) +{ + m_checkbox->setEnabled(enabled); +} diff --git a/tests/manual/surfacetest/checkboxwrapper.h b/tests/manual/surfacetest/checkboxwrapper.h new file mode 100644 index 00000000..37e72346 --- /dev/null +++ b/tests/manual/surfacetest/checkboxwrapper.h @@ -0,0 +1,23 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#ifndef CHECKBOXWRAPPER_H +#define CHECKBOXWRAPPER_H + +#include <QObject> + +class QCheckBox; + +class CheckBoxWrapper : public QObject +{ + Q_OBJECT +public: + explicit CheckBoxWrapper(QCheckBox *cb); + +public Q_SLOTS: + void setEnabled(int enabled); + +private: + QCheckBox *m_checkbox; +}; + +#endif // CHECKBOXWRAPPER_H diff --git a/tests/manual/surfacetest/graphmodifier.cpp b/tests/manual/surfacetest/graphmodifier.cpp index 11cabb4d..f406513d 100644 --- a/tests/manual/surfacetest/graphmodifier.cpp +++ b/tests/manual/surfacetest/graphmodifier.cpp @@ -1,31 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses #include "graphmodifier.h" #include <QtDataVisualization/QValue3DAxis> @@ -42,7 +18,6 @@ #ifndef QT_NO_CURSOR #include <QtGui/QCursor> #endif -using namespace QtDataVisualization; //#define JITTER_PLANE //#define WONKY_PLANE @@ -194,7 +169,7 @@ void GraphModifier::fillSeries() m_multiseries[3]->dataProxy()->resetArray(dataArray4); } -void GraphModifier::toggleSeries1(bool enabled) +void GraphModifier::toggleSeries1(int enabled) { qDebug() << __FUNCTION__ << " enabled = " << enabled; @@ -205,7 +180,7 @@ void GraphModifier::toggleSeries1(bool enabled) } } -void GraphModifier::toggleSeries2(bool enabled) +void GraphModifier::toggleSeries2(int enabled) { qDebug() << __FUNCTION__ << " enabled = " << enabled; @@ -216,7 +191,7 @@ void GraphModifier::toggleSeries2(bool enabled) } } -void GraphModifier::toggleSeries3(bool enabled) +void GraphModifier::toggleSeries3(int enabled) { qDebug() << __FUNCTION__ << " enabled = " << enabled; @@ -227,7 +202,7 @@ void GraphModifier::toggleSeries3(bool enabled) } } -void GraphModifier::toggleSeries4(bool enabled) +void GraphModifier::toggleSeries4(int enabled) { qDebug() << __FUNCTION__ << " enabled = " << enabled; @@ -238,7 +213,7 @@ void GraphModifier::toggleSeries4(bool enabled) } } -void GraphModifier::toggleSmooth(bool enabled) +void GraphModifier::toggleSmooth(int enabled) { qDebug() << "GraphModifier::toggleSmooth " << enabled; m_theSeries->setFlatShadingEnabled(enabled); @@ -247,7 +222,7 @@ void GraphModifier::toggleSmooth(bool enabled) #endif } -void GraphModifier::toggleSurfaceGrid(bool enable) +void GraphModifier::toggleSurfaceGrid(int enable) { qDebug() << "GraphModifier::toggleSurfaceGrid" << enable; if (enable) @@ -261,7 +236,7 @@ void GraphModifier::toggleSurfaceGrid(bool enable) #endif } -void GraphModifier::toggleSurface(bool enable) +void GraphModifier::toggleSurface(int enable) { qDebug() << "GraphModifier::toggleSurface" << enable; if (enable) @@ -275,7 +250,7 @@ void GraphModifier::toggleSurface(bool enable) #endif } -void GraphModifier::toggleSeriesVisible(bool enable) +void GraphModifier::toggleSeriesVisible(int enable) { m_theSeries->setVisible(enable); #ifdef MULTI_SERIES @@ -283,13 +258,13 @@ void GraphModifier::toggleSeriesVisible(bool enable) #endif } -void GraphModifier::toggleSmoothS2(bool enabled) +void GraphModifier::toggleSmoothS2(int enabled) { qDebug() << __FUNCTION__ << enabled; m_multiseries[1]->setFlatShadingEnabled(enabled); } -void GraphModifier::toggleSurfaceGridS2(bool enable) +void GraphModifier::toggleSurfaceGridS2(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -300,7 +275,7 @@ void GraphModifier::toggleSurfaceGridS2(bool enable) m_multiseries[1]->setDrawMode(m_drawMode2); } -void GraphModifier::toggleSurfaceS2(bool enable) +void GraphModifier::toggleSurfaceS2(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -311,19 +286,19 @@ void GraphModifier::toggleSurfaceS2(bool enable) m_multiseries[1]->setDrawMode(m_drawMode2); } -void GraphModifier::toggleSeries2Visible(bool enable) +void GraphModifier::toggleSeries2Visible(int enable) { qDebug() << __FUNCTION__ << enable; m_multiseries[1]->setVisible(enable); } -void GraphModifier::toggleSmoothS3(bool enabled) +void GraphModifier::toggleSmoothS3(int enabled) { qDebug() << __FUNCTION__ << enabled; m_multiseries[2]->setFlatShadingEnabled(enabled); } -void GraphModifier::toggleSurfaceGridS3(bool enable) +void GraphModifier::toggleSurfaceGridS3(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -334,7 +309,7 @@ void GraphModifier::toggleSurfaceGridS3(bool enable) m_multiseries[2]->setDrawMode(m_drawMode3); } -void GraphModifier::toggleSurfaceS3(bool enable) +void GraphModifier::toggleSurfaceS3(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -345,19 +320,19 @@ void GraphModifier::toggleSurfaceS3(bool enable) m_multiseries[2]->setDrawMode(m_drawMode3); } -void GraphModifier::toggleSeries3Visible(bool enable) +void GraphModifier::toggleSeries3Visible(int enable) { qDebug() << __FUNCTION__ << enable; m_multiseries[2]->setVisible(enable); } -void GraphModifier::toggleSmoothS4(bool enabled) +void GraphModifier::toggleSmoothS4(int enabled) { qDebug() << __FUNCTION__ << enabled; m_multiseries[3]->setFlatShadingEnabled(enabled); } -void GraphModifier::toggleSurfaceGridS4(bool enable) +void GraphModifier::toggleSurfaceGridS4(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -368,7 +343,7 @@ void GraphModifier::toggleSurfaceGridS4(bool enable) m_multiseries[3]->setDrawMode(m_drawMode4); } -void GraphModifier::toggleSurfaceS4(bool enable) +void GraphModifier::toggleSurfaceS4(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -379,13 +354,13 @@ void GraphModifier::toggleSurfaceS4(bool enable) m_multiseries[3]->setDrawMode(m_drawMode4); } -void GraphModifier::toggleSeries4Visible(bool enable) +void GraphModifier::toggleSeries4Visible(int enable) { qDebug() << __FUNCTION__ << enable; m_multiseries[3]->setVisible(enable); } -void GraphModifier::toggleSqrtSin(bool enable) +void GraphModifier::toggleSqrtSin(int enable) { if (enable) { qDebug() << "Create Sqrt&Sin surface, (" << m_xCount << ", " << m_zCount << ")"; @@ -427,7 +402,7 @@ void GraphModifier::toggleSqrtSin(bool enable) } } -void GraphModifier::togglePlane(bool enable) +void GraphModifier::togglePlane(int enable) { qDebug() << "GraphModifier::togglePlane " << enable; @@ -750,21 +725,21 @@ void GraphModifier::changeLabelRotation(int rotation) m_graph->axisZ()->setLabelAutoRotation(float(rotation)); } -void GraphModifier::toggleAxisTitleVisibility(bool enabled) +void GraphModifier::toggleAxisTitleVisibility(int enabled) { m_graph->axisX()->setTitleVisible(enabled); m_graph->axisY()->setTitleVisible(enabled); m_graph->axisZ()->setTitleVisible(enabled); } -void GraphModifier::toggleAxisTitleFixed(bool enabled) +void GraphModifier::toggleAxisTitleFixed(int enabled) { m_graph->axisX()->setTitleFixed(enabled); m_graph->axisY()->setTitleFixed(enabled); m_graph->axisZ()->setTitleFixed(enabled); } -void GraphModifier::toggleXAscending(bool enabled) +void GraphModifier::toggleXAscending(int enabled) { m_ascendingX = enabled; @@ -794,7 +769,7 @@ void GraphModifier::toggleXAscending(bool enabled) } } -void GraphModifier::toggleZAscending(bool enabled) +void GraphModifier::toggleZAscending(int enabled) { m_ascendingZ = enabled; @@ -824,7 +799,7 @@ void GraphModifier::toggleZAscending(bool enabled) } } -void GraphModifier::togglePolar(bool enabled) +void GraphModifier::togglePolar(int enabled) { m_graph->setPolar(enabled); } @@ -1682,7 +1657,7 @@ void GraphModifier::setHorizontalAspectRatio(int ratio) m_graph->setHorizontalAspectRatio(aspectRatio); } -void GraphModifier::setSurfaceTexture(bool enabled) +void GraphModifier::setSurfaceTexture(int enabled) { if (enabled) m_multiseries[3]->setTexture(QImage(":/maps/mapimage")); diff --git a/tests/manual/surfacetest/graphmodifier.h b/tests/manual/surfacetest/graphmodifier.h index c520f3c5..fe839976 100644 --- a/tests/manual/surfacetest/graphmodifier.h +++ b/tests/manual/surfacetest/graphmodifier.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef GRAPHMODIFIER_H #define GRAPHMODIFIER_H @@ -40,8 +14,6 @@ #define MULTI_SERIES -using namespace QtDataVisualization; - class GraphModifier : public QObject { Q_OBJECT @@ -55,29 +27,29 @@ public: explicit GraphModifier(Q3DSurface *graph, QWidget *parentWidget); ~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 toggleSeries1(int enabled); + void toggleSeries2(int enabled); + void toggleSeries3(int enabled); + void toggleSeries4(int enabled); + void toggleSmooth(int enabled); + void toggleSurfaceGrid(int enable); + void toggleSurface(int enable); + void toggleSeriesVisible(int enable); + void toggleSmoothS2(int enabled); + void toggleSurfaceGridS2(int enable); + void toggleSurfaceS2(int enable); + void toggleSeries2Visible(int enable); + void toggleSmoothS3(int enabled); + void toggleSurfaceGridS3(int enable); + void toggleSurfaceS3(int enable); + void toggleSeries3Visible(int enable); + void toggleSmoothS4(int enabled); + void toggleSurfaceGridS4(int enable); + void toggleSurfaceS4(int enable); + void toggleSeries4Visible(int enable); - void toggleSqrtSin(bool enable); - void togglePlane(bool enable); + void toggleSqrtSin(int enable); + void togglePlane(int enable); void setHeightMapData(bool enable); void toggleGridSliderLock(bool enable); void setGridSliderX(QSlider *slider) { m_gridSliderX = slider; } @@ -125,7 +97,7 @@ public: void testDataOrdering(); void setAspectRatio(int ratio); void setHorizontalAspectRatio(int ratio); - void setSurfaceTexture(bool enabled); + void setSurfaceTexture(int enabled); public Q_SLOTS: void changeShadowQuality(int quality); @@ -140,11 +112,11 @@ public Q_SLOTS: void handleAxisZChanged(QValue3DAxis *axis); void handleFpsChange(qreal fps); void changeLabelRotation(int rotation); - void toggleAxisTitleVisibility(bool enabled); - void toggleAxisTitleFixed(bool enabled); - void toggleXAscending(bool enabled); - void toggleZAscending(bool enabled); - void togglePolar(bool enabled); + void toggleAxisTitleVisibility(int enabled); + void toggleAxisTitleFixed(int enabled); + void toggleXAscending(int enabled); + void toggleZAscending(int enabled); + void togglePolar(int enabled); void setCameraTargetX(int value); void setCameraTargetY(int value); void setCameraTargetZ(int value); diff --git a/tests/manual/surfacetest/main.cpp b/tests/manual/surfacetest/main.cpp index 2a638f0f..7b90a0c2 100644 --- a/tests/manual/surfacetest/main.cpp +++ b/tests/manual/surfacetest/main.cpp @@ -1,33 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "graphmodifier.h" +#include "buttonwrapper.h" +#include "checkboxwrapper.h" #include <QtDataVisualization/q3dtheme.h> #include <QApplication> @@ -45,12 +21,11 @@ #include <QFrame> #include <QDebug> -using namespace QtDataVisualization; - const int initialTheme = 4; int main(int argc, char *argv[]) { + qputenv("QSG_RHI_BACKEND", "opengl"); QApplication app(argc, argv); QWidget *widget = new QWidget; @@ -581,49 +556,66 @@ int main(int argc, char *argv[]) QObject::connect(series4VisibleCB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeries4Visible); + CheckBoxWrapper *series1SmoothCBWrapper = new CheckBoxWrapper(smoothCB); + CheckBoxWrapper *series1SurfaceGridCBWrapper = new CheckBoxWrapper(surfaceGridCB); + CheckBoxWrapper *series1surfaceCBWrapper = new CheckBoxWrapper(surfaceCB); + CheckBoxWrapper *series1VisibleCBWrapper = new CheckBoxWrapper(seriesVisibleCB); QObject::connect(series1CB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeries1); QObject::connect(series1CB, &QCheckBox::stateChanged, - smoothCB, &QPushButton::setEnabled); + series1SmoothCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series1CB, &QCheckBox::stateChanged, - surfaceGridCB, &QPushButton::setEnabled); + series1SurfaceGridCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series1CB, &QCheckBox::stateChanged, - surfaceCB, &QPushButton::setEnabled); + series1surfaceCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series1CB, &QCheckBox::stateChanged, - seriesVisibleCB, &QPushButton::setEnabled); + series1VisibleCBWrapper, &CheckBoxWrapper::setEnabled); + + CheckBoxWrapper *series2SmoothCBWrapper = new CheckBoxWrapper(smoothS2CB); + CheckBoxWrapper *series2SurfaceGridCBWrapper = new CheckBoxWrapper(surfaceGridS2CB); + CheckBoxWrapper *series2surfaceCBWrapper = new CheckBoxWrapper(surfaceS2CB); + CheckBoxWrapper *series2VisibleCBWrapper = new CheckBoxWrapper(series2VisibleCB); QObject::connect(series2CB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeries2); QObject::connect(series2CB, &QCheckBox::stateChanged, - smoothS2CB, &QPushButton::setEnabled); + series2SmoothCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series2CB, &QCheckBox::stateChanged, - surfaceGridS2CB, &QPushButton::setEnabled); + series2SurfaceGridCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series2CB, &QCheckBox::stateChanged, - surfaceS2CB, &QPushButton::setEnabled); + series2surfaceCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series2CB, &QCheckBox::stateChanged, - series2VisibleCB, &QPushButton::setEnabled); + series2VisibleCBWrapper, &CheckBoxWrapper::setEnabled); + CheckBoxWrapper *series3SmoothCBWrapper = new CheckBoxWrapper(smoothS3CB); + CheckBoxWrapper *series3SurfaceGridCBWrapper = new CheckBoxWrapper(surfaceGridS3CB); + CheckBoxWrapper *series3surfaceCBWrapper = new CheckBoxWrapper(surfaceS3CB); + CheckBoxWrapper *series3VisibleCBWrapper = new CheckBoxWrapper(series3VisibleCB); QObject::connect(series3CB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeries3); QObject::connect(series3CB, &QCheckBox::stateChanged, - smoothS3CB, &QPushButton::setEnabled); + series3SmoothCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series3CB, &QCheckBox::stateChanged, - surfaceGridS3CB, &QPushButton::setEnabled); + series3SurfaceGridCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series3CB, &QCheckBox::stateChanged, - surfaceS3CB, &QPushButton::setEnabled); + series3surfaceCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series3CB, &QCheckBox::stateChanged, - series3VisibleCB, &QPushButton::setEnabled); + series3VisibleCBWrapper, &CheckBoxWrapper::setEnabled); + CheckBoxWrapper *series4SmoothCBWrapper = new CheckBoxWrapper(smoothS4CB); + CheckBoxWrapper *series4SurfaceGridCBWrapper = new CheckBoxWrapper(surfaceGridS4CB); + CheckBoxWrapper *series4surfaceCBWrapper = new CheckBoxWrapper(surfaceS4CB); + CheckBoxWrapper *series4VisibleCBWrapper = new CheckBoxWrapper(series4VisibleCB); QObject::connect(series4CB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeries4); QObject::connect(series4CB, &QCheckBox::stateChanged, - smoothS4CB, &QPushButton::setEnabled); + series4SmoothCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series4CB, &QCheckBox::stateChanged, - surfaceGridS4CB, &QPushButton::setEnabled); + series4SurfaceGridCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series4CB, &QCheckBox::stateChanged, - surfaceS4CB, &QPushButton::setEnabled); + series4surfaceCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series4CB, &QCheckBox::stateChanged, - series4VisibleCB, &QPushButton::setEnabled); + series4VisibleCBWrapper, &CheckBoxWrapper::setEnabled); #else QObject::connect(sqrtSinCB, &QRadioButton::toggled, modifier, &GraphModifier::toggleSqrtSin); diff --git a/tests/manual/volumetrictest/CMakeLists.txt b/tests/manual/volumetrictest/CMakeLists.txt new file mode 100644 index 00000000..7e39bdf5 --- /dev/null +++ b/tests/manual/volumetrictest/CMakeLists.txt @@ -0,0 +1,33 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +qt_internal_add_manual_test(volumetrictest + GUI + SOURCES + main.cpp + volumetrictest.cpp volumetrictest.h + ) + +target_link_libraries(volumetrictest PUBLIC + Qt::Gui + Qt::Widgets + Qt::DataVisualization + ) + +set_source_files_properties("cubeFilledFlat.obj" + PROPERTIES QT_RESOURCE_ALIAS "mesh" + ) +set(volumetrictest_resource_files + "cubeFilledFlat.obj" + "logo.png" + "logo_no_padding.png" + ) + +qt_internal_add_resource(volumetrictest "volumetrictest" + PREFIX + "/" + FILES + ${volumetrictest_resource_files} + ) diff --git a/tests/manual/volumetrictest/main.cpp b/tests/manual/volumetrictest/main.cpp index 412de874..d9d322be 100644 --- a/tests/manual/volumetrictest/main.cpp +++ b/tests/manual/volumetrictest/main.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "volumetrictest.h" #include <QtWidgets/QApplication> @@ -41,6 +15,7 @@ int main(int argc, char **argv) { + qputenv("QSG_RHI_BACKEND", "opengl"); QApplication app(argc, argv); //Q3DScatter *graph = new Q3DScatter(); //Q3DSurface *graph = new Q3DSurface(); diff --git a/tests/manual/volumetrictest/volumetrictest.cpp b/tests/manual/volumetrictest/volumetrictest.cpp index a60c55bc..49293873 100644 --- a/tests/manual/volumetrictest/volumetrictest.cpp +++ b/tests/manual/volumetrictest/volumetrictest.cpp @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "volumetrictest.h" #include <QtDataVisualization/qbar3dseries.h> @@ -40,8 +14,6 @@ #include <QtWidgets/QLabel> #include <QtCore/QDebug> -using namespace QtDataVisualization; - const int imageCount = 512; const float xMiddle = 100.0f; const float yMiddle = 2.5f; diff --git a/tests/manual/volumetrictest/volumetrictest.h b/tests/manual/volumetrictest/volumetrictest.h index 83e0d01a..20b197d0 100644 --- a/tests/manual/volumetrictest/volumetrictest.h +++ b/tests/manual/volumetrictest/volumetrictest.h @@ -1,31 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Data Visualization module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef VOLUMETRICMODIFIER_H #define VOLUMETRICMODIFIER_H @@ -37,8 +11,6 @@ #include <QtDataVisualization/q3dbars.h> #include <QtWidgets/QLabel> -using namespace QtDataVisualization; - class VolumetricModifier : public QObject { Q_OBJECT |