summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.cmake.conf3
-rw-r--r--.qmake.conf7
-rw-r--r--CMakeLists.txt2
-rw-r--r--conanfile.py120
-rw-r--r--dependencies.yaml6
-rw-r--r--examples/datavisualization/bars/CMakeLists.txt2
-rw-r--r--examples/datavisualization/bars/graphmodifier.h2
-rw-r--r--examples/datavisualization/custominput/CMakeLists.txt2
-rw-r--r--examples/datavisualization/customitems/CMakeLists.txt2
-rw-r--r--examples/datavisualization/customproxy/CMakeLists.txt2
-rw-r--r--examples/datavisualization/draggableaxes/CMakeLists.txt2
-rw-r--r--examples/datavisualization/itemmodel/CMakeLists.txt2
-rw-r--r--examples/datavisualization/qml3doscilloscope/CMakeLists.txt2
-rw-r--r--examples/datavisualization/qmlaxisdrag/CMakeLists.txt2
-rw-r--r--examples/datavisualization/qmlaxisformatter/CMakeLists.txt2
-rw-r--r--examples/datavisualization/qmlbars/CMakeLists.txt2
-rw-r--r--examples/datavisualization/qmlbars/doc/images/qmlbars-example.pngbin146667 -> 204973 bytes
-rw-r--r--examples/datavisualization/qmlbars/qml/qmlbars/main.qml20
-rw-r--r--examples/datavisualization/qmlcustominput/CMakeLists.txt2
-rw-r--r--examples/datavisualization/qmllegend/CMakeLists.txt2
-rw-r--r--examples/datavisualization/qmlmultigraph/CMakeLists.txt2
-rw-r--r--examples/datavisualization/qmlscatter/CMakeLists.txt2
-rw-r--r--examples/datavisualization/qmlscatter/qml/qmlscatter/main.qml1
-rw-r--r--examples/datavisualization/qmlspectrogram/CMakeLists.txt2
-rw-r--r--examples/datavisualization/qmlsurface/CMakeLists.txt2
-rw-r--r--examples/datavisualization/qmlsurface/qml/qmlsurface/main.qml20
-rw-r--r--examples/datavisualization/qmlsurfacelayers/CMakeLists.txt2
-rw-r--r--examples/datavisualization/rotations/CMakeLists.txt2
-rw-r--r--examples/datavisualization/scatter/CMakeLists.txt2
-rw-r--r--examples/datavisualization/scatter/scatterdatamodifier.h2
-rw-r--r--examples/datavisualization/surface/CMakeLists.txt2
-rw-r--r--examples/datavisualization/texturesurface/CMakeLists.txt2
-rw-r--r--examples/datavisualization/volumetric/CMakeLists.txt2
-rw-r--r--src/datavisualization/CMakeLists.txt1
-rw-r--r--src/datavisualization/axis/qabstract3daxis.h2
-rw-r--r--src/datavisualization/axis/qcategory3daxis.h2
-rw-r--r--src/datavisualization/axis/qlogvalue3daxisformatter.h2
-rw-r--r--src/datavisualization/axis/qvalue3daxis.h2
-rw-r--r--src/datavisualization/axis/qvalue3daxisformatter.h2
-rw-r--r--src/datavisualization/data/qabstract3dseries.h2
-rw-r--r--src/datavisualization/data/qabstractdataproxy.h2
-rw-r--r--src/datavisualization/data/qbar3dseries.cpp43
-rw-r--r--src/datavisualization/data/qbar3dseries.h7
-rw-r--r--src/datavisualization/data/qbar3dseries_p.h4
-rw-r--r--src/datavisualization/data/qbardataitem.h2
-rw-r--r--src/datavisualization/data/qbardataproxy.h2
-rw-r--r--src/datavisualization/data/qcustom3ditem.h2
-rw-r--r--src/datavisualization/data/qcustom3dlabel.h2
-rw-r--r--src/datavisualization/data/qcustom3dvolume.h2
-rw-r--r--src/datavisualization/data/qheightmapsurfacedataproxy.cpp226
-rw-r--r--src/datavisualization/data/qheightmapsurfacedataproxy.h14
-rw-r--r--src/datavisualization/data/qheightmapsurfacedataproxy_p.h6
-rw-r--r--src/datavisualization/data/qitemmodelbardataproxy.h2
-rw-r--r--src/datavisualization/data/qitemmodelscatterdataproxy.h2
-rw-r--r--src/datavisualization/data/qitemmodelsurfacedataproxy.h2
-rw-r--r--src/datavisualization/data/qscatter3dseries.h2
-rw-r--r--src/datavisualization/data/qscatterdataitem.h2
-rw-r--r--src/datavisualization/data/qscatterdataproxy.h2
-rw-r--r--src/datavisualization/data/qsurface3dseries.cpp34
-rw-r--r--src/datavisualization/data/qsurface3dseries.h7
-rw-r--r--src/datavisualization/data/qsurface3dseries_p.h2
-rw-r--r--src/datavisualization/data/qsurfacedataitem.h2
-rw-r--r--src/datavisualization/data/qsurfacedataproxy.cpp80
-rw-r--r--src/datavisualization/data/qsurfacedataproxy.h2
-rw-r--r--src/datavisualization/doc/qtdatavis3d.qdocconf5
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-abstractdeclarative.qdoc6
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc11
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc2
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc2
-rw-r--r--src/datavisualization/engine/abstract3dcontroller.cpp5
-rw-r--r--src/datavisualization/engine/abstract3dcontroller_p.h3
-rw-r--r--src/datavisualization/engine/bars3dcontroller.cpp23
-rw-r--r--src/datavisualization/engine/bars3dcontroller_p.h11
-rw-r--r--src/datavisualization/engine/bars3drenderer.cpp46
-rw-r--r--src/datavisualization/engine/bars3drenderer_p.h5
-rw-r--r--src/datavisualization/engine/drawer.cpp4
-rw-r--r--src/datavisualization/engine/q3dbars.cpp35
-rw-r--r--src/datavisualization/engine/q3dbars.h7
-rw-r--r--src/datavisualization/engine/q3dcamera.h2
-rw-r--r--src/datavisualization/engine/q3dcamera_p.h2
-rw-r--r--src/datavisualization/engine/q3dlight.h2
-rw-r--r--src/datavisualization/engine/q3dobject.h2
-rw-r--r--src/datavisualization/engine/q3dscatter.cpp6
-rw-r--r--src/datavisualization/engine/q3dscatter.h2
-rw-r--r--src/datavisualization/engine/q3dscene.h2
-rw-r--r--src/datavisualization/engine/q3dscene_p.h2
-rw-r--r--src/datavisualization/engine/q3dsurface.cpp6
-rw-r--r--src/datavisualization/engine/q3dsurface.h2
-rw-r--r--src/datavisualization/engine/qabstract3dgraph.cpp15
-rw-r--r--src/datavisualization/engine/qabstract3dgraph.h5
-rw-r--r--src/datavisualization/engine/scatter3dcontroller_p.h2
-rw-r--r--src/datavisualization/engine/scatter3drenderer_p.h2
-rw-r--r--src/datavisualization/engine/surface3dcontroller_p.h2
-rw-r--r--src/datavisualization/engine/surface3drenderer_p.h2
-rw-r--r--src/datavisualization/engine/surfaceseriesrendercache.cpp4
-rw-r--r--src/datavisualization/global/qdatavisualizationglobal.h11
-rw-r--r--src/datavisualization/input/q3dinputhandler.h2
-rw-r--r--src/datavisualization/input/qabstract3dinputhandler.h2
-rw-r--r--src/datavisualization/input/qtouch3dinputhandler.h2
-rw-r--r--src/datavisualization/theme/q3dtheme.h2
-rw-r--r--src/datavisualization/theme/q3dtheme_p.h2
-rw-r--r--src/datavisualization/utils/surfaceobject.cpp3
-rw-r--r--src/datavisualization/utils/surfaceobject_p.h4
-rw-r--r--src/datavisualizationqml/abstractdeclarative.cpp8
-rw-r--r--src/datavisualizationqml/abstractdeclarative_p.h2
-rw-r--r--src/datavisualizationqml/colorgradient_p.h2
-rw-r--r--src/datavisualizationqml/declarativebars.cpp15
-rw-r--r--src/datavisualizationqml/declarativebars_p.h11
-rw-r--r--src/datavisualizationqml/declarativecolor_p.h2
-rw-r--r--src/datavisualizationqml/declarativescene_p.h2
-rw-r--r--src/datavisualizationqml/declarativeseries.cpp101
-rw-r--r--src/datavisualizationqml/declarativeseries_p.h23
-rw-r--r--tests/auto/cpptest/CMakeLists.txt1
-rw-r--r--tests/auto/cpptest/q3dbars-series/tst_series.cpp13
-rw-r--r--tests/auto/cpptest/q3dbars/tst_bars.cpp13
-rw-r--r--tests/auto/cpptest/q3dscatter/tst_scatter.cpp10
-rw-r--r--tests/auto/cpptest/q3dsurface-modelproxy-nan/CMakeLists.txt11
-rw-r--r--tests/auto/cpptest/q3dsurface-modelproxy-nan/tst_proxy.cpp292
-rw-r--r--tests/auto/cpptest/q3dsurface-series/tst_series.cpp4
-rw-r--r--tests/auto/cpptest/q3dsurface/tst_surface.cpp10
-rw-r--r--tests/auto/qmltest/bars3d/tst_bars.qml14
-rw-r--r--tests/auto/qmltest/bars3d/tst_barseries.qml25
-rw-r--r--tests/auto/qmltest/bars3d/tst_basic.qml18
-rw-r--r--tests/auto/qmltest/bars3d/tst_proxy.qml2
-rw-r--r--tests/auto/qmltest/scatter3d/tst_scatter.qml8
-rw-r--r--tests/auto/qmltest/surface3d/tst_surface.qml8
-rw-r--r--tests/auto/qmltest/surface3d/tst_surfaceseries.qml7
-rw-r--r--tests/manual/CMakeLists.txt2
-rw-r--r--tests/manual/barstest/chart.cpp14
-rw-r--r--tests/manual/barstest/chart.h4
-rw-r--r--tests/manual/barstest/main.cpp20
-rw-r--r--tests/manual/directional/scatterdatamodifier.h2
-rw-r--r--tests/manual/qmlbarsrowcolors/CMakeLists.txt52
-rw-r--r--tests/manual/qmlbarsrowcolors/main.cpp59
-rw-r--r--tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Axes.qml67
-rw-r--r--tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Data.qml144
-rw-r--r--tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/main.qml418
-rw-r--r--tests/manual/qmlheightmap/CMakeLists.txt41
-rw-r--r--tests/manual/qmlheightmap/gradientGRAY16.pngbin0 -> 12392 bytes
-rw-r--r--tests/manual/qmlheightmap/gradientGRAY8.pngbin0 -> 26548 bytes
-rw-r--r--tests/manual/qmlheightmap/gradientRGB16.pngbin0 -> 12516 bytes
-rw-r--r--tests/manual/qmlheightmap/gradientRGB8.pngbin0 -> 26548 bytes
-rw-r--r--tests/manual/qmlheightmap/main.cpp63
-rw-r--r--tests/manual/qmlheightmap/qml.qrc5
-rw-r--r--tests/manual/qmlheightmap/qml/qmlheightmap/main.qml207
145 files changed, 2358 insertions, 286 deletions
diff --git a/.cmake.conf b/.cmake.conf
index 4e73b3d6..75aec070 100644
--- a/.cmake.conf
+++ b/.cmake.conf
@@ -1 +1,2 @@
-set(QT_REPO_MODULE_VERSION "6.2.0")
+set(QT_REPO_MODULE_VERSION "6.3.0")
+set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
diff --git a/.qmake.conf b/.qmake.conf
deleted file mode 100644
index 90b8856d..00000000
--- a/.qmake.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-load(qt_build_config)
-
-DEFINES += QT_NO_JAVA_STYLE_ITERATORS
-
-MODULE_VERSION = 6.2.0
-CONFIG += warning_clean
-CMAKE_MODULE_TESTS=-
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 325c5f18..304d73bb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.15.0)
+cmake_minimum_required(VERSION 3.16)
include(.cmake.conf)
project(QtDataVisualization
diff --git a/conanfile.py b/conanfile.py
index bfd82662..8aa42f17 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -26,110 +26,34 @@
##
#############################################################################
-from conans import ConanFile, tools, CMake
-import os
+from conans import ConanFile
+import re
+from pathlib import Path
-class QtConanError(Exception):
- pass
+def _parse_qt_version_by_key(key: str) -> str:
+ with open(Path(__file__).parent.resolve() / ".cmake.conf") as f:
+ m = re.search(fr'{key} .*"(.*)"', f.read())
+ return m.group(1) if m else ""
+
+
+def _get_qt_minor_version() -> str:
+ return ".".join(_parse_qt_version_by_key("QT_REPO_MODULE_VERSION").split(".")[:2])
class QtDataVisualization(ConanFile):
name = "qtdatavis3d"
- version = "6.2.0"
license = "GPL-3.0+, Commercial Qt License Agreement"
author = "The Qt Company <https://www.qt.io/contact-us>"
- url = "https://code.qt.io/cgit/qt/qtdatavis3d.git/"
- description = "Qt Data Visualization provides UI Components for displaying 3D graphs, driven by static or dynamic data models."
- topics = ("qt", "qt6", "data visualization", "qtquick")
- settings = "os", "compiler", "build_type", "arch"
- options = {"shared": [True, False, "default"],
- "qt6": "ANY"} # this is needed to model unique package_id for the Add-on build per used Qt6 version
- default_options = {"shared": "default", # default: Use the value of the Qt build
- "qt6": None}
+ url = "https://code.qt.io/cgit/qt/qtdatavis3d.git"
+ description = (
+ "Qt Data Visualization provides UI Components for displaying 3D graphs, driven by static or "
+ "dynamic data models."
+ )
+ topics = "qt", "qt6", "data visualization", "qtquick"
+ settings = "os", "compiler", "arch", "build_type"
+ # for referencing the version number and prerelease tag and dependencies info
+ exports = ".cmake.conf", "dependencies.yaml"
exports_sources = "*", "!conan*.*"
- revision_mode = "scm" # use commit ID as the RREV (recipe revision)
-
- def source(self):
- # sources are installed next to recipe, no need to clone etc. sources here
- pass
-
- def _get_cmake_prefix_path(self):
- # 'QTDIR' provided as env variable in profile file which is part of the Qt essential binary
- # package(s). Installed under .conan/profiles
- cmake_prefix_path = os.environ.get("QTDIR")
- if not cmake_prefix_path:
- raise QtConanError("'QTDIR' not defined! The 'QTDIR' needs to point to Qt installation directory.")
- print(f"CMAKE_PREFIX_PATH for '{self.name}/{self.version}' build is: {cmake_prefix_path}")
- return cmake_prefix_path
-
- def _read_env(self, key):
- value = os.environ.get(key)
- if not value:
- raise QtConanError(f"{self.settings.os} build specified but '{key}' was not defined?")
- return value
-
- def _get_qtcmake(self):
- qt_install_path = self._get_cmake_prefix_path()
- ext = ".bat" if tools.os_info.is_windows else ""
- qtcmake = os.path.abspath(os.path.join(qt_install_path, "bin", "qt-cmake" + ext))
- if not os.path.exists(qtcmake):
- raise QtConanError(f"Unable to locate {qtcmake} from 'QTDIR': {qt_install_path}")
- return qtcmake
-
- def _get_cmake_tool(self):
- cmake = CMake(self, cmake_program=self._get_qtcmake())
- cmake.verbose = True
-
- # Qt modules need to be 'installed'.
- # We need to direct the 'make install' to some directory under Conan cache,
- # place it under the current build directory which is also under the Conan cache.
- # Note, the actual 'make install' is called in "package()".
- install_dir = os.path.join(os.getcwd(), "_install_tmp")
- cmake.definitions["CMAKE_INSTALL_PREFIX"] = install_dir
-
- # Use the value of the Qt build
- if self.options.shared.value == "default":
- del cmake.definitions["BUILD_SHARED_LIBS"]
-
- cmake_toolchain_file = os.environ.get("CMAKE_TOOLCHAIN_FILE")
- if cmake_toolchain_file:
- cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = cmake_toolchain_file
-
- if self.settings.os == "Android":
- cmake.definitions["ANDROID_SDK_ROOT"] = self._read_env('ANDROID_SDK_ROOT')
- cmake.definitions["ANDROID_NDK_ROOT"] = self._read_env('ANDROID_NDK_ROOT')
-
- if self.settings.os == "iOS":
- # Instead of Conan's auto-added 'Darwin', explicitly pass 'iOS'.
- cmake.definitions["CMAKE_SYSTEM_NAME"] = "iOS"
-
- # Remove the explicit sysroot, let CMake detect the sysroots, to ensure
- # that multi-arch builds work.
- del cmake.definitions["CMAKE_OSX_SYSROOT"]
-
- # Remove the conan provided architecture, instead rely on the architectures set
- # by the Qt toolchain file, which with official Qt packages most likely means
- # multi-arch iOS.
- del cmake.definitions["CMAKE_OSX_ARCHITECTURES"]
-
- return cmake
-
- def build(self):
- cmake = self._get_cmake_tool()
- self.run('%s "%s" %s' % (self._get_qtcmake(), self.source_folder, cmake.command_line))
- self.run('cmake --build . %s' % cmake.build_config)
- return
-
- def package(self):
- install_dir = os.path.join(os.getcwd(), "_install_tmp") # see 'CMAKE_INSTALL_PREFIX' above
- self.run('cmake --build . --target install')
- self.copy("*", src=install_dir, dst=".")
-
- def package_info(self):
- self.cpp_info.libs = ["Qt6DataVisualization"] # used for the actual library filename, Ordered list with the library names
-
- def deploy(self):
- self.copy("*") # copy from current package
- self.copy_deps("*") # copy from dependencies
-
+ python_requires = f"qt-conan-common/{_get_qt_minor_version()}@qt/everywhere"
+ python_requires_extend = "qt-conan-common.QtLeafModule"
diff --git a/dependencies.yaml b/dependencies.yaml
index d913794e..0c5e8256 100644
--- a/dependencies.yaml
+++ b/dependencies.yaml
@@ -1,10 +1,10 @@
dependencies:
../qtbase:
- ref: 5d0542a356be1c47e2f99e6ba38b8e520ca0710c
+ ref: 326b91ea788b013512ae911c51cc19497d88916d
required: true
../qtdeclarative:
- ref: 5e01411c1e2d5c089586135120be6f15ac4d27e8
+ ref: 50196b622fb4714778e0a33daf0337e2130f08cd
required: false
../qtmultimedia:
- ref: 841c215eaa7d05a8ef326c9bf2631443e4cd06a0
+ ref: 6c3133a51d3c148f0c7681a89051d4203abcb1f0
required: false
diff --git a/examples/datavisualization/bars/CMakeLists.txt b/examples/datavisualization/bars/CMakeLists.txt
index 5388c565..5bc76255 100644
--- a/examples/datavisualization/bars/CMakeLists.txt
+++ b/examples/datavisualization/bars/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(bars LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/bars/graphmodifier.h b/examples/datavisualization/bars/graphmodifier.h
index b1420e33..4611cc43 100644
--- a/examples/datavisualization/bars/graphmodifier.h
+++ b/examples/datavisualization/bars/graphmodifier.h
@@ -77,7 +77,7 @@ Q_SIGNALS:
void shadowQualityChanged(int quality);
void backgroundEnabledChanged(bool enabled);
void gridEnabledChanged(bool enabled);
- void fontChanged(QFont font);
+ void fontChanged(const QFont &font);
void fontSizeChanged(int size);
private:
diff --git a/examples/datavisualization/custominput/CMakeLists.txt b/examples/datavisualization/custominput/CMakeLists.txt
index 94007d98..a9008ac1 100644
--- a/examples/datavisualization/custominput/CMakeLists.txt
+++ b/examples/datavisualization/custominput/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(custominput LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/customitems/CMakeLists.txt b/examples/datavisualization/customitems/CMakeLists.txt
index a415d170..54f64e25 100644
--- a/examples/datavisualization/customitems/CMakeLists.txt
+++ b/examples/datavisualization/customitems/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(customitems LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/customproxy/CMakeLists.txt b/examples/datavisualization/customproxy/CMakeLists.txt
index c93b4165..b1c3c661 100644
--- a/examples/datavisualization/customproxy/CMakeLists.txt
+++ b/examples/datavisualization/customproxy/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(customproxy LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/draggableaxes/CMakeLists.txt b/examples/datavisualization/draggableaxes/CMakeLists.txt
index 76fdba33..5728b70f 100644
--- a/examples/datavisualization/draggableaxes/CMakeLists.txt
+++ b/examples/datavisualization/draggableaxes/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(draggableaxes LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/itemmodel/CMakeLists.txt b/examples/datavisualization/itemmodel/CMakeLists.txt
index 2f35c1a3..4848fffb 100644
--- a/examples/datavisualization/itemmodel/CMakeLists.txt
+++ b/examples/datavisualization/itemmodel/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(itemmodel LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/qml3doscilloscope/CMakeLists.txt b/examples/datavisualization/qml3doscilloscope/CMakeLists.txt
index 7a50caa1..26ed3b19 100644
--- a/examples/datavisualization/qml3doscilloscope/CMakeLists.txt
+++ b/examples/datavisualization/qml3doscilloscope/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(qml3doscilloscope LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/qmlaxisdrag/CMakeLists.txt b/examples/datavisualization/qmlaxisdrag/CMakeLists.txt
index 7a2125b9..774c1210 100644
--- a/examples/datavisualization/qmlaxisdrag/CMakeLists.txt
+++ b/examples/datavisualization/qmlaxisdrag/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(qmlaxisdrag LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/qmlaxisformatter/CMakeLists.txt b/examples/datavisualization/qmlaxisformatter/CMakeLists.txt
index 54f23dde..3c4335b5 100644
--- a/examples/datavisualization/qmlaxisformatter/CMakeLists.txt
+++ b/examples/datavisualization/qmlaxisformatter/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(qmlaxisformatter LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/qmlbars/CMakeLists.txt b/examples/datavisualization/qmlbars/CMakeLists.txt
index 071c788c..6792b858 100644
--- a/examples/datavisualization/qmlbars/CMakeLists.txt
+++ b/examples/datavisualization/qmlbars/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(qmlbars LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/qmlbars/doc/images/qmlbars-example.png b/examples/datavisualization/qmlbars/doc/images/qmlbars-example.png
index c2ab2459..4230e4d9 100644
--- a/examples/datavisualization/qmlbars/doc/images/qmlbars-example.png
+++ b/examples/datavisualization/qmlbars/doc/images/qmlbars-example.png
Binary files differ
diff --git a/examples/datavisualization/qmlbars/qml/qmlbars/main.qml b/examples/datavisualization/qmlbars/qml/qmlbars/main.qml
index 76eff0f2..4a81df7e 100644
--- a/examples/datavisualization/qmlbars/qml/qmlbars/main.qml
+++ b/examples/datavisualization/qmlbars/qml/qmlbars/main.qml
@@ -357,6 +357,26 @@ Item {
}
//! [0]
}
+
+ Button {
+ id: marginToggle
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ text: "Use Margin"
+ clip: true
+
+ onClicked: {
+ if (text === "Use Margin") {
+ barGraph.barSeriesMargin = Qt.size(0.2, 0.2)
+ barGraph.barSpacing = Qt.size(0.0, 0.0)
+ text = "Use Spacing"
+ } else if (text === "Use Spacing") {
+ barGraph.barSeriesMargin = Qt.size(0.0, 0.0)
+ barGraph.barSpacing = Qt.size(0.5, 0.5)
+ text = "Use Margin"
+ }
+ }
+ }
}
states: [
diff --git a/examples/datavisualization/qmlcustominput/CMakeLists.txt b/examples/datavisualization/qmlcustominput/CMakeLists.txt
index 0e659e9e..f359d3fc 100644
--- a/examples/datavisualization/qmlcustominput/CMakeLists.txt
+++ b/examples/datavisualization/qmlcustominput/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(qmlcustominput LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/qmllegend/CMakeLists.txt b/examples/datavisualization/qmllegend/CMakeLists.txt
index 2c3f56f0..ed972f4b 100644
--- a/examples/datavisualization/qmllegend/CMakeLists.txt
+++ b/examples/datavisualization/qmllegend/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(qmllegend LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/qmlmultigraph/CMakeLists.txt b/examples/datavisualization/qmlmultigraph/CMakeLists.txt
index dae22cbd..388c5df2 100644
--- a/examples/datavisualization/qmlmultigraph/CMakeLists.txt
+++ b/examples/datavisualization/qmlmultigraph/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(qmlmultigraph LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/qmlscatter/CMakeLists.txt b/examples/datavisualization/qmlscatter/CMakeLists.txt
index 4f154bf2..65e5d2a7 100644
--- a/examples/datavisualization/qmlscatter/CMakeLists.txt
+++ b/examples/datavisualization/qmlscatter/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(qmlscatter LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/qmlscatter/qml/qmlscatter/main.qml b/examples/datavisualization/qmlscatter/qml/qmlscatter/main.qml
index 89863d84..a64538da 100644
--- a/examples/datavisualization/qmlscatter/qml/qmlscatter/main.qml
+++ b/examples/datavisualization/qmlscatter/qml/qmlscatter/main.qml
@@ -52,7 +52,6 @@ Item {
Theme3D {
id: themeIsabelle
type: Theme3D.ThemeIsabelle
- font.family: "Lucida Handwriting"
font.pointSize: 40
}
//! [13]
diff --git a/examples/datavisualization/qmlspectrogram/CMakeLists.txt b/examples/datavisualization/qmlspectrogram/CMakeLists.txt
index d0ac0515..ce86d5c1 100644
--- a/examples/datavisualization/qmlspectrogram/CMakeLists.txt
+++ b/examples/datavisualization/qmlspectrogram/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(qmlspectrogram LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/qmlsurface/CMakeLists.txt b/examples/datavisualization/qmlsurface/CMakeLists.txt
index e2d3bf33..c1a6459c 100644
--- a/examples/datavisualization/qmlsurface/CMakeLists.txt
+++ b/examples/datavisualization/qmlsurface/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(qmlsurface LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/qmlsurface/qml/qmlsurface/main.qml b/examples/datavisualization/qmlsurface/qml/qmlsurface/main.qml
index 2124346a..f128ac45 100644
--- a/examples/datavisualization/qmlsurface/qml/qmlsurface/main.qml
+++ b/examples/datavisualization/qmlsurface/qml/qmlsurface/main.qml
@@ -155,6 +155,26 @@ Rectangle {
}
Button {
+ id: surfaceGridColor
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ text: "Red surface grid color"
+ onClicked: {
+ if (Qt.colorEqual(surfaceSeries.wireFrameColor, "#000000")
+ && Qt.colorEqual(heightSeries.wireFrameColor, "#000000")) {
+ surfaceSeries.wireFrameColor = "red"
+ heightSeries.wireFrameColor = "red"
+ text = "Black surface grid color"
+ }
+ else {
+ surfaceSeries.wireFrameColor = "black"
+ heightSeries.wireFrameColor = "black"
+ text = "Red surface grid color"
+ }
+ }
+ }
+
+ Button {
id: surfaceToggle
Layout.fillWidth: true
Layout.fillHeight: true
diff --git a/examples/datavisualization/qmlsurfacelayers/CMakeLists.txt b/examples/datavisualization/qmlsurfacelayers/CMakeLists.txt
index 12c27085..d011aa03 100644
--- a/examples/datavisualization/qmlsurfacelayers/CMakeLists.txt
+++ b/examples/datavisualization/qmlsurfacelayers/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(qmlsurfacelayers LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/rotations/CMakeLists.txt b/examples/datavisualization/rotations/CMakeLists.txt
index d3333639..620d34b3 100644
--- a/examples/datavisualization/rotations/CMakeLists.txt
+++ b/examples/datavisualization/rotations/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(rotations LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/scatter/CMakeLists.txt b/examples/datavisualization/scatter/CMakeLists.txt
index 0dbedc1d..1b2e967f 100644
--- a/examples/datavisualization/scatter/CMakeLists.txt
+++ b/examples/datavisualization/scatter/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(scatter LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/scatter/scatterdatamodifier.h b/examples/datavisualization/scatter/scatterdatamodifier.h
index cbb14995..f79a46e9 100644
--- a/examples/datavisualization/scatter/scatterdatamodifier.h
+++ b/examples/datavisualization/scatter/scatterdatamodifier.h
@@ -63,7 +63,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:
QVector3D randVector();
diff --git a/examples/datavisualization/surface/CMakeLists.txt b/examples/datavisualization/surface/CMakeLists.txt
index 594c5988..8740d13e 100644
--- a/examples/datavisualization/surface/CMakeLists.txt
+++ b/examples/datavisualization/surface/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(surface LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/texturesurface/CMakeLists.txt b/examples/datavisualization/texturesurface/CMakeLists.txt
index ac8c7ed9..5da2e03e 100644
--- a/examples/datavisualization/texturesurface/CMakeLists.txt
+++ b/examples/datavisualization/texturesurface/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(texturesurface LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/examples/datavisualization/volumetric/CMakeLists.txt b/examples/datavisualization/volumetric/CMakeLists.txt
index e79fff49..577c1604 100644
--- a/examples/datavisualization/volumetric/CMakeLists.txt
+++ b/examples/datavisualization/volumetric/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14)
+cmake_minimum_required(VERSION 3.16)
project(volumetric LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/src/datavisualization/CMakeLists.txt b/src/datavisualization/CMakeLists.txt
index d0607248..ca75d284 100644
--- a/src/datavisualization/CMakeLists.txt
+++ b/src/datavisualization/CMakeLists.txt
@@ -91,6 +91,7 @@ qt_internal_add_module(DataVisualization
Qt::OpenGL
Qt::Qml
Qt::Quick
+ GENERATE_CPP_EXPORTS
)
set_source_files_properties("engine/meshes/arrowFlat.obj"
diff --git a/src/datavisualization/axis/qabstract3daxis.h b/src/datavisualization/axis/qabstract3daxis.h
index 0ff405dd..79af4377 100644
--- a/src/datavisualization/axis/qabstract3daxis.h
+++ b/src/datavisualization/axis/qabstract3daxis.h
@@ -39,7 +39,7 @@ QT_BEGIN_NAMESPACE
class QAbstract3DAxisPrivate;
-class QT_DATAVISUALIZATION_EXPORT QAbstract3DAxis : public QObject
+class Q_DATAVISUALIZATION_EXPORT QAbstract3DAxis : public QObject
{
Q_OBJECT
Q_ENUMS(AxisOrientation)
diff --git a/src/datavisualization/axis/qcategory3daxis.h b/src/datavisualization/axis/qcategory3daxis.h
index e394b4a3..d7fc8709 100644
--- a/src/datavisualization/axis/qcategory3daxis.h
+++ b/src/datavisualization/axis/qcategory3daxis.h
@@ -36,7 +36,7 @@ QT_BEGIN_NAMESPACE
class QCategory3DAxisPrivate;
-class QT_DATAVISUALIZATION_EXPORT QCategory3DAxis : public QAbstract3DAxis
+class Q_DATAVISUALIZATION_EXPORT QCategory3DAxis : public QAbstract3DAxis
{
Q_OBJECT
Q_PROPERTY(QStringList labels READ labels WRITE setLabels NOTIFY labelsChanged)
diff --git a/src/datavisualization/axis/qlogvalue3daxisformatter.h b/src/datavisualization/axis/qlogvalue3daxisformatter.h
index 8f0e67a5..cdfb157d 100644
--- a/src/datavisualization/axis/qlogvalue3daxisformatter.h
+++ b/src/datavisualization/axis/qlogvalue3daxisformatter.h
@@ -36,7 +36,7 @@ QT_BEGIN_NAMESPACE
class QLogValue3DAxisFormatterPrivate;
-class QT_DATAVISUALIZATION_EXPORT QLogValue3DAxisFormatter : public QValue3DAxisFormatter
+class Q_DATAVISUALIZATION_EXPORT QLogValue3DAxisFormatter : public QValue3DAxisFormatter
{
Q_OBJECT
diff --git a/src/datavisualization/axis/qvalue3daxis.h b/src/datavisualization/axis/qvalue3daxis.h
index b1fce675..50e61d0b 100644
--- a/src/datavisualization/axis/qvalue3daxis.h
+++ b/src/datavisualization/axis/qvalue3daxis.h
@@ -37,7 +37,7 @@ QT_BEGIN_NAMESPACE
class QValue3DAxisPrivate;
-class QT_DATAVISUALIZATION_EXPORT QValue3DAxis : public QAbstract3DAxis
+class Q_DATAVISUALIZATION_EXPORT QValue3DAxis : public QAbstract3DAxis
{
Q_OBJECT
Q_PROPERTY(int segmentCount READ segmentCount WRITE setSegmentCount NOTIFY segmentCountChanged)
diff --git a/src/datavisualization/axis/qvalue3daxisformatter.h b/src/datavisualization/axis/qvalue3daxisformatter.h
index 43a61fd8..658a4166 100644
--- a/src/datavisualization/axis/qvalue3daxisformatter.h
+++ b/src/datavisualization/axis/qvalue3daxisformatter.h
@@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE
class QValue3DAxisFormatterPrivate;
class QValue3DAxis;
-class QT_DATAVISUALIZATION_EXPORT QValue3DAxisFormatter : public QObject
+class Q_DATAVISUALIZATION_EXPORT QValue3DAxisFormatter : public QObject
{
Q_OBJECT
protected:
diff --git a/src/datavisualization/data/qabstract3dseries.h b/src/datavisualization/data/qabstract3dseries.h
index c9f355e1..73c95c50 100644
--- a/src/datavisualization/data/qabstract3dseries.h
+++ b/src/datavisualization/data/qabstract3dseries.h
@@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE
class QAbstract3DSeriesPrivate;
-class QT_DATAVISUALIZATION_EXPORT QAbstract3DSeries : public QObject
+class Q_DATAVISUALIZATION_EXPORT QAbstract3DSeries : public QObject
{
Q_OBJECT
Q_ENUMS(SeriesType)
diff --git a/src/datavisualization/data/qabstractdataproxy.h b/src/datavisualization/data/qabstractdataproxy.h
index 89d73bce..08fa4053 100644
--- a/src/datavisualization/data/qabstractdataproxy.h
+++ b/src/datavisualization/data/qabstractdataproxy.h
@@ -38,7 +38,7 @@ QT_BEGIN_NAMESPACE
class QAbstractDataProxyPrivate;
-class QT_DATAVISUALIZATION_EXPORT QAbstractDataProxy : public QObject
+class Q_DATAVISUALIZATION_EXPORT QAbstractDataProxy : public QObject
{
Q_OBJECT
Q_ENUMS(DataType)
diff --git a/src/datavisualization/data/qbar3dseries.cpp b/src/datavisualization/data/qbar3dseries.cpp
index afc3b3ba..1cd4c754 100644
--- a/src/datavisualization/data/qbar3dseries.cpp
+++ b/src/datavisualization/data/qbar3dseries.cpp
@@ -147,6 +147,18 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ * \qmlproperty list<ThemeColor> Bar3DSeries::rowColors
+ * \since 6.3
+ * This property can be used to draw the rows of the series in different colors.
+ * The \l{Theme3D::colorStyle}{Theme3D.colorStyle} must be set to
+ * \c ColorStyleUniform to use this property.
+ * \note If the property is set and the theme is changed,
+ * the rowColors list is not cleared automatically.
+ *
+ * \sa Q3DTheme::ColorStyleUniform
+ */
+
+/*!
* Constructsa bar 3D series with the parent \a parent.
*/
QBar3DSeries::QBar3DSeries(QObject *parent) :
@@ -282,6 +294,27 @@ float QBar3DSeries::meshAngle() const
}
/*!
+ * \property QBar3DSeries::rowColors
+ * \since 6.3
+ *
+ * \brief The list of row colors in the series.
+ *
+ * This property can be used to color
+ * the rows of the series in different colors.
+ * The Q3DTheme::ColorStyle must be set to
+ * Q3DTheme::ColorStyleUniform to use this property.
+ *
+ * \sa Q3DTheme::ColorStyleUniform
+ */
+void QBar3DSeries::setRowColors(const QList<QColor> &colors)
+{
+ dptr()->setRowColors(colors);
+}
+QList<QColor> QBar3DSeries::rowColors() const
+{
+ return dptrc()->m_rowColors;
+}
+/*!
* \internal
*/
QBar3DSeriesPrivate *QBar3DSeries::dptr()
@@ -355,6 +388,8 @@ void QBar3DSeriesPrivate::connectControllerAndProxy(Abstract3DController *newCon
&Bars3DController::handleDataColumnLabelsChanged);
QObject::connect(qptr(), &QBar3DSeries::dataProxyChanged, controller,
&Bars3DController::handleArrayReset);
+ QObject::connect(qptr(), &QBar3DSeries::rowColorsChanged, controller,
+ &Bars3DController::handleRowColorsChanged);
}
}
@@ -432,4 +467,12 @@ void QBar3DSeriesPrivate::connectSignals()
&QBar3DSeriesPrivate::handleMeshRotationChanged);
}
+void QBar3DSeriesPrivate::setRowColors(const QList<QColor> &colors)
+{
+ if (m_rowColors != colors) {
+ m_rowColors = colors;
+ emit qptr()->rowColorsChanged(m_rowColors);
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/datavisualization/data/qbar3dseries.h b/src/datavisualization/data/qbar3dseries.h
index c3a71205..a174f0f5 100644
--- a/src/datavisualization/data/qbar3dseries.h
+++ b/src/datavisualization/data/qbar3dseries.h
@@ -38,12 +38,13 @@ QT_BEGIN_NAMESPACE
class QBar3DSeriesPrivate;
-class QT_DATAVISUALIZATION_EXPORT QBar3DSeries : public QAbstract3DSeries
+class Q_DATAVISUALIZATION_EXPORT QBar3DSeries : public QAbstract3DSeries
{
Q_OBJECT
Q_PROPERTY(QBarDataProxy *dataProxy READ dataProxy WRITE setDataProxy NOTIFY dataProxyChanged)
Q_PROPERTY(QPoint selectedBar READ selectedBar WRITE setSelectedBar NOTIFY selectedBarChanged)
Q_PROPERTY(float meshAngle READ meshAngle WRITE setMeshAngle NOTIFY meshAngleChanged)
+ Q_PROPERTY(QList<QColor> rowColors READ rowColors WRITE setRowColors NOTIFY rowColorsChanged REVISION(6, 3))
public:
explicit QBar3DSeries(QObject *parent = nullptr);
@@ -60,10 +61,14 @@ public:
void setMeshAngle(float angle);
float meshAngle() const;
+ QList<QColor> rowColors() const;
+ void setRowColors(const QList<QColor> &colors);
+
Q_SIGNALS:
void dataProxyChanged(QBarDataProxy *proxy);
void selectedBarChanged(const QPoint &position);
void meshAngleChanged(float angle);
+ Q_REVISION(6, 3) void rowColorsChanged(const QList<QColor> &rowcolors);
protected:
QBar3DSeriesPrivate *dptr();
diff --git a/src/datavisualization/data/qbar3dseries_p.h b/src/datavisualization/data/qbar3dseries_p.h
index 0f5bb43a..cd94b7f4 100644
--- a/src/datavisualization/data/qbar3dseries_p.h
+++ b/src/datavisualization/data/qbar3dseries_p.h
@@ -62,11 +62,15 @@ public:
void connectSignals();
+ void setRowColors(const QList<QColor> &colors);
+
private:
QBar3DSeries *qptr();
QPoint m_selectedBar;
+ QList<QColor> m_rowColors;
+
private:
friend class QBar3DSeries;
};
diff --git a/src/datavisualization/data/qbardataitem.h b/src/datavisualization/data/qbardataitem.h
index 11a8e471..d287868c 100644
--- a/src/datavisualization/data/qbardataitem.h
+++ b/src/datavisualization/data/qbardataitem.h
@@ -36,7 +36,7 @@ QT_BEGIN_NAMESPACE
class QBarDataItemPrivate;
-class QT_DATAVISUALIZATION_EXPORT QBarDataItem
+class Q_DATAVISUALIZATION_EXPORT QBarDataItem
{
public:
QBarDataItem();
diff --git a/src/datavisualization/data/qbardataproxy.h b/src/datavisualization/data/qbardataproxy.h
index 80e5f063..daf9366e 100644
--- a/src/datavisualization/data/qbardataproxy.h
+++ b/src/datavisualization/data/qbardataproxy.h
@@ -45,7 +45,7 @@ class QBar3DSeries;
typedef QList<QBarDataItem> QBarDataRow;
typedef QList<QBarDataRow *> QBarDataArray;
-class QT_DATAVISUALIZATION_EXPORT QBarDataProxy : public QAbstractDataProxy
+class Q_DATAVISUALIZATION_EXPORT QBarDataProxy : public QAbstractDataProxy
{
Q_OBJECT
diff --git a/src/datavisualization/data/qcustom3ditem.h b/src/datavisualization/data/qcustom3ditem.h
index 8d6d905f..8e65a7f5 100644
--- a/src/datavisualization/data/qcustom3ditem.h
+++ b/src/datavisualization/data/qcustom3ditem.h
@@ -39,7 +39,7 @@ QT_BEGIN_NAMESPACE
class QCustom3DItemPrivate;
-class QT_DATAVISUALIZATION_EXPORT QCustom3DItem : public QObject
+class Q_DATAVISUALIZATION_EXPORT QCustom3DItem : public QObject
{
Q_OBJECT
Q_PROPERTY(QString meshFile READ meshFile WRITE setMeshFile NOTIFY meshFileChanged)
diff --git a/src/datavisualization/data/qcustom3dlabel.h b/src/datavisualization/data/qcustom3dlabel.h
index 9ca68fe9..768c3fbf 100644
--- a/src/datavisualization/data/qcustom3dlabel.h
+++ b/src/datavisualization/data/qcustom3dlabel.h
@@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE
class QCustom3DLabelPrivate;
-class QT_DATAVISUALIZATION_EXPORT QCustom3DLabel : public QCustom3DItem
+class Q_DATAVISUALIZATION_EXPORT QCustom3DLabel : public QCustom3DItem
{
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
diff --git a/src/datavisualization/data/qcustom3dvolume.h b/src/datavisualization/data/qcustom3dvolume.h
index 886019d0..16ecc714 100644
--- a/src/datavisualization/data/qcustom3dvolume.h
+++ b/src/datavisualization/data/qcustom3dvolume.h
@@ -39,7 +39,7 @@ QT_BEGIN_NAMESPACE
class QCustom3DVolumePrivate;
-class QT_DATAVISUALIZATION_EXPORT QCustom3DVolume : public QCustom3DItem
+class Q_DATAVISUALIZATION_EXPORT QCustom3DVolume : public QCustom3DItem
{
Q_OBJECT
Q_PROPERTY(int textureWidth READ textureWidth WRITE setTextureWidth NOTIFY textureWidthChanged)
diff --git a/src/datavisualization/data/qheightmapsurfacedataproxy.cpp b/src/datavisualization/data/qheightmapsurfacedataproxy.cpp
index fd4ffcbb..42ca6987 100644
--- a/src/datavisualization/data/qheightmapsurfacedataproxy.cpp
+++ b/src/datavisualization/data/qheightmapsurfacedataproxy.cpp
@@ -127,6 +127,32 @@ const float defaultMaxValue = 10.0f;
*/
/*!
+ * \qmlproperty real HeightMapSurfaceDataProxy::minYValue
+ * \since 6.3
+ *
+ * The minimum Y value for the generated surface points. Defaults to \c{0.0}.
+ * When setting this property the corresponding maximum value is adjusted if necessary,
+ * to ensure that the range remains valid.
+ */
+
+/*!
+ * \qmlproperty real HeightMapSurfaceDataProxy::maxYValue
+ * \since 6.3
+ *
+ * The maximum Y value for the generated surface points. Defaults to \c{10.0}.
+ * When setting this property the corresponding minimum value is adjusted if necessary,
+ * to ensure that the range remains valid.
+ */
+
+/*!
+ * \qmlproperty real HeightMapSurfaceDataProxy::autoScaleY
+ * \since 6.3
+ *
+ * Scale height values to Y-axis. Defaults to \c{false}. When this property is set to \c{true},
+ * the height values are scaled to fit on the Y-axis between \c{minYValue} and \c{maxYValue}.
+ */
+
+/*!
* Constructs QHeightMapSurfaceDataProxy with the given \a parent.
*/
QHeightMapSurfaceDataProxy::QHeightMapSurfaceDataProxy(QObject *parent) :
@@ -328,6 +354,75 @@ float QHeightMapSurfaceDataProxy::maxZValue() const
}
/*!
+ * \property QHeightMapSurfaceDataProxy::minYValue
+ * \since 6.3
+ *
+ * \brief The minimum Y value for the generated surface points.
+ *
+ * Defaults to \c{0.0}.
+ *
+ * When setting this property the corresponding maximum value is adjusted if necessary,
+ * to ensure that the range remains valid.
+ *
+ * \sa autoScaleY
+ */
+void QHeightMapSurfaceDataProxy::setMinYValue(float min)
+{
+ dptr()->setMinYValue(min);
+}
+
+float QHeightMapSurfaceDataProxy::minYValue() const
+{
+ return dptrc()->m_minYValue;
+}
+
+/*!
+ * \property QHeightMapSurfaceDataProxy::maxYValue
+ * \since 6.3
+ *
+ * \brief The maximum Y value for the generated surface points.
+ *
+ * Defaults to \c{10.0}.
+ *
+ * When setting this property the corresponding minimum value is adjusted if necessary,
+ * to ensure that the range remains valid.
+ *
+ * \sa autoScaleY
+ */
+void QHeightMapSurfaceDataProxy::setMaxYValue(float max)
+{
+ dptr()->setMaxYValue(max);
+}
+
+float QHeightMapSurfaceDataProxy::maxYValue() const
+{
+ return dptrc()->m_maxYValue;
+}
+
+/*!
+ * \property QHeightMapSurfaceDataProxy::autoScaleY
+ * \since 6.3
+ *
+ * \brief Scale height values to Y-axis.
+ *
+ * Defaults to \c{false}.
+ *
+ * When this property is set to \c{true},
+ * the height values are scaled to fit on the Y-axis between minYValue and maxYValue.
+ *
+ * \sa minYValue, maxYValue
+ */
+void QHeightMapSurfaceDataProxy::setAutoScaleY(bool enabled)
+{
+ dptr()->setAutoScaleY(enabled);
+}
+
+bool QHeightMapSurfaceDataProxy::autoScaleY() const
+{
+ return dptrc()->m_autoScaleY;
+}
+
+/*!
* \internal
*/
QHeightMapSurfaceDataProxyPrivate *QHeightMapSurfaceDataProxy::dptr()
@@ -350,7 +445,10 @@ QHeightMapSurfaceDataProxyPrivate::QHeightMapSurfaceDataProxyPrivate(QHeightMapS
m_minXValue(defaultMinValue),
m_maxXValue(defaultMaxValue),
m_minZValue(defaultMinValue),
- m_maxZValue(defaultMaxValue)
+ m_maxZValue(defaultMaxValue),
+ m_minYValue(defaultMinValue),
+ m_maxYValue(defaultMaxValue),
+ m_autoScaleY(false)
{
m_resolveTimer.setSingleShot(true);
QObject::connect(&m_resolveTimer, &QTimer::timeout,
@@ -505,20 +603,89 @@ void QHeightMapSurfaceDataProxyPrivate::setMaxZValue(float max)
}
}
+void QHeightMapSurfaceDataProxyPrivate::setMinYValue(float min)
+{
+ if (m_minYValue != min) {
+ bool maxChanged = false;
+ if (min >= m_maxYValue) {
+ float oldMax = m_maxYValue;
+ m_maxYValue = min + 1.0f;
+ qWarning() << "Warning: Tried to set minimum Y to equal or larger than maximum Y for"
+ " value range. Maximum automatically adjusted to a valid one:"
+ << oldMax << "-->" << m_maxYValue;
+ maxChanged = true;
+ }
+ m_minYValue = min;
+ emit qptr()->minYValueChanged(m_minYValue);
+ if (maxChanged)
+ emit qptr()->maxYValueChanged(m_maxYValue);
+
+ if (!m_resolveTimer.isActive())
+ m_resolveTimer.start(0);
+ }
+}
+
+void QHeightMapSurfaceDataProxyPrivate::setMaxYValue(float max)
+{
+ if (m_maxYValue != max) {
+ bool minChanged = false;
+ if (max <= m_minYValue) {
+ float oldMin = m_minYValue;
+ m_minYValue = max - 1.0f;
+ qWarning() << "Warning: Tried to set maximum Y to equal or smaller than minimum Y for"
+ " value range. Minimum automatically adjusted to a valid one:"
+ << oldMin << "-->" << m_minYValue;
+ minChanged = true;
+ }
+ m_maxYValue = max;
+ emit qptr()->maxYValueChanged(m_maxYValue);
+ if (minChanged)
+ emit qptr()->minYValueChanged(m_minYValue);
+
+ if (!m_resolveTimer.isActive())
+ m_resolveTimer.start(0);
+ }
+}
+
+void QHeightMapSurfaceDataProxyPrivate::setAutoScaleY(bool enabled)
+{
+ if (enabled != m_autoScaleY) {
+ m_autoScaleY = enabled;
+ emit qptr()->autoScaleYChanged(m_autoScaleY);
+
+ if (!m_resolveTimer.isActive())
+ m_resolveTimer.start(0);
+ }
+}
+
void QHeightMapSurfaceDataProxyPrivate::handlePendingResolve()
{
QImage heightImage = m_heightMap;
+ int bytesInChannel = 1;
+ float yMul = 1.0f / UINT8_MAX;
+
+ bool is16bit = (heightImage.format() == QImage::Format_RGBX64
+ || heightImage.format() == QImage::Format_RGBA64
+ || heightImage.format() == QImage::Format_RGBA64_Premultiplied
+ || heightImage.format() == QImage::Format_Grayscale16);
// Convert to RGB32 to be sure we're reading the right bytes
- if (heightImage.format() != QImage::Format_RGB32)
+ if (is16bit) {
+ if (heightImage.format() != QImage::Format_RGBX64)
+ heightImage = heightImage.convertToFormat(QImage::Format_RGBX64);
+
+ bytesInChannel = 2;
+ yMul = 1.0f / UINT16_MAX;
+ } else if (heightImage.format() != QImage::Format_RGB32) {
heightImage = heightImage.convertToFormat(QImage::Format_RGB32);
+ }
uchar *bits = heightImage.bits();
int imageHeight = heightImage.height();
int imageWidth = heightImage.width();
- int bitCount = imageWidth * 4 * (imageHeight - 1);
- int widthBits = imageWidth * 4;
+ int bitCount = imageWidth * 4 * (imageHeight - 1) * bytesInChannel;
+ int widthBits = imageWidth * 4 * bytesInChannel;
float height = 0;
// Do not recreate array if dimensions have not changed
@@ -531,7 +698,7 @@ void QHeightMapSurfaceDataProxyPrivate::handlePendingResolve()
dataArray->append(newProxyRow);
}
}
-
+ yMul *= m_maxYValue - m_minYValue;
float xMul = (m_maxXValue - m_minXValue) / float(imageWidth - 1);
float zMul = (m_maxZValue - m_minZValue) / float(imageHeight - 1);
@@ -541,7 +708,6 @@ void QHeightMapSurfaceDataProxyPrivate::handlePendingResolve()
// getting rendered.
int lastRow = imageHeight - 1;
int lastCol = imageWidth - 1;
-
if (heightImage.isGrayscale()) {
// Grayscale, it's enough to read Red byte
for (int i = 0; i < imageHeight; i++, bitCount -= widthBits) {
@@ -552,13 +718,21 @@ void QHeightMapSurfaceDataProxyPrivate::handlePendingResolve()
else
zVal = (float(i) * zMul) + m_minZValue;
int j = 0;
- for (; j < lastCol; j++)
+ float yVal = 0;
+ uchar *pixelptr;
+ for (; j < lastCol; j++) {
+ pixelptr = (uchar *)(bits + bitCount + (j * 4 * bytesInChannel));
+ if (!m_autoScaleY)
+ yVal = *pixelptr;
+ else
+ yVal = float(*pixelptr) * yMul + m_minYValue;
newRow[j].setPosition(QVector3D((float(j) * xMul) + m_minXValue,
- float(bits[bitCount + (j * 4)]),
- zVal));
+ yVal,
+ zVal));
+ }
newRow[j].setPosition(QVector3D(m_maxXValue,
- float(bits[bitCount + (j * 4)]),
- zVal));
+ yVal,
+ zVal));
}
} else {
// Not grayscale, we'll need to calculate height from RGB
@@ -570,22 +744,30 @@ void QHeightMapSurfaceDataProxyPrivate::handlePendingResolve()
else
zVal = (float(i) * zMul) + m_minZValue;
int j = 0;
- int nextpixel = 0;
+ float yVal = 0;
for (; j < lastCol; j++) {
- nextpixel = j * 4;
- height = (float(bits[bitCount + nextpixel])
- + float(bits[1 + bitCount + nextpixel])
- + float(bits[2 + bitCount + nextpixel]));
+ int nextpixel = j * 4 * bytesInChannel;
+ uchar *pixelptr = (uchar *)(bits + bitCount + nextpixel);
+ if (is16bit) {
+ height = float(*((ushort *)pixelptr))
+ + float(*(((ushort *)pixelptr) + 1))
+ + float(*(((ushort *)pixelptr) + 2));
+ } else {
+ height = (float(*pixelptr)
+ + float(*(pixelptr + 1))
+ + float(*(pixelptr + 2)));
+ }
+ if (!m_autoScaleY)
+ yVal = height / 3.0f;
+ else
+ yVal = (height / 3.0f * yMul) + m_minYValue;
+
newRow[j].setPosition(QVector3D((float(j) * xMul) + m_minXValue,
- height / 3.0f,
+ yVal,
zVal));
}
- nextpixel = j * 4;
- height = (float(bits[bitCount + nextpixel])
- + float(bits[1 + bitCount + nextpixel])
- + float(bits[2 + bitCount + nextpixel]));
newRow[j].setPosition(QVector3D(m_maxXValue,
- height / 3.0f,
+ yVal,
zVal));
}
}
diff --git a/src/datavisualization/data/qheightmapsurfacedataproxy.h b/src/datavisualization/data/qheightmapsurfacedataproxy.h
index f9f9a23c..a22cb685 100644
--- a/src/datavisualization/data/qheightmapsurfacedataproxy.h
+++ b/src/datavisualization/data/qheightmapsurfacedataproxy.h
@@ -38,7 +38,7 @@ QT_BEGIN_NAMESPACE
class QHeightMapSurfaceDataProxyPrivate;
-class QT_DATAVISUALIZATION_EXPORT QHeightMapSurfaceDataProxy : public QSurfaceDataProxy
+class Q_DATAVISUALIZATION_EXPORT QHeightMapSurfaceDataProxy : public QSurfaceDataProxy
{
Q_OBJECT
@@ -48,6 +48,9 @@ class QT_DATAVISUALIZATION_EXPORT QHeightMapSurfaceDataProxy : public QSurfaceDa
Q_PROPERTY(float maxXValue READ maxXValue WRITE setMaxXValue NOTIFY maxXValueChanged)
Q_PROPERTY(float minZValue READ minZValue WRITE setMinZValue NOTIFY minZValueChanged)
Q_PROPERTY(float maxZValue READ maxZValue WRITE setMaxZValue NOTIFY maxZValueChanged)
+ Q_PROPERTY(float minYValue READ minYValue WRITE setMinYValue NOTIFY minYValueChanged REVISION(6, 3))
+ Q_PROPERTY(float maxYValue READ maxYValue WRITE setMaxYValue NOTIFY maxYValueChanged REVISION(6, 3))
+ Q_PROPERTY(bool autoScaleY READ autoScaleY WRITE setAutoScaleY NOTIFY autoScaleYChanged REVISION(6, 3))
public:
explicit QHeightMapSurfaceDataProxy(QObject *parent = nullptr);
@@ -69,6 +72,12 @@ public:
float minZValue() const;
void setMaxZValue(float max);
float maxZValue() const;
+ void setMinYValue(float min);
+ float minYValue() const;
+ void setMaxYValue(float max);
+ float maxYValue() const;
+ void setAutoScaleY(bool enabled);
+ bool autoScaleY() const;
Q_SIGNALS:
void heightMapChanged(const QImage &image);
@@ -77,6 +86,9 @@ Q_SIGNALS:
void maxXValueChanged(float value);
void minZValueChanged(float value);
void maxZValueChanged(float value);
+ Q_REVISION(6, 3) void minYValueChanged(float value);
+ Q_REVISION(6, 3) void maxYValueChanged(float value);
+ Q_REVISION(6, 3) void autoScaleYChanged(bool enabled);
protected:
explicit QHeightMapSurfaceDataProxy(QHeightMapSurfaceDataProxyPrivate *d, QObject *parent = nullptr);
diff --git a/src/datavisualization/data/qheightmapsurfacedataproxy_p.h b/src/datavisualization/data/qheightmapsurfacedataproxy_p.h
index 7dc2f41d..091291ed 100644
--- a/src/datavisualization/data/qheightmapsurfacedataproxy_p.h
+++ b/src/datavisualization/data/qheightmapsurfacedataproxy_p.h
@@ -59,6 +59,9 @@ public:
void setMaxXValue(float max);
void setMinZValue(float min);
void setMaxZValue(float max);
+ void setMinYValue(float min);
+ void setMaxYValue(float max);
+ void setAutoScaleY(bool enabled);
private:
QHeightMapSurfaceDataProxy *qptr();
void handlePendingResolve();
@@ -71,6 +74,9 @@ private:
float m_maxXValue;
float m_minZValue;
float m_maxZValue;
+ float m_minYValue;
+ float m_maxYValue;
+ bool m_autoScaleY;
friend class QHeightMapSurfaceDataProxy;
};
diff --git a/src/datavisualization/data/qitemmodelbardataproxy.h b/src/datavisualization/data/qitemmodelbardataproxy.h
index 501d77fe..7340fa82 100644
--- a/src/datavisualization/data/qitemmodelbardataproxy.h
+++ b/src/datavisualization/data/qitemmodelbardataproxy.h
@@ -38,7 +38,7 @@ QT_BEGIN_NAMESPACE
class QItemModelBarDataProxyPrivate;
-class QT_DATAVISUALIZATION_EXPORT QItemModelBarDataProxy : public QBarDataProxy
+class Q_DATAVISUALIZATION_EXPORT QItemModelBarDataProxy : public QBarDataProxy
{
Q_OBJECT
Q_ENUMS(MultiMatchBehavior)
diff --git a/src/datavisualization/data/qitemmodelscatterdataproxy.h b/src/datavisualization/data/qitemmodelscatterdataproxy.h
index 5d66b12e..6cabcb01 100644
--- a/src/datavisualization/data/qitemmodelscatterdataproxy.h
+++ b/src/datavisualization/data/qitemmodelscatterdataproxy.h
@@ -39,7 +39,7 @@ QT_BEGIN_NAMESPACE
class QItemModelScatterDataProxyPrivate;
-class QT_DATAVISUALIZATION_EXPORT QItemModelScatterDataProxy : public QScatterDataProxy
+class Q_DATAVISUALIZATION_EXPORT QItemModelScatterDataProxy : public QScatterDataProxy
{
Q_OBJECT
Q_PROPERTY(QAbstractItemModel* itemModel READ itemModel WRITE setItemModel NOTIFY itemModelChanged)
diff --git a/src/datavisualization/data/qitemmodelsurfacedataproxy.h b/src/datavisualization/data/qitemmodelsurfacedataproxy.h
index 7a3abbb9..b0128777 100644
--- a/src/datavisualization/data/qitemmodelsurfacedataproxy.h
+++ b/src/datavisualization/data/qitemmodelsurfacedataproxy.h
@@ -39,7 +39,7 @@ QT_BEGIN_NAMESPACE
class QItemModelSurfaceDataProxyPrivate;
-class QT_DATAVISUALIZATION_EXPORT QItemModelSurfaceDataProxy : public QSurfaceDataProxy
+class Q_DATAVISUALIZATION_EXPORT QItemModelSurfaceDataProxy : public QSurfaceDataProxy
{
Q_OBJECT
Q_ENUMS(MultiMatchBehavior)
diff --git a/src/datavisualization/data/qscatter3dseries.h b/src/datavisualization/data/qscatter3dseries.h
index e94aed85..62efebc6 100644
--- a/src/datavisualization/data/qscatter3dseries.h
+++ b/src/datavisualization/data/qscatter3dseries.h
@@ -37,7 +37,7 @@ QT_BEGIN_NAMESPACE
class QScatter3DSeriesPrivate;
-class QT_DATAVISUALIZATION_EXPORT QScatter3DSeries : public QAbstract3DSeries
+class Q_DATAVISUALIZATION_EXPORT QScatter3DSeries : public QAbstract3DSeries
{
Q_OBJECT
Q_PROPERTY(QScatterDataProxy *dataProxy READ dataProxy WRITE setDataProxy NOTIFY dataProxyChanged)
diff --git a/src/datavisualization/data/qscatterdataitem.h b/src/datavisualization/data/qscatterdataitem.h
index 6fe749d0..ea1d81a6 100644
--- a/src/datavisualization/data/qscatterdataitem.h
+++ b/src/datavisualization/data/qscatterdataitem.h
@@ -37,7 +37,7 @@ QT_BEGIN_NAMESPACE
class QScatterDataItemPrivate;
-class QT_DATAVISUALIZATION_EXPORT QScatterDataItem
+class Q_DATAVISUALIZATION_EXPORT QScatterDataItem
{
public:
QScatterDataItem();
diff --git a/src/datavisualization/data/qscatterdataproxy.h b/src/datavisualization/data/qscatterdataproxy.h
index 790e37c3..8fd0f695 100644
--- a/src/datavisualization/data/qscatterdataproxy.h
+++ b/src/datavisualization/data/qscatterdataproxy.h
@@ -42,7 +42,7 @@ class QScatter3DSeries;
typedef QList<QScatterDataItem> QScatterDataArray;
-class QT_DATAVISUALIZATION_EXPORT QScatterDataProxy : public QAbstractDataProxy
+class Q_DATAVISUALIZATION_EXPORT QScatterDataProxy : public QAbstractDataProxy
{
Q_OBJECT
diff --git a/src/datavisualization/data/qsurface3dseries.cpp b/src/datavisualization/data/qsurface3dseries.cpp
index 94241dbc..f3e8e1fa 100644
--- a/src/datavisualization/data/qsurface3dseries.cpp
+++ b/src/datavisualization/data/qsurface3dseries.cpp
@@ -165,6 +165,12 @@ QT_BEGIN_NAMESPACE
* file name is set.
*/
+/*!
+ * \qmlproperty color Surface3DSeries::wireFrameColor
+ * \since 6.3
+ *
+ * The color used to draw the gridlines of the surface wireframe.
+ */
/*!
* \enum QSurface3DSeries::DrawFlag
@@ -399,6 +405,24 @@ QString QSurface3DSeries::textureFile() const
}
/*!
+ * \property QSurface3DSeries::wireFrameColor
+ * \since 6.3
+ *
+ * \brief The color for the surface wireframe.
+ */
+void QSurface3DSeries::setWireFrameColor(const QColor &color)
+{
+ if (dptr()->m_wireFrameColor != color) {
+ dptr()->setWireFrameColor(color);
+ emit wireFrameColorChanged(color);
+ }
+}
+
+QColor QSurface3DSeries::wireFrameColor() const
+{
+ return dptrc()->m_wireFrameColor;
+}
+/*!
* \internal
*/
QSurface3DSeriesPrivate *QSurface3DSeries::dptr()
@@ -420,7 +444,8 @@ QSurface3DSeriesPrivate::QSurface3DSeriesPrivate(QSurface3DSeries *q)
: QAbstract3DSeriesPrivate(q, QAbstract3DSeries::SeriesTypeSurface),
m_selectedPoint(Surface3DController::invalidSelectionPosition()),
m_flatShadingEnabled(true),
- m_drawMode(QSurface3DSeries::DrawSurfaceAndWireframe)
+ m_drawMode(QSurface3DSeries::DrawSurfaceAndWireframe),
+ m_wireFrameColor(Qt::black)
{
m_itemLabelFormat = QStringLiteral("@xLabel, @yLabel, @zLabel");
m_mesh = QAbstract3DSeries::MeshSphere;
@@ -553,4 +578,11 @@ void QSurface3DSeriesPrivate::setTexture(const QImage &texture)
static_cast<Surface3DController *>(m_controller)->updateSurfaceTexture(qptr());
}
+void QSurface3DSeriesPrivate::setWireFrameColor(const QColor &color)
+{
+ m_wireFrameColor = color;
+ if (m_controller)
+ m_controller->markSeriesVisualsDirty();
+}
+
QT_END_NAMESPACE
diff --git a/src/datavisualization/data/qsurface3dseries.h b/src/datavisualization/data/qsurface3dseries.h
index eadc6622..508cbba0 100644
--- a/src/datavisualization/data/qsurface3dseries.h
+++ b/src/datavisualization/data/qsurface3dseries.h
@@ -37,7 +37,7 @@ QT_BEGIN_NAMESPACE
class QSurface3DSeriesPrivate;
-class QT_DATAVISUALIZATION_EXPORT QSurface3DSeries : public QAbstract3DSeries
+class Q_DATAVISUALIZATION_EXPORT QSurface3DSeries : public QAbstract3DSeries
{
Q_OBJECT
Q_FLAGS(DrawFlag DrawFlags)
@@ -48,6 +48,7 @@ class QT_DATAVISUALIZATION_EXPORT QSurface3DSeries : public QAbstract3DSeries
Q_PROPERTY(DrawFlags drawMode READ drawMode WRITE setDrawMode NOTIFY drawModeChanged)
Q_PROPERTY(QImage texture READ texture WRITE setTexture NOTIFY textureChanged)
Q_PROPERTY(QString textureFile READ textureFile WRITE setTextureFile NOTIFY textureFileChanged)
+ Q_PROPERTY(QColor wireFrameColor READ wireFrameColor WRITE setWireFrameColor NOTIFY wireFrameColorChanged REVISION(6, 3))
public:
enum DrawFlag {
@@ -81,6 +82,9 @@ public:
void setTextureFile(const QString &filename);
QString textureFile() const;
+ void setWireFrameColor(const QColor &color);
+ QColor wireFrameColor() const;
+
Q_SIGNALS:
void dataProxyChanged(QSurfaceDataProxy *proxy);
void selectedPointChanged(const QPoint &position);
@@ -89,6 +93,7 @@ Q_SIGNALS:
void drawModeChanged(QSurface3DSeries::DrawFlags mode);
void textureChanged(const QImage &image);
void textureFileChanged(const QString &filename);
+ Q_REVISION(6, 3) void wireFrameColorChanged(const QColor &color);
protected:
explicit QSurface3DSeries(QSurface3DSeriesPrivate *d, QObject *parent = nullptr);
diff --git a/src/datavisualization/data/qsurface3dseries_p.h b/src/datavisualization/data/qsurface3dseries_p.h
index 16a8cb23..3b35cd22 100644
--- a/src/datavisualization/data/qsurface3dseries_p.h
+++ b/src/datavisualization/data/qsurface3dseries_p.h
@@ -60,6 +60,7 @@ public:
void setFlatShadingEnabled(bool enabled);
void setDrawMode(QSurface3DSeries::DrawFlags mode);
void setTexture(const QImage &texture);
+ void setWireFrameColor(const QColor &color);
private:
QSurface3DSeries *qptr();
@@ -69,6 +70,7 @@ private:
QSurface3DSeries::DrawFlags m_drawMode;
QImage m_texture;
QString m_textureFile;
+ QColor m_wireFrameColor;
private:
friend class QSurface3DSeries;
diff --git a/src/datavisualization/data/qsurfacedataitem.h b/src/datavisualization/data/qsurfacedataitem.h
index a4685e3d..6670bc20 100644
--- a/src/datavisualization/data/qsurfacedataitem.h
+++ b/src/datavisualization/data/qsurfacedataitem.h
@@ -37,7 +37,7 @@ QT_BEGIN_NAMESPACE
class QSurfaceDataItemPrivate;
-class QT_DATAVISUALIZATION_EXPORT QSurfaceDataItem
+class Q_DATAVISUALIZATION_EXPORT QSurfaceDataItem
{
public:
QSurfaceDataItem();
diff --git a/src/datavisualization/data/qsurfacedataproxy.cpp b/src/datavisualization/data/qsurfacedataproxy.cpp
index 7601d021..c9c6425d 100644
--- a/src/datavisualization/data/qsurfacedataproxy.cpp
+++ b/src/datavisualization/data/qsurfacedataproxy.cpp
@@ -552,9 +552,11 @@ void QSurfaceDataProxyPrivate::limitValues(QVector3D &minValues, QVector3D &maxV
float itemValue = m_dataArray->at(i)->at(j).y();
if (qIsNaN(itemValue) || qIsInf(itemValue))
continue;
- if (min > itemValue && isValidValue(itemValue, axisY))
+ if ((min > itemValue || (qIsNaN(min) || qIsInf(min)))
+ && isValidValue(itemValue, axisY)) {
min = itemValue;
- if (max < itemValue)
+ }
+ if (max < itemValue || (qIsNaN(max) || qIsInf(max)))
max = itemValue;
}
}
@@ -569,33 +571,59 @@ void QSurfaceDataProxyPrivate::limitValues(QVector3D &minValues, QVector3D &maxV
float xHigh = m_dataArray->at(0)->last().x();
float zLow = m_dataArray->at(0)->at(0).z();
float zHigh = m_dataArray->last()->at(0).z();
- for (int i = 0; i < columns; i++) {
- float zItemValue = m_dataArray->at(0)->at(i).z();
- if (qIsNaN(zItemValue) || qIsInf(zItemValue))
- continue;
- else if (isValidValue(zItemValue, axisZ))
- zLow = qMin(zLow,zItemValue);
+ for (int i = 0; i < rows; i++) {
+ for (int j = 0; j < columns; j++) {
+ float zItemValue = m_dataArray->at(i)->at(j).z();
+ if (qIsNaN(zItemValue) || qIsInf(zItemValue))
+ continue;
+ else if (isValidValue(zItemValue, axisZ))
+ zLow = qMin(zLow,zItemValue);
+ }
+ if (!qIsNaN(zLow) && !qIsInf(zLow))
+ break;
}
- for (int i = 0; i < columns; i++) {
- float zItemValue = m_dataArray->last()->at(i).z();
- if (qIsNaN(zItemValue) || qIsInf(zItemValue))
- continue;
- else if (isValidValue(zItemValue, axisZ))
- zHigh = qMax(zHigh, zItemValue);
+ for (int i = rows - 1; i >= 0; i--) {
+ for (int j = 0; j < columns; j++) {
+ float zItemValue = m_dataArray->at(i)->at(j).z();
+ if (qIsNaN(zItemValue) || qIsInf(zItemValue))
+ continue;
+ else if (isValidValue(zItemValue, axisZ))
+ {
+ if (!qIsNaN(zHigh) && !qIsInf(zHigh))
+ zHigh = qMax(zHigh, zItemValue);
+ else
+ zHigh = zItemValue;
+ }
+ }
+ if (!qIsNaN(zHigh) && !qIsInf(zHigh))
+ break;
}
- for (int i = 0; i < rows; i++) {
- float xItemValue = m_dataArray->at(i)->at(0).x();
- if (qIsNaN(xItemValue) || qIsInf(xItemValue))
- continue;
- else if (isValidValue(xItemValue, axisX))
- xLow = qMin(xLow, xItemValue);
+ for (int j = 0; j<columns; j++){
+ for (int i = 0; i < rows; i++) {
+ float xItemValue = m_dataArray->at(i)->at(j).x();
+ if (qIsNaN(xItemValue) || qIsInf(xItemValue))
+ continue;
+ else if (isValidValue(xItemValue, axisX))
+ xLow = qMin(xLow, xItemValue);
+ }
+ if (!qIsNaN(xLow) && !qIsInf(xLow))
+ break;
}
- for (int i = 0; i < rows; i++) {
- float xItemValue = m_dataArray->at(i)->last().x();
- if (qIsNaN(xItemValue) || qIsInf(xItemValue))
- continue;
- else if (isValidValue(xItemValue, axisX))
- xHigh = qMax(xHigh, xItemValue);
+ for (int j = columns-1; j >= 0; j--){
+ for (int i = 0; i < rows; i++) {
+ float xItemValue = m_dataArray->at(i)->at(j).x();
+ if (qIsNaN(xItemValue) || qIsInf(xItemValue))
+ continue;
+ else if (isValidValue(xItemValue, axisX))
+ {
+ if (!qIsNaN(xHigh) && !qIsInf(xHigh))
+ xHigh = qMax(xHigh, xItemValue);
+ else
+ xHigh = xItemValue;
+ }
+ }
+ if (!qIsNaN(xHigh) && !qIsInf(xHigh))
+ break;
}
minValues.setX(xLow);
minValues.setZ(zLow);
diff --git a/src/datavisualization/data/qsurfacedataproxy.h b/src/datavisualization/data/qsurfacedataproxy.h
index 0b652d97..769b1fe8 100644
--- a/src/datavisualization/data/qsurfacedataproxy.h
+++ b/src/datavisualization/data/qsurfacedataproxy.h
@@ -43,7 +43,7 @@ class QSurface3DSeries;
typedef QList<QSurfaceDataItem> QSurfaceDataRow;
typedef QList<QSurfaceDataRow *> QSurfaceDataArray;
-class QT_DATAVISUALIZATION_EXPORT QSurfaceDataProxy : public QAbstractDataProxy
+class Q_DATAVISUALIZATION_EXPORT QSurfaceDataProxy : public QAbstractDataProxy
{
Q_OBJECT
diff --git a/src/datavisualization/doc/qtdatavis3d.qdocconf b/src/datavisualization/doc/qtdatavis3d.qdocconf
index bc4690ad..cbbcee61 100644
--- a/src/datavisualization/doc/qtdatavis3d.qdocconf
+++ b/src/datavisualization/doc/qtdatavis3d.qdocconf
@@ -1,7 +1,7 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/config/exampleurl-qtdatavis3d.qdocconf)
-project = QtDataVisualization
+project = QtDataVis3D
description = Qt Data Visualization Reference Documentation
version = $QT_VERSION
buildversion = Qt Data Visualization | Commercial or GPLv3
@@ -25,9 +25,6 @@ qhp.QtDataVisualization.virtualFolder = qtdatavisualization
qhp.QtDataVisualization.indexTitle = Qt Data Visualization
qhp.QtDataVisualization.indexRoot =
-qhp.QtDataVisualization.filterAttributes = qtdatavisualization $QT_VERSION qtrefdoc
-qhp.QtDataVisualization.customFilters.Qt.name = QtDataVisualization $QT_VERSION
-qhp.QtDataVisualization.customFilters.Qt.filterAttributes = qtdatavisualization $QT_VERSION
qhp.QtDataVisualization.subprojects = gettingstarted examples classes types
qhp.QtDataVisualization.subprojects.gettingstarted.title = Getting Started
qhp.QtDataVisualization.subprojects.gettingstarted.indexTitle = Qt Data Visualization Getting Started
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-abstractdeclarative.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-abstractdeclarative.qdoc
index df2143a3..9f9dd6e1 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-abstractdeclarative.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-abstractdeclarative.qdoc
@@ -190,6 +190,12 @@
*/
/*!
+ * \qmlmethod bool AbstractGraph3D::hasSeries(Abstract3DSeries series)
+ * \since 6.3
+ * Returns whether the \a series has already been added to the graph.
+ */
+
+/*!
* \qmlmethod int AbstractGraph3D::addCustomItem(Custom3DItem item)
*
* Adds a Custom3DItem \a item to the graph. Graph takes ownership of the added item.
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc
index 9fd5107c..437f2f6f 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc
@@ -108,6 +108,14 @@
*/
/*!
+ * \qmlproperty size Bars3D::barSeriesMargin
+ * \since 6.3
+ *
+ * Margin between series columns in X and Z dimensions. Preset to \c {(0.0, 0.0)} by default.
+ * Sensible values are on the range [0,1).
+ */
+
+/*!
* \qmlproperty Bar3DSeries Bars3D::selectedSeries
* The selected series or \c null. If \l {QAbstract3DGraph::selectionMode}{selectionMode} has
* the \c SelectionMultiSeries flag set, this property holds the series that
@@ -156,11 +164,13 @@
* generate the row or column labels on the axes in cases where the labels are not explicitly set
* to the axes. If the newly added series has specified a selected bar, it will be highlighted and
* any existing selection will be cleared. Only one added series can have an active selection.
+ * \sa AbstractGraph3D::hasSeries()
*/
/*!
* \qmlmethod void Bars3D::removeSeries(Bar3DSeries series)
* Remove the \a series from the graph.
+ * \sa AbstractGraph3D::hasSeries()
*/
/*!
@@ -171,4 +181,5 @@
* \note When moving a series to a new \a index that is after its old index,
* the new position in list is calculated as if the series was still in its old
* index, so the final index is actually the \a index decremented by one.
+ * \sa AbstractGraph3D::hasSeries()
*/
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc
index 78350c78..8a5ce9d8 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc
@@ -97,9 +97,11 @@
* Adds the \a series to the graph. A graph can contain multiple series, but has only one set of
* axes. If the newly added series has specified a selected item, it will be highlighted and
* any existing selection will be cleared. Only one added series can have an active selection.
+ * \sa AbstractGraph3D::hasSeries()
*/
/*!
* \qmlmethod void Scatter3D::removeSeries(Scatter3DSeries series)
* Remove the \a series from the graph.
+ * \sa AbstractGraph3D::hasSeries()
*/
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc
index f494edba..c3daca2a 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc
@@ -108,9 +108,11 @@
/*!
* \qmlmethod void Surface3D::addSeries(Surface3DSeries series)
* Adds the \a series to the graph.
+ * \sa AbstractGraph3D::hasSeries()
*/
/*!
* \qmlmethod void Surface3D::removeSeries(Surface3DSeries series)
* Removes the \a series from the graph.
+ * \sa AbstractGraph3D::hasSeries()
*/
diff --git a/src/datavisualization/engine/abstract3dcontroller.cpp b/src/datavisualization/engine/abstract3dcontroller.cpp
index 5ed62ca9..22d39e4a 100644
--- a/src/datavisualization/engine/abstract3dcontroller.cpp
+++ b/src/datavisualization/engine/abstract3dcontroller.cpp
@@ -179,6 +179,11 @@ void Abstract3DController::removeSeries(QAbstract3DSeries *series)
}
}
+bool Abstract3DController::hasSeries(QAbstract3DSeries *series)
+{
+ return m_seriesList.contains(series);
+}
+
QList<QAbstract3DSeries *> Abstract3DController::seriesList()
{
return m_seriesList;
diff --git a/src/datavisualization/engine/abstract3dcontroller_p.h b/src/datavisualization/engine/abstract3dcontroller_p.h
index 2aee01ef..30514fb2 100644
--- a/src/datavisualization/engine/abstract3dcontroller_p.h
+++ b/src/datavisualization/engine/abstract3dcontroller_p.h
@@ -165,7 +165,7 @@ struct Abstract3DChangeBitField {
}
};
-class QT_DATAVISUALIZATION_EXPORT Abstract3DController : public QObject
+class Q_DATAVISUALIZATION_EXPORT Abstract3DController : public QObject
{
Q_OBJECT
@@ -243,6 +243,7 @@ public:
virtual void addSeries(QAbstract3DSeries *series);
virtual void insertSeries(int index, QAbstract3DSeries *series);
virtual void removeSeries(QAbstract3DSeries *series);
+ virtual bool hasSeries(QAbstract3DSeries *series);
QList<QAbstract3DSeries *> seriesList();
virtual void setAxisX(QAbstract3DAxis *axis);
diff --git a/src/datavisualization/engine/bars3dcontroller.cpp b/src/datavisualization/engine/bars3dcontroller.cpp
index 2a007360..b5910c8e 100644
--- a/src/datavisualization/engine/bars3dcontroller.cpp
+++ b/src/datavisualization/engine/bars3dcontroller.cpp
@@ -49,6 +49,7 @@ Bars3DController::Bars3DController(QRect boundRect, Q3DScene *scene)
m_barThicknessRatio(1.0f),
m_barSpacing(QSizeF(1.0, 1.0)),
m_floorLevel(0.0f),
+ m_barSeriesMargin(0.0f, 0.0f),
m_renderer(0)
{
// Setting a null axis creates a new default axis according to orientation and graph type.
@@ -108,6 +109,11 @@ void Bars3DController::synchDataToRenderer()
m_changeTracker.floorLevelChanged = false;
}
+ if (m_changeTracker.barSeriesMarginChanged) {
+ m_renderer->updateBarSeriesMargin(m_barSeriesMargin);
+ m_changeTracker.barSeriesMarginChanged = false;
+ }
+
Abstract3DController::synchDataToRenderer();
// Notify changes to renderer
@@ -322,6 +328,11 @@ void Bars3DController::handleDataColumnLabelsChanged()
}
}
+void Bars3DController::handleRowColorsChanged()
+{
+ emitNeedRender();
+}
+
void Bars3DController::handleAxisAutoAdjustRangeChangedInOrientation(
QAbstract3DAxis::AxisOrientation orientation, bool autoAdjust)
{
@@ -510,6 +521,18 @@ QSizeF Bars3DController::barSpacing()
return m_barSpacing;
}
+void Bars3DController::setBarSeriesMargin(const QSizeF &margin)
+{
+ m_barSeriesMargin = margin;
+ m_changeTracker.barSeriesMarginChanged = true;
+ emitNeedRender();
+}
+
+QSizeF Bars3DController::barSeriesMargin()
+{
+ return m_barSeriesMargin;
+}
+
bool Bars3DController::isBarSpecRelative()
{
return m_isBarSpecRelative;
diff --git a/src/datavisualization/engine/bars3dcontroller_p.h b/src/datavisualization/engine/bars3dcontroller_p.h
index e57263a1..fb028e92 100644
--- a/src/datavisualization/engine/bars3dcontroller_p.h
+++ b/src/datavisualization/engine/bars3dcontroller_p.h
@@ -55,6 +55,7 @@ struct Bars3DChangeBitField {
bool rowsChanged : 1;
bool itemChanged : 1;
bool floorLevelChanged : 1;
+ bool barSeriesMarginChanged : 1;
Bars3DChangeBitField() :
multiSeriesScalingChanged(true),
@@ -62,12 +63,13 @@ struct Bars3DChangeBitField {
selectedBarChanged(true),
rowsChanged(false),
itemChanged(false),
- floorLevelChanged(false)
+ floorLevelChanged(false),
+ barSeriesMarginChanged(false)
{
}
};
-class QT_DATAVISUALIZATION_EXPORT Bars3DController : public Abstract3DController
+class Q_DATAVISUALIZATION_EXPORT Bars3DController : public Abstract3DController
{
Q_OBJECT
@@ -98,6 +100,7 @@ private:
GLfloat m_barThicknessRatio;
QSizeF m_barSpacing;
float m_floorLevel;
+ QSizeF m_barSeriesMargin;
// Rendering
Bars3DRenderer *m_renderer;
@@ -118,6 +121,9 @@ public:
void setBarSpecs(GLfloat thicknessRatio = 1.0f,
const QSizeF &spacing = QSizeF(1.0, 1.0),
bool relative = true);
+ void setBarSeriesMargin(const QSizeF &margin);
+ QSizeF barSeriesMargin();
+
GLfloat barThickness();
QSizeF barSpacing();
bool isBarSpecRelative();
@@ -159,6 +165,7 @@ public Q_SLOTS:
void handleItemChanged(int rowIndex, int columnIndex);
void handleDataRowLabelsChanged();
void handleDataColumnLabelsChanged();
+ void handleRowColorsChanged();
Q_SIGNALS:
void primarySeriesChanged(QBar3DSeries *series);
diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp
index 3f36f8d1..a0c58b45 100644
--- a/src/datavisualization/engine/bars3drenderer.cpp
+++ b/src/datavisualization/engine/bars3drenderer.cpp
@@ -49,6 +49,7 @@ Bars3DRenderer::Bars3DRenderer(Bars3DController *controller)
m_cachedIsSlicingActivated(false),
m_cachedRowCount(0),
m_cachedColumnCount(0),
+ m_cachedBarSeriesMargin(0.0f, 0.0f),
m_selectedBar(0),
m_sliceCache(0),
m_sliceTitleItem(0),
@@ -198,7 +199,8 @@ void Bars3DRenderer::updateData()
m_seriesScaleX = 1.0f / float(m_visibleSeriesCount);
m_seriesStep = 1.0f / float(m_visibleSeriesCount);
- m_seriesStart = -((float(m_visibleSeriesCount) - 1.0f) / 2.0f) * m_seriesStep;
+ m_seriesStart = -((float(m_visibleSeriesCount) - 1.0f) / 2.0f)
+ * (m_seriesStep - (m_seriesStep * m_cachedBarSeriesMargin.width()));
if (m_keepSeriesUniform)
m_seriesScaleZ = m_seriesScaleX;
@@ -1077,7 +1079,9 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
foreach (SeriesRenderCache *baseCache, m_renderCacheList) {
if (baseCache->isVisible()) {
BarSeriesRenderCache *cache = static_cast<BarSeriesRenderCache *>(baseCache);
- float seriesPos = m_seriesStart + m_seriesStep * cache->visualIndex() + 0.5f;
+ float seriesPos = m_seriesStart + m_seriesStep
+ * (cache->visualIndex() - (cache->visualIndex()
+ * m_cachedBarSeriesMargin.width())) + 0.5f;
ObjectHelper *barObj = cache->object();
QQuaternion seriesRotation(cache->meshRotation());
const BarRenderItemArray &renderArray = cache->renderArray();
@@ -1199,7 +1203,9 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
foreach (SeriesRenderCache *baseCache, m_renderCacheList) {
if (baseCache->isVisible()) {
BarSeriesRenderCache *cache = static_cast<BarSeriesRenderCache *>(baseCache);
- float seriesPos = m_seriesStart + m_seriesStep * cache->visualIndex() + 0.5f;
+ float seriesPos = m_seriesStart + m_seriesStep
+ * (cache->visualIndex() - (cache->visualIndex()
+ * m_cachedBarSeriesMargin.width())) + 0.5f;
ObjectHelper *barObj = cache->object();
QQuaternion seriesRotation(cache->meshRotation());
const BarRenderItemArray &renderArray = cache->renderArray();
@@ -1459,7 +1465,9 @@ bool Bars3DRenderer::drawBars(BarRenderItem **selectedBar,
foreach (SeriesRenderCache *baseCache, m_renderCacheList) {
if (baseCache->isVisible()) {
BarSeriesRenderCache *cache = static_cast<BarSeriesRenderCache *>(baseCache);
- float seriesPos = m_seriesStart + m_seriesStep * cache->visualIndex() + 0.5f;
+ float seriesPos = m_seriesStart + m_seriesStep
+ * (cache->visualIndex() - (cache->visualIndex()
+ * m_cachedBarSeriesMargin.width())) + 0.5f;
ObjectHelper *barObj = cache->object();
QQuaternion seriesRotation(cache->meshRotation());
Q3DTheme::ColorStyle colorStyle = cache->colorStyle();
@@ -1620,10 +1628,17 @@ bool Bars3DRenderer::drawBars(BarRenderItem **selectedBar,
}
case Bars3DController::SelectionNone: {
// Current bar is not selected, nor on a row or column
- if (colorStyleIsUniform)
- barColor = baseColor;
- else
+ if (colorStyleIsUniform) {
+ QList<QColor> rowColors = cache->series()->rowColors();
+ if (rowColors.size() == 0) {
+ barColor = baseColor;
+ } else {
+ int rowColorIndex = row % rowColors.size();
+ barColor = Utils::vectorFromColor(rowColors[rowColorIndex]);
+ }
+ } else {
gradientTexture = cache->baseGradientTexture();
+ }
break;
}
}
@@ -2464,6 +2479,13 @@ void Bars3DRenderer::updateBarSpecs(GLfloat thicknessRatio, const QSizeF &spacin
calculateSceneScalingFactors();
}
+void Bars3DRenderer::updateBarSeriesMargin(const QSizeF &margin)
+{
+ m_cachedBarSeriesMargin = margin;
+ calculateSeriesStartPosition();
+ calculateSceneScalingFactors();
+}
+
void Bars3DRenderer::updateAxisRange(QAbstract3DAxis::AxisOrientation orientation, float min,
float max)
{
@@ -2596,6 +2618,10 @@ void Bars3DRenderer::calculateSceneScalingFactors()
m_scaleX = m_cachedBarThickness.width() / m_scaleFactor;
m_scaleZ = m_cachedBarThickness.height() / m_scaleFactor;
+ // Adjust scaling according to margin
+ m_scaleX -= m_scaleX * m_cachedBarSeriesMargin.width();
+ m_scaleZ -= m_scaleZ * m_cachedBarSeriesMargin.height();
+
// Whole graph scale factors
m_xScaleFactor = m_rowWidth / m_scaleFactor;
m_zScaleFactor = m_columnDepth / m_scaleFactor;
@@ -2659,6 +2685,12 @@ void Bars3DRenderer::calculateHeightAdjustment()
}
}
+void Bars3DRenderer::calculateSeriesStartPosition()
+{
+ m_seriesStart = -((float(m_visibleSeriesCount) - 1.0f) / 2.0f)
+ * (m_seriesStep - (m_seriesStep * m_cachedBarSeriesMargin.width()));
+}
+
Bars3DController::SelectionType Bars3DRenderer::isSelected(int row, int bar,
const BarSeriesRenderCache *cache)
{
diff --git a/src/datavisualization/engine/bars3drenderer_p.h b/src/datavisualization/engine/bars3drenderer_p.h
index 6c96c3e2..5e3c2459 100644
--- a/src/datavisualization/engine/bars3drenderer_p.h
+++ b/src/datavisualization/engine/bars3drenderer_p.h
@@ -57,7 +57,7 @@ class LabelItem;
class Q3DScene;
class BarSeriesRenderCache;
-class QT_DATAVISUALIZATION_EXPORT Bars3DRenderer : public Abstract3DRenderer
+class Q_DATAVISUALIZATION_EXPORT Bars3DRenderer : public Abstract3DRenderer
{
Q_OBJECT
@@ -68,6 +68,7 @@ private:
bool m_cachedIsSlicingActivated;
int m_cachedRowCount;
int m_cachedColumnCount;
+ QSizeF m_cachedBarSeriesMargin;
// Internal state
BarRenderItem *m_selectedBar; // points to renderitem array
@@ -144,6 +145,7 @@ public Q_SLOTS:
void updateBarSpecs(GLfloat thicknessRatio = 1.0f,
const QSizeF &spacing = QSizeF(1.0, 1.0),
bool relative = true);
+ void updateBarSeriesMargin(const QSizeF &margin);
void updateSlicingActive(bool isSlicing);
void updateSelectedBar(const QPoint &position, QBar3DSeries *series);
inline QPoint clickedPosition() const { return m_clickedPosition; }
@@ -186,6 +188,7 @@ private:
void updateDepthBuffer() override;
void calculateSceneScalingFactors();
void calculateHeightAdjustment();
+ void calculateSeriesStartPosition();
Abstract3DController::SelectionType isSelected(int row, int bar,
const BarSeriesRenderCache *cache);
QPoint selectionColorToArrayPosition(const QVector4D &selectionColor);
diff --git a/src/datavisualization/engine/drawer.cpp b/src/datavisualization/engine/drawer.cpp
index e83a1715..853e800b 100644
--- a/src/datavisualization/engine/drawer.cpp
+++ b/src/datavisualization/engine/drawer.cpp
@@ -197,6 +197,10 @@ void Drawer::drawSelectionObject(ShaderHelper *shader, AbstractObjectHelper *obj
void Drawer::drawSurfaceGrid(ShaderHelper *shader, SurfaceObject *object)
{
+ // Get grid line color
+ QVector4D lineColor = Utils::vectorFromColor(object->wireFrameColor());
+ shader->setUniformValue(shader->color(), lineColor);
+
// 1st attribute buffer : vertices
glEnableVertexAttribArray(shader->posAtt());
glBindBuffer(GL_ARRAY_BUFFER, object->vertexBuf());
diff --git a/src/datavisualization/engine/q3dbars.cpp b/src/datavisualization/engine/q3dbars.cpp
index 53519a4d..0d0597dc 100644
--- a/src/datavisualization/engine/q3dbars.cpp
+++ b/src/datavisualization/engine/q3dbars.cpp
@@ -157,7 +157,7 @@ QBar3DSeries *Q3DBars::primarySeries() const
* to the axes. If the newly added series has specified a selected bar, it will be highlighted and
* any existing selection will be cleared. Only one added series can have an active selection.
*
- * \sa seriesList(), primarySeries
+ * \sa seriesList(), primarySeries, QAbstract3DGraph::hasSeries()
*/
void Q3DBars::addSeries(QBar3DSeries *series)
{
@@ -166,6 +166,8 @@ void Q3DBars::addSeries(QBar3DSeries *series)
/*!
* Removes the \a series from the graph.
+ *
+ * \sa QAbstract3DGraph::hasSeries()
*/
void Q3DBars::removeSeries(QBar3DSeries *series)
{
@@ -180,7 +182,7 @@ void Q3DBars::removeSeries(QBar3DSeries *series)
* the new position in list is calculated as if the series was still in its old
* index, so the final index is actually the \a index decremented by one.
*
- * \sa addSeries(), seriesList()
+ * \sa addSeries(), seriesList(), QAbstract3DGraph::hasSeries()
*/
void Q3DBars::insertSeries(int index, QBar3DSeries *series)
{
@@ -189,6 +191,8 @@ void Q3DBars::insertSeries(int index, QBar3DSeries *series)
/*!
* Returns the list of series added to this graph.
+ *
+ * \sa QAbstract3DGraph::hasSeries()
*/
QList<QBar3DSeries *> Q3DBars::seriesList() const
{
@@ -247,7 +251,7 @@ float Q3DBars::barThickness() const
* Preset to \c {(1.0, 1.0)} by default. Spacing is affected by the
* barSpacingRelative property.
*
- * \sa barSpacingRelative, multiSeriesUniform
+ * \sa barSpacingRelative, multiSeriesUniform, barSeriesMargin
*/
void Q3DBars::setBarSpacing(const QSizeF &spacing)
{
@@ -285,6 +289,31 @@ bool Q3DBars::isBarSpacingRelative() const
}
/*!
+ * \property Q3DBars::barSeriesMargin
+ * \since 6.3
+ *
+ * \brief Margin between series columns in X and Z dimensions.
+ * Sensible values are on the range [0,1).
+ *
+ * Preset to \c {(0.0, 0.0)} by default. This property enables
+ * showing bars from different series side by side, but with space between columns.
+ *
+ * \sa barSpacing
+ */
+void Q3DBars::setBarSeriesMargin(const QSizeF &margin)
+{
+ if (margin != barSeriesMargin()) {
+ dptr()->m_shared->setBarSeriesMargin(margin);
+ emit barSeriesMarginChanged(margin);
+ }
+}
+
+QSizeF Q3DBars::barSeriesMargin() const
+{
+ return dptrc()->m_shared->barSeriesMargin();
+}
+
+/*!
* \property Q3DBars::rowAxis
*
* \brief The axis attached to the active row.
diff --git a/src/datavisualization/engine/q3dbars.h b/src/datavisualization/engine/q3dbars.h
index 5b782931..125b21ed 100644
--- a/src/datavisualization/engine/q3dbars.h
+++ b/src/datavisualization/engine/q3dbars.h
@@ -39,13 +39,14 @@ QT_BEGIN_NAMESPACE
class Q3DBarsPrivate;
-class QT_DATAVISUALIZATION_EXPORT Q3DBars : public QAbstract3DGraph
+class Q_DATAVISUALIZATION_EXPORT Q3DBars : public QAbstract3DGraph
{
Q_OBJECT
Q_PROPERTY(bool multiSeriesUniform READ isMultiSeriesUniform WRITE setMultiSeriesUniform NOTIFY multiSeriesUniformChanged)
Q_PROPERTY(float barThickness READ barThickness WRITE setBarThickness NOTIFY barThicknessChanged)
Q_PROPERTY(QSizeF barSpacing READ barSpacing WRITE setBarSpacing NOTIFY barSpacingChanged)
Q_PROPERTY(bool barSpacingRelative READ isBarSpacingRelative WRITE setBarSpacingRelative NOTIFY barSpacingRelativeChanged)
+ Q_PROPERTY(QSizeF barSeriesMargin READ barSeriesMargin WRITE setBarSeriesMargin NOTIFY barSeriesMarginChanged REVISION(6, 3))
Q_PROPERTY(QCategory3DAxis *rowAxis READ rowAxis WRITE setRowAxis NOTIFY rowAxisChanged)
Q_PROPERTY(QCategory3DAxis *columnAxis READ columnAxis WRITE setColumnAxis NOTIFY columnAxisChanged)
Q_PROPERTY(QValue3DAxis *valueAxis READ valueAxis WRITE setValueAxis NOTIFY valueAxisChanged)
@@ -76,6 +77,9 @@ public:
void setBarSpacingRelative(bool relative);
bool isBarSpacingRelative() const;
+ void setBarSeriesMargin(const QSizeF &margin);
+ QSizeF barSeriesMargin() const;
+
void setRowAxis(QCategory3DAxis *axis);
QCategory3DAxis *rowAxis() const;
void setColumnAxis(QCategory3DAxis *axis);
@@ -95,6 +99,7 @@ Q_SIGNALS:
void barThicknessChanged(float thicknessRatio);
void barSpacingChanged(const QSizeF &spacing);
void barSpacingRelativeChanged(bool relative);
+ Q_REVISION(6, 3) void barSeriesMarginChanged(const QSizeF &margin);
void rowAxisChanged(QCategory3DAxis *axis);
void columnAxisChanged(QCategory3DAxis *axis);
void valueAxisChanged(QValue3DAxis *axis);
diff --git a/src/datavisualization/engine/q3dcamera.h b/src/datavisualization/engine/q3dcamera.h
index a758afba..234c926d 100644
--- a/src/datavisualization/engine/q3dcamera.h
+++ b/src/datavisualization/engine/q3dcamera.h
@@ -36,7 +36,7 @@ QT_BEGIN_NAMESPACE
class Q3DCameraPrivate;
-class QT_DATAVISUALIZATION_EXPORT Q3DCamera : public Q3DObject
+class Q_DATAVISUALIZATION_EXPORT Q3DCamera : public Q3DObject
{
Q_OBJECT
Q_ENUMS(CameraPreset)
diff --git a/src/datavisualization/engine/q3dcamera_p.h b/src/datavisualization/engine/q3dcamera_p.h
index 944e408e..27685a43 100644
--- a/src/datavisualization/engine/q3dcamera_p.h
+++ b/src/datavisualization/engine/q3dcamera_p.h
@@ -89,7 +89,7 @@ Q_SIGNALS:
void minYRotationChanged(float rotation);
void maxXRotationChanged(float rotation);
void maxYRotationChanged(float rotation);
- void viewMatrixChanged(QMatrix4x4 viewMatrix);
+ void viewMatrixChanged(const QMatrix4x4 &viewMatrix);
void viewMatrixAutoUpdateChanged(bool enabled);
public:
diff --git a/src/datavisualization/engine/q3dlight.h b/src/datavisualization/engine/q3dlight.h
index 94067ac4..aad430db 100644
--- a/src/datavisualization/engine/q3dlight.h
+++ b/src/datavisualization/engine/q3dlight.h
@@ -36,7 +36,7 @@ QT_BEGIN_NAMESPACE
class Q3DLightPrivate;
-class QT_DATAVISUALIZATION_EXPORT Q3DLight : public Q3DObject
+class Q_DATAVISUALIZATION_EXPORT Q3DLight : public Q3DObject
{
Q_OBJECT
Q_PROPERTY(bool autoPosition READ isAutoPosition WRITE setAutoPosition NOTIFY autoPositionChanged REVISION(1, 3))
diff --git a/src/datavisualization/engine/q3dobject.h b/src/datavisualization/engine/q3dobject.h
index 2b93e3aa..cddfe089 100644
--- a/src/datavisualization/engine/q3dobject.h
+++ b/src/datavisualization/engine/q3dobject.h
@@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE
class Q3DObjectPrivate;
class Q3DScene;
-class QT_DATAVISUALIZATION_EXPORT Q3DObject : public QObject
+class Q_DATAVISUALIZATION_EXPORT Q3DObject : public QObject
{
Q_OBJECT
Q_PROPERTY(Q3DScene* parentScene READ parentScene)
diff --git a/src/datavisualization/engine/q3dscatter.cpp b/src/datavisualization/engine/q3dscatter.cpp
index 37834322..7774c5d5 100644
--- a/src/datavisualization/engine/q3dscatter.cpp
+++ b/src/datavisualization/engine/q3dscatter.cpp
@@ -110,6 +110,8 @@ Q3DScatter::~Q3DScatter()
* Adds the \a series to the graph. A graph can contain multiple series, but has only one set of
* axes. If the newly added series has specified a selected item, it will be highlighted and
* any existing selection will be cleared. Only one added series can have an active selection.
+ *
+ * \sa QAbstract3DGraph::hasSeries()
*/
void Q3DScatter::addSeries(QScatter3DSeries *series)
{
@@ -118,6 +120,8 @@ void Q3DScatter::addSeries(QScatter3DSeries *series)
/*!
* Removes the \a series from the graph.
+ *
+ * \sa QAbstract3DGraph::hasSeries()
*/
void Q3DScatter::removeSeries(QScatter3DSeries *series)
{
@@ -126,6 +130,8 @@ void Q3DScatter::removeSeries(QScatter3DSeries *series)
/*!
* Returns the list of series added to this graph.
+ *
+ * \sa QAbstract3DGraph::hasSeries()
*/
QList<QScatter3DSeries *> Q3DScatter::seriesList() const
{
diff --git a/src/datavisualization/engine/q3dscatter.h b/src/datavisualization/engine/q3dscatter.h
index 3a163aef..19e5be40 100644
--- a/src/datavisualization/engine/q3dscatter.h
+++ b/src/datavisualization/engine/q3dscatter.h
@@ -38,7 +38,7 @@ QT_BEGIN_NAMESPACE
class Q3DScatterPrivate;
-class QT_DATAVISUALIZATION_EXPORT Q3DScatter : public QAbstract3DGraph
+class Q_DATAVISUALIZATION_EXPORT Q3DScatter : public QAbstract3DGraph
{
Q_OBJECT
Q_PROPERTY(QValue3DAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged)
diff --git a/src/datavisualization/engine/q3dscene.h b/src/datavisualization/engine/q3dscene.h
index 4e29c32d..d07d6a14 100644
--- a/src/datavisualization/engine/q3dscene.h
+++ b/src/datavisualization/engine/q3dscene.h
@@ -40,7 +40,7 @@ QT_BEGIN_NAMESPACE
class Q3DScenePrivate;
-class QT_DATAVISUALIZATION_EXPORT Q3DScene : public QObject
+class Q_DATAVISUALIZATION_EXPORT Q3DScene : public QObject
{
Q_OBJECT
Q_PROPERTY(QRect viewport READ viewport NOTIFY viewportChanged)
diff --git a/src/datavisualization/engine/q3dscene_p.h b/src/datavisualization/engine/q3dscene_p.h
index 434ed9c7..47beeb93 100644
--- a/src/datavisualization/engine/q3dscene_p.h
+++ b/src/datavisualization/engine/q3dscene_p.h
@@ -77,7 +77,7 @@ struct Q3DSceneChangeBitField {
}
};
-class QT_DATAVISUALIZATION_EXPORT Q3DScenePrivate : public QObject
+class Q_DATAVISUALIZATION_EXPORT Q3DScenePrivate : public QObject
{
Q_OBJECT
public:
diff --git a/src/datavisualization/engine/q3dsurface.cpp b/src/datavisualization/engine/q3dsurface.cpp
index 0c3e401d..b22ff446 100644
--- a/src/datavisualization/engine/q3dsurface.cpp
+++ b/src/datavisualization/engine/q3dsurface.cpp
@@ -127,6 +127,8 @@ Q3DSurface::~Q3DSurface()
* Adds the \a series to the graph. A graph can contain multiple series, but has only one set of
* axes. If the newly added series has specified a selected item, it will be highlighted and
* any existing selection will be cleared. Only one added series can have an active selection.
+ *
+ * \sa QAbstract3DGraph::hasSeries()
*/
void Q3DSurface::addSeries(QSurface3DSeries *series)
{
@@ -135,6 +137,8 @@ void Q3DSurface::addSeries(QSurface3DSeries *series)
/*!
* Removes the \a series from the graph.
+ *
+ * \sa QAbstract3DGraph::hasSeries()
*/
void Q3DSurface::removeSeries(QSurface3DSeries *series)
{
@@ -143,6 +147,8 @@ void Q3DSurface::removeSeries(QSurface3DSeries *series)
/*!
* Returns the list of series added to this graph.
+ *
+ * \sa QAbstract3DGraph::hasSeries()
*/
QList<QSurface3DSeries *> Q3DSurface::seriesList() const
{
diff --git a/src/datavisualization/engine/q3dsurface.h b/src/datavisualization/engine/q3dsurface.h
index ae1d67d4..a14e5636 100644
--- a/src/datavisualization/engine/q3dsurface.h
+++ b/src/datavisualization/engine/q3dsurface.h
@@ -38,7 +38,7 @@ QT_BEGIN_NAMESPACE
class Q3DSurfacePrivate;
-class QT_DATAVISUALIZATION_EXPORT Q3DSurface : public QAbstract3DGraph
+class Q_DATAVISUALIZATION_EXPORT Q3DSurface : public QAbstract3DGraph
{
Q_OBJECT
Q_PROPERTY(QValue3DAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged)
diff --git a/src/datavisualization/engine/qabstract3dgraph.cpp b/src/datavisualization/engine/qabstract3dgraph.cpp
index 6e17937e..3110ec92 100644
--- a/src/datavisualization/engine/qabstract3dgraph.cpp
+++ b/src/datavisualization/engine/qabstract3dgraph.cpp
@@ -436,6 +436,16 @@ void QAbstract3DGraph::clearSelection()
}
/*!
+ * Returns whether the \a series has already been added to the graph.
+ *
+ * \since 6.3
+ */
+bool QAbstract3DGraph::hasSeries(QAbstract3DSeries *series)
+{
+ return d_ptr->m_visualController->hasSeries(series);
+}
+
+/*!
* Adds a QCustom3DItem \a item to the graph. Graph takes ownership of the added item.
*
* Returns the index to the added item if the add operation was successful, -1
@@ -656,11 +666,6 @@ qreal QAbstract3DGraph::currentFps() const
*
* \brief Whether orthographic projection is used for displaying the graph.
*
- * If \c {true}, ortographic projection is used to create 2D graphs by replacing
- * the default input handler with one that does not allow rotating the graph and
- * by setting the camera to view the graph
- * directly from the side or from the top. Also, axis labels typically need to be rotated when
- * viewing the graph from the sides.
* Defaults to \c{false}.
* \note Shadows will be disabled when set to \c{true}.
*
diff --git a/src/datavisualization/engine/qabstract3dgraph.h b/src/datavisualization/engine/qabstract3dgraph.h
index fd8610fa..ca99ae7e 100644
--- a/src/datavisualization/engine/qabstract3dgraph.h
+++ b/src/datavisualization/engine/qabstract3dgraph.h
@@ -43,8 +43,9 @@ QT_BEGIN_NAMESPACE
class QAbstract3DGraphPrivate;
class QCustom3DItem;
class QAbstract3DAxis;
+class QAbstract3DSeries;
-class QT_DATAVISUALIZATION_EXPORT QAbstract3DGraph : public QWindow, protected QOpenGLFunctions
+class Q_DATAVISUALIZATION_EXPORT QAbstract3DGraph : public QWindow, protected QOpenGLFunctions
{
Q_OBJECT
Q_ENUMS(ShadowQuality)
@@ -141,6 +142,8 @@ public:
void clearSelection();
+ virtual bool hasSeries(QAbstract3DSeries *series);
+
int addCustomItem(QCustom3DItem *item);
void removeCustomItems();
void removeCustomItem(QCustom3DItem *item);
diff --git a/src/datavisualization/engine/scatter3dcontroller_p.h b/src/datavisualization/engine/scatter3dcontroller_p.h
index 257eb056..cc64b7df 100644
--- a/src/datavisualization/engine/scatter3dcontroller_p.h
+++ b/src/datavisualization/engine/scatter3dcontroller_p.h
@@ -60,7 +60,7 @@ struct Scatter3DChangeBitField {
}
};
-class QT_DATAVISUALIZATION_EXPORT Scatter3DController : public Abstract3DController
+class Q_DATAVISUALIZATION_EXPORT Scatter3DController : public Abstract3DController
{
Q_OBJECT
diff --git a/src/datavisualization/engine/scatter3drenderer_p.h b/src/datavisualization/engine/scatter3drenderer_p.h
index ce43aa9e..13c6be73 100644
--- a/src/datavisualization/engine/scatter3drenderer_p.h
+++ b/src/datavisualization/engine/scatter3drenderer_p.h
@@ -54,7 +54,7 @@ class Q3DScene;
class ScatterSeriesRenderCache;
class QScatterDataItem;
-class QT_DATAVISUALIZATION_EXPORT Scatter3DRenderer : public Abstract3DRenderer
+class Q_DATAVISUALIZATION_EXPORT Scatter3DRenderer : public Abstract3DRenderer
{
Q_OBJECT
diff --git a/src/datavisualization/engine/surface3dcontroller_p.h b/src/datavisualization/engine/surface3dcontroller_p.h
index 0c2e31ff..73eda0cb 100644
--- a/src/datavisualization/engine/surface3dcontroller_p.h
+++ b/src/datavisualization/engine/surface3dcontroller_p.h
@@ -65,7 +65,7 @@ struct Surface3DChangeBitField {
}
};
-class QT_DATAVISUALIZATION_EXPORT Surface3DController : public Abstract3DController
+class Q_DATAVISUALIZATION_EXPORT Surface3DController : public Abstract3DController
{
Q_OBJECT
diff --git a/src/datavisualization/engine/surface3drenderer_p.h b/src/datavisualization/engine/surface3drenderer_p.h
index 957f44d2..ea5da3b6 100644
--- a/src/datavisualization/engine/surface3drenderer_p.h
+++ b/src/datavisualization/engine/surface3drenderer_p.h
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
class ShaderHelper;
class Q3DScene;
-class QT_DATAVISUALIZATION_EXPORT Surface3DRenderer : public Abstract3DRenderer
+class Q_DATAVISUALIZATION_EXPORT Surface3DRenderer : public Abstract3DRenderer
{
Q_OBJECT
diff --git a/src/datavisualization/engine/surfaceseriesrendercache.cpp b/src/datavisualization/engine/surfaceseriesrendercache.cpp
index 918d0fb6..545cee7e 100644
--- a/src/datavisualization/engine/surfaceseriesrendercache.cpp
+++ b/src/datavisualization/engine/surfaceseriesrendercache.cpp
@@ -66,6 +66,10 @@ void SurfaceSeriesRenderCache::populate(bool newSeries)
QSurface3DSeries::DrawFlags drawMode = series()->drawMode();
m_surfaceVisible = drawMode.testFlag(QSurface3DSeries::DrawSurface);
m_surfaceGridVisible = drawMode.testFlag(QSurface3DSeries::DrawWireframe);
+ QColor lineColor = series()->wireFrameColor();
+ m_surfaceObj->setLineColor(lineColor);
+ m_sliceSurfaceObj->setLineColor(lineColor);
+
if (m_flatChangeAllowed && m_surfaceFlatShading != series()->isFlatShadingEnabled()) {
m_surfaceFlatShading = series()->isFlatShadingEnabled();
m_flatStatusDirty = true;
diff --git a/src/datavisualization/global/qdatavisualizationglobal.h b/src/datavisualization/global/qdatavisualizationglobal.h
index 841ac7e4..a769f98c 100644
--- a/src/datavisualization/global/qdatavisualizationglobal.h
+++ b/src/datavisualization/global/qdatavisualizationglobal.h
@@ -31,6 +31,7 @@
#define QDATAVISUALIZATIONGLOBAL_H
#include <QtCore/qglobal.h>
+#include <QtDataVisualization/qtdatavisualizationexports.h>
QT_BEGIN_NAMESPACE
@@ -44,16 +45,6 @@ QT_BEGIN_NAMESPACE
*/
#define QT_DATAVISUALIZATION_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
-#ifndef QT_STATIC
-# if defined(QT_BUILD_DATAVISUALIZATION_LIB)
-# define QT_DATAVISUALIZATION_EXPORT Q_DECL_EXPORT
-# else
-# define QT_DATAVISUALIZATION_EXPORT Q_DECL_IMPORT
-# endif
-#else
-# define QT_DATAVISUALIZATION_EXPORT
-#endif
-
QT_END_NAMESPACE
#endif
diff --git a/src/datavisualization/input/q3dinputhandler.h b/src/datavisualization/input/q3dinputhandler.h
index 6e6d1845..d53175a3 100644
--- a/src/datavisualization/input/q3dinputhandler.h
+++ b/src/datavisualization/input/q3dinputhandler.h
@@ -36,7 +36,7 @@ QT_BEGIN_NAMESPACE
class Q3DInputHandlerPrivate;
-class QT_DATAVISUALIZATION_EXPORT Q3DInputHandler : public QAbstract3DInputHandler
+class Q_DATAVISUALIZATION_EXPORT Q3DInputHandler : public QAbstract3DInputHandler
{
Q_OBJECT
Q_PROPERTY(bool rotationEnabled READ isRotationEnabled WRITE setRotationEnabled NOTIFY rotationEnabledChanged)
diff --git a/src/datavisualization/input/qabstract3dinputhandler.h b/src/datavisualization/input/qabstract3dinputhandler.h
index c6e358c3..4715cf85 100644
--- a/src/datavisualization/input/qabstract3dinputhandler.h
+++ b/src/datavisualization/input/qabstract3dinputhandler.h
@@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE
class QAbstract3DInputHandlerPrivate;
-class QT_DATAVISUALIZATION_EXPORT QAbstract3DInputHandler : public QObject
+class Q_DATAVISUALIZATION_EXPORT QAbstract3DInputHandler : public QObject
{
Q_OBJECT
Q_ENUMS(InputView)
diff --git a/src/datavisualization/input/qtouch3dinputhandler.h b/src/datavisualization/input/qtouch3dinputhandler.h
index 51f2e073..0b1bb81d 100644
--- a/src/datavisualization/input/qtouch3dinputhandler.h
+++ b/src/datavisualization/input/qtouch3dinputhandler.h
@@ -36,7 +36,7 @@ QT_BEGIN_NAMESPACE
class QTouch3DInputHandlerPrivate;
-class QT_DATAVISUALIZATION_EXPORT QTouch3DInputHandler : public Q3DInputHandler
+class Q_DATAVISUALIZATION_EXPORT QTouch3DInputHandler : public Q3DInputHandler
{
Q_OBJECT
diff --git a/src/datavisualization/theme/q3dtheme.h b/src/datavisualization/theme/q3dtheme.h
index 4023bc16..3cf02ca7 100644
--- a/src/datavisualization/theme/q3dtheme.h
+++ b/src/datavisualization/theme/q3dtheme.h
@@ -40,7 +40,7 @@ QT_BEGIN_NAMESPACE
class Q3DThemePrivate;
-class QT_DATAVISUALIZATION_EXPORT Q3DTheme : public QObject
+class Q_DATAVISUALIZATION_EXPORT Q3DTheme : public QObject
{
Q_OBJECT
Q_ENUMS(ColorStyle)
diff --git a/src/datavisualization/theme/q3dtheme_p.h b/src/datavisualization/theme/q3dtheme_p.h
index d11b8146..ea7dd3e1 100644
--- a/src/datavisualization/theme/q3dtheme_p.h
+++ b/src/datavisualization/theme/q3dtheme_p.h
@@ -96,7 +96,7 @@ struct Q3DThemeDirtyBitField {
}
};
-class QT_DATAVISUALIZATION_EXPORT Q3DThemePrivate : public QObject
+class Q_DATAVISUALIZATION_EXPORT Q3DThemePrivate : public QObject
{
Q_OBJECT
public:
diff --git a/src/datavisualization/utils/surfaceobject.cpp b/src/datavisualization/utils/surfaceobject.cpp
index 6734ac86..7d73e700 100644
--- a/src/datavisualization/utils/surfaceobject.cpp
+++ b/src/datavisualization/utils/surfaceobject.cpp
@@ -870,7 +870,8 @@ void SurfaceObject::getNormalizedVertex(const QSurfaceDataItem &data, QVector3D
}
float normalizedY = m_axisCacheY.positionAt(data.y());
m_minY = qMin(normalizedY, m_minY);
- m_maxY = qMax(normalizedY, m_maxY);
+ if (!qIsNaN(normalizedY) && !qIsInf(normalizedY))
+ m_maxY = qMax(normalizedY, m_maxY);
vertex.setX(normalizedX);
vertex.setY(normalizedY);
vertex.setZ(normalizedZ);
diff --git a/src/datavisualization/utils/surfaceobject_p.h b/src/datavisualization/utils/surfaceobject_p.h
index 4532a671..9e317bb2 100644
--- a/src/datavisualization/utils/surfaceobject_p.h
+++ b/src/datavisualization/utils/surfaceobject_p.h
@@ -45,6 +45,7 @@
#include "qsurfacedataproxy.h"
#include <QtCore/QRect>
+#include <QtGui/QColor>
QT_BEGIN_NAMESPACE
@@ -95,6 +96,8 @@ public:
float minYValue() const { return m_minY; }
float maxYValue() const { return m_maxY; }
inline void activateSurfaceTexture(bool value) { m_returnTextureBuffer = value; }
+ inline void setLineColor(const QColor &color) { m_wireFrameColor = color; }
+ inline const QColor &wireFrameColor() const { return m_wireFrameColor; }
private:
void createCoarseIndices(GLint *indices, int &p, int row, int upperRow, int j);
@@ -129,6 +132,7 @@ private:
bool m_returnTextureBuffer = false;
SurfaceObject::DataDimensions m_dataDimension;
SurfaceObject::DataDimensions m_oldDataDimension = DataDimensions(-1);
+ QColor m_wireFrameColor;
};
QT_END_NAMESPACE
diff --git a/src/datavisualizationqml/abstractdeclarative.cpp b/src/datavisualizationqml/abstractdeclarative.cpp
index 81a889a0..e449c7d5 100644
--- a/src/datavisualizationqml/abstractdeclarative.cpp
+++ b/src/datavisualizationqml/abstractdeclarative.cpp
@@ -68,6 +68,9 @@ AbstractDeclarative::AbstractDeclarative(QQuickItem *parent) :
// Set contents to false in case we are in qml designer to make component look nice
m_runningInDesigner = QGuiApplication::applicationDisplayName() == QLatin1String("Qml2Puppet");
setFlag(ItemHasContents, !m_runningInDesigner);
+
+ // Accept touchevents
+ setAcceptTouchEvents(true);
}
AbstractDeclarative::~AbstractDeclarative()
@@ -182,6 +185,11 @@ void AbstractDeclarative::clearSelection()
m_controller->clearSelection();
}
+bool AbstractDeclarative::hasSeries(QAbstract3DSeries *series)
+{
+ return m_controller->hasSeries(series);
+}
+
void AbstractDeclarative::setSelectionMode(SelectionFlags mode)
{
int intmode = int(mode);
diff --git a/src/datavisualizationqml/abstractdeclarative_p.h b/src/datavisualizationqml/abstractdeclarative_p.h
index 3b9d4d96..ce98c8e7 100644
--- a/src/datavisualizationqml/abstractdeclarative_p.h
+++ b/src/datavisualizationqml/abstractdeclarative_p.h
@@ -168,6 +168,8 @@ public:
Q_INVOKABLE virtual void clearSelection();
+ Q_REVISION(6, 3) Q_INVOKABLE virtual bool hasSeries(QAbstract3DSeries *series);
+
Q_REVISION(1, 1) Q_INVOKABLE virtual int addCustomItem(QCustom3DItem *item);
Q_REVISION(1, 1) Q_INVOKABLE virtual void removeCustomItems();
Q_REVISION(1, 1) Q_INVOKABLE virtual void removeCustomItem(QCustom3DItem *item);
diff --git a/src/datavisualizationqml/colorgradient_p.h b/src/datavisualizationqml/colorgradient_p.h
index ec21cd2f..4bae9c1d 100644
--- a/src/datavisualizationqml/colorgradient_p.h
+++ b/src/datavisualizationqml/colorgradient_p.h
@@ -67,7 +67,7 @@ public:
Q_SIGNALS:
void positionChanged(qreal position);
- void colorChanged(QColor color);
+ void colorChanged(const QColor &color);
private:
void updateGradient();
diff --git a/src/datavisualizationqml/declarativebars.cpp b/src/datavisualizationqml/declarativebars.cpp
index fe90e159..59d64f4e 100644
--- a/src/datavisualizationqml/declarativebars.cpp
+++ b/src/datavisualizationqml/declarativebars.cpp
@@ -112,7 +112,7 @@ float DeclarativeBars::barThickness() const
return m_barsController->barThickness();
}
-void DeclarativeBars::setBarSpacing(QSizeF spacing)
+void DeclarativeBars::setBarSpacing(const QSizeF &spacing)
{
if (spacing != barSpacing()) {
m_barsController->setBarSpecs(GLfloat(barThickness()), spacing, isBarSpacingRelative());
@@ -138,6 +138,19 @@ bool DeclarativeBars::isBarSpacingRelative() const
return m_barsController->isBarSpecRelative();
}
+void DeclarativeBars::setBarSeriesMargin(const QSizeF &margin)
+{
+ if (margin != barSeriesMargin()) {
+ m_barsController->setBarSeriesMargin(margin);
+ emit barSeriesMarginChanged(barSeriesMargin());
+ }
+}
+
+QSizeF DeclarativeBars::barSeriesMargin() const
+{
+ return m_barsController->barSeriesMargin();
+}
+
QBar3DSeries *DeclarativeBars::selectedSeries() const
{
return m_barsController->selectedSeries();
diff --git a/src/datavisualizationqml/declarativebars_p.h b/src/datavisualizationqml/declarativebars_p.h
index acf1a030..516ff13f 100644
--- a/src/datavisualizationqml/declarativebars_p.h
+++ b/src/datavisualizationqml/declarativebars_p.h
@@ -56,6 +56,7 @@ class DeclarativeBars : public AbstractDeclarative
Q_PROPERTY(float barThickness READ barThickness WRITE setBarThickness NOTIFY barThicknessChanged)
Q_PROPERTY(QSizeF barSpacing READ barSpacing WRITE setBarSpacing NOTIFY barSpacingChanged)
Q_PROPERTY(bool barSpacingRelative READ isBarSpacingRelative WRITE setBarSpacingRelative NOTIFY barSpacingRelativeChanged)
+ Q_PROPERTY(QSizeF barSeriesMargin READ barSeriesMargin WRITE setBarSeriesMargin NOTIFY barSeriesMarginChanged REVISION(6, 3))
Q_PROPERTY(QQmlListProperty<QBar3DSeries> seriesList READ seriesList)
Q_PROPERTY(QBar3DSeries *selectedSeries READ selectedSeries NOTIFY selectedSeriesChanged)
Q_PROPERTY(QBar3DSeries *primarySeries READ primarySeries WRITE setPrimarySeries NOTIFY primarySeriesChanged)
@@ -82,12 +83,15 @@ public:
void setBarThickness(float thicknessRatio);
float barThickness() const;
- void setBarSpacing(QSizeF spacing);
+ void setBarSpacing(const QSizeF &spacing);
QSizeF barSpacing() const;
void setBarSpacingRelative(bool relative);
bool isBarSpacingRelative() const;
+ void setBarSeriesMargin(const QSizeF &margin);
+ QSizeF barSeriesMargin() const;
+
QQmlListProperty<QBar3DSeries> seriesList();
static void appendSeriesFunc(QQmlListProperty<QBar3DSeries> *list, QBar3DSeries *series);
static qsizetype countSeriesFunc(QQmlListProperty<QBar3DSeries> *list);
@@ -114,9 +118,10 @@ Q_SIGNALS:
void columnAxisChanged(QCategory3DAxis *axis);
void multiSeriesUniformChanged(bool uniform);
void barThicknessChanged(float thicknessRatio);
- void barSpacingChanged(QSizeF spacing);
+ void barSpacingChanged(const QSizeF &spacing);
void barSpacingRelativeChanged(bool relative);
- void meshFileNameChanged(QString filename);
+ Q_REVISION(6, 3) void barSeriesMarginChanged(const QSizeF &margin);
+ void meshFileNameChanged(const QString &filename);
void primarySeriesChanged(QBar3DSeries *series);
void selectedSeriesChanged(QBar3DSeries *series);
Q_REVISION(1, 2) void floorLevelChanged(float level);
diff --git a/src/datavisualizationqml/declarativecolor_p.h b/src/datavisualizationqml/declarativecolor_p.h
index d197fcf6..d772e642 100644
--- a/src/datavisualizationqml/declarativecolor_p.h
+++ b/src/datavisualizationqml/declarativecolor_p.h
@@ -61,7 +61,7 @@ public:
QColor color() const;
Q_SIGNALS:
- void colorChanged(QColor color);
+ void colorChanged(const QColor &color);
private:
QColor m_color;
diff --git a/src/datavisualizationqml/declarativescene_p.h b/src/datavisualizationqml/declarativescene_p.h
index 26591d43..eade98aa 100644
--- a/src/datavisualizationqml/declarativescene_p.h
+++ b/src/datavisualizationqml/declarativescene_p.h
@@ -68,7 +68,7 @@ public:
QPoint invalidSelectionPoint() const;
Q_SIGNALS:
- void selectionQueryPositionChanged(const QPointF position);
+ void selectionQueryPositionChanged(const QPointF &position);
};
QT_END_NAMESPACE
diff --git a/src/datavisualizationqml/declarativeseries.cpp b/src/datavisualizationqml/declarativeseries.cpp
index 38263a32..2afa3450 100644
--- a/src/datavisualizationqml/declarativeseries.cpp
+++ b/src/datavisualizationqml/declarativeseries.cpp
@@ -103,7 +103,8 @@ DeclarativeBar3DSeries::DeclarativeBar3DSeries(QObject *parent)
: QBar3DSeries(parent),
m_baseGradient(0),
m_singleHighlightGradient(0),
- m_multiHighlightGradient(0)
+ m_multiHighlightGradient(0),
+ m_dummyColors(false)
{
QObject::connect(this, &QBar3DSeries::selectedBarChanged, this,
&DeclarativeBar3DSeries::selectedBarChanged);
@@ -171,6 +172,37 @@ ColorGradient *DeclarativeBar3DSeries::multiHighlightGradient() const
return m_multiHighlightGradient;
}
+QQmlListProperty<DeclarativeColor> DeclarativeBar3DSeries::rowColors()
+{
+ return QQmlListProperty<DeclarativeColor>(this, this,
+ &DeclarativeBar3DSeries::appendRowColorsFunc,
+ &DeclarativeBar3DSeries::countRowColorsFunc,
+ &DeclarativeBar3DSeries::atRowColorsFunc,
+ &DeclarativeBar3DSeries::clearRowColorsFunc);
+}
+
+void DeclarativeBar3DSeries::appendRowColorsFunc(QQmlListProperty<DeclarativeColor> *list,
+ DeclarativeColor *color)
+{
+ reinterpret_cast<DeclarativeBar3DSeries *>(list->data)->addColor(color);
+}
+
+qsizetype DeclarativeBar3DSeries::countRowColorsFunc(QQmlListProperty<DeclarativeColor> *list)
+{
+ return reinterpret_cast<DeclarativeBar3DSeries *>(list->data)->colorList().count();
+}
+
+DeclarativeColor *DeclarativeBar3DSeries::atRowColorsFunc(QQmlListProperty<DeclarativeColor> *list,
+ qsizetype index)
+{
+ return reinterpret_cast<DeclarativeBar3DSeries *>(list->data)->colorList().at(index);
+}
+
+void DeclarativeBar3DSeries::clearRowColorsFunc(QQmlListProperty<DeclarativeColor> *list)
+{
+ reinterpret_cast<DeclarativeBar3DSeries *>(list->data)->clearColors();
+}
+
void DeclarativeBar3DSeries::handleBaseGradientUpdate()
{
if (m_baseGradient)
@@ -189,6 +221,73 @@ void DeclarativeBar3DSeries::handleMultiHighlightGradientUpdate()
setSeriesGradient(this, *m_multiHighlightGradient, GradientTypeMulti);
}
+void DeclarativeBar3DSeries::handleRowColorUpdate()
+{
+ int colorCount = m_rowColors.size();
+ int changed = 0;
+
+ DeclarativeColor *color = qobject_cast<DeclarativeColor*>(QObject::sender());
+ for (int i = 0; i < colorCount; i++) {
+ if (color == m_rowColors.at(i)) {
+ changed = i;
+ break;
+ }
+ }
+ QList<QColor> list = QBar3DSeries::rowColors();
+ list[changed] = m_rowColors.at(changed)->color();
+ QBar3DSeries::setRowColors(list);
+}
+
+void DeclarativeBar3DSeries::addColor(DeclarativeColor *color)
+{
+ if (!color) {
+ qWarning("Color is invalid, use ThemeColor");
+ return;
+ }
+ clearDummyColors();
+ m_rowColors.append(color);
+ connect(color, &DeclarativeColor::colorChanged, this,
+ &DeclarativeBar3DSeries::handleRowColorUpdate);
+ QList<QColor> list = QBar3DSeries::rowColors();
+ list.append(color->color());
+ QBar3DSeries::setRowColors(list);
+}
+
+QList<DeclarativeColor *> DeclarativeBar3DSeries::colorList()
+{
+ if (m_rowColors.isEmpty()) {
+ m_dummyColors = true;
+ const QList<QColor> list = QBar3DSeries::rowColors();
+ for (const QColor &item : list) {
+ DeclarativeColor *color = new DeclarativeColor(this);
+ color->setColor(item);
+ m_rowColors.append(color);
+ connect(color, &DeclarativeColor::colorChanged, this,
+ &DeclarativeBar3DSeries::handleRowColorUpdate);
+ }
+ }
+ return m_rowColors;
+}
+
+void DeclarativeBar3DSeries::clearColors()
+{
+ clearDummyColors();
+ for (const auto color : qAsConst(m_rowColors))
+ disconnect(color, 0, this, 0);
+
+ m_rowColors.clear();
+ QBar3DSeries::setRowColors(QList<QColor>());
+}
+
+void DeclarativeBar3DSeries::clearDummyColors()
+{
+ if (m_dummyColors) {
+ qDeleteAll(m_rowColors);
+ m_rowColors.clear();
+ m_dummyColors = false;
+ }
+}
+
DeclarativeScatter3DSeries::DeclarativeScatter3DSeries(QObject *parent)
: QScatter3DSeries(parent),
m_baseGradient(0),
diff --git a/src/datavisualizationqml/declarativeseries_p.h b/src/datavisualizationqml/declarativeseries_p.h
index 115e67e0..3e1593d5 100644
--- a/src/datavisualizationqml/declarativeseries_p.h
+++ b/src/datavisualizationqml/declarativeseries_p.h
@@ -44,6 +44,7 @@
#include "qscatter3dseries.h"
#include "qsurface3dseries.h"
#include "colorgradient_p.h"
+#include "declarativecolor_p.h"
#include <private/datavisualizationglobal_p.h>
#include <QtQml/qqml.h>
@@ -68,6 +69,7 @@ class DeclarativeBar3DSeries : public QBar3DSeries
Q_PROPERTY(ColorGradient *baseGradient READ baseGradient WRITE setBaseGradient NOTIFY baseGradientChanged)
Q_PROPERTY(ColorGradient *singleHighlightGradient READ singleHighlightGradient WRITE setSingleHighlightGradient NOTIFY singleHighlightGradientChanged)
Q_PROPERTY(ColorGradient *multiHighlightGradient READ multiHighlightGradient WRITE setMultiHighlightGradient NOTIFY multiHighlightGradientChanged)
+ Q_PROPERTY(QQmlListProperty<DeclarativeColor> rowColors READ rowColors REVISION(6, 3))
Q_CLASSINFO("DefaultProperty", "seriesChildren")
QML_NAMED_ELEMENT(Bar3DSeries)
@@ -91,13 +93,22 @@ public:
void setMultiHighlightGradient(ColorGradient *gradient);
ColorGradient *multiHighlightGradient() const;
+ QQmlListProperty<DeclarativeColor> rowColors();
+ static void appendRowColorsFunc(QQmlListProperty<DeclarativeColor> *list,
+ DeclarativeColor *color);
+ static qsizetype countRowColorsFunc(QQmlListProperty<DeclarativeColor> *list);
+ static DeclarativeColor *atRowColorsFunc(QQmlListProperty<DeclarativeColor> *list,
+ qsizetype index);
+ static void clearRowColorsFunc(QQmlListProperty<DeclarativeColor> *list);
+
public Q_SLOTS:
void handleBaseGradientUpdate();
void handleSingleHighlightGradientUpdate();
void handleMultiHighlightGradientUpdate();
+ void handleRowColorUpdate();
Q_SIGNALS:
- void selectedBarChanged(QPointF position);
+ void selectedBarChanged(const QPointF &position);
void baseGradientChanged(ColorGradient *gradient);
void singleHighlightGradientChanged(ColorGradient *gradient);
void multiHighlightGradientChanged(ColorGradient *gradient);
@@ -106,6 +117,14 @@ private:
ColorGradient *m_baseGradient; // Not owned
ColorGradient *m_singleHighlightGradient; // Not owned
ColorGradient *m_multiHighlightGradient; // Not owned
+
+ QList<DeclarativeColor *> m_rowColors;
+ bool m_dummyColors;
+
+ void addColor(DeclarativeColor *color);
+ QList<DeclarativeColor *> colorList();
+ void clearColors();
+ void clearDummyColors();
};
class DeclarativeScatter3DSeries : public QScatter3DSeries
@@ -195,7 +214,7 @@ public Q_SLOTS:
void handleMultiHighlightGradientUpdate();
Q_SIGNALS:
- void selectedPointChanged(QPointF position);
+ void selectedPointChanged(const QPointF &position);
void baseGradientChanged(ColorGradient *gradient);
void singleHighlightGradientChanged(ColorGradient *gradient);
void multiHighlightGradientChanged(ColorGradient *gradient);
diff --git a/tests/auto/cpptest/CMakeLists.txt b/tests/auto/cpptest/CMakeLists.txt
index 7b6ef00b..bed23651 100644
--- a/tests/auto/cpptest/CMakeLists.txt
+++ b/tests/auto/cpptest/CMakeLists.txt
@@ -9,6 +9,7 @@ add_subdirectory(q3dscatter-series)
add_subdirectory(q3dsurface)
add_subdirectory(q3dsurface-proxy)
add_subdirectory(q3dsurface-modelproxy)
+add_subdirectory(q3dsurface-modelproxy-nan)
add_subdirectory(q3dsurface-heightproxy)
add_subdirectory(q3dsurface-series)
add_subdirectory(q3daxis-category)
diff --git a/tests/auto/cpptest/q3dbars-series/tst_series.cpp b/tests/auto/cpptest/q3dbars-series/tst_series.cpp
index 11dfd3f2..74e375c5 100644
--- a/tests/auto/cpptest/q3dbars-series/tst_series.cpp
+++ b/tests/auto/cpptest/q3dbars-series/tst_series.cpp
@@ -90,6 +90,7 @@ void tst_series::initialProperties()
QVERIFY(m_series->dataProxy());
QCOMPARE(m_series->meshAngle(), 0.0f);
QCOMPARE(m_series->selectedBar(), m_series->invalidSelectionPosition());
+ QCOMPARE(m_series->rowColors().size(), 0);
// Common properties
QCOMPARE(m_series->baseColor(), QColor(Qt::black));
@@ -132,6 +133,13 @@ void tst_series::initializeProperties()
gradient3.setColorAt(0.0, Qt::white);
gradient3.setColorAt(1.0, Qt::gray);
+ QList<QColor> rowColors;
+ rowColors.append(QColor(Qt::green));
+ rowColors.append(QColor(Qt::blue));
+ rowColors.append(QColor(Qt::red));
+
+ m_series->setRowColors(rowColors);
+
// Common properties
m_series->setBaseColor(QColor(Qt::blue));
m_series->setBaseGradient(gradient1);
@@ -165,6 +173,11 @@ void tst_series::initializeProperties()
QCOMPARE(m_series->singleHighlightGradient().stops().at(0).second, QColor(Qt::white));
QCOMPARE(m_series->userDefinedMesh(), QString(":/customitem.obj"));
QCOMPARE(m_series->isVisible(), false);
+
+ QCOMPARE(m_series->rowColors().size(), 3);
+ QCOMPARE(m_series->rowColors().at(0), QColor(Qt::green));
+ QCOMPARE(m_series->rowColors().at(1), QColor(Qt::blue));
+ QCOMPARE(m_series->rowColors().at(2), QColor(Qt::red));
}
void tst_series::invalidProperties()
diff --git a/tests/auto/cpptest/q3dbars/tst_bars.cpp b/tests/auto/cpptest/q3dbars/tst_bars.cpp
index 02de1fba..9c92cc84 100644
--- a/tests/auto/cpptest/q3dbars/tst_bars.cpp
+++ b/tests/auto/cpptest/q3dbars/tst_bars.cpp
@@ -57,6 +57,7 @@ private slots:
void selectSeries();
void removeSeries();
void removeMultipleSeries();
+ void hasSeries();
// The following tests are not required for scatter or surface, as they are handled identically
void addInputHandler();
@@ -121,6 +122,7 @@ void tst_bars::initialProperties()
QCOMPARE(m_graph->isMultiSeriesUniform(), false);
QCOMPARE(m_graph->barThickness(), 1.0);
QCOMPARE(m_graph->barSpacing(), QSizeF(1.0f, 1.0f));
+ QCOMPARE(m_graph->barSeriesMargin(), QSizeF(0.0f, 0.0f));
QCOMPARE(m_graph->isBarSpacingRelative(), true);
QCOMPARE(m_graph->seriesList().length(), 0);
QVERIFY(!m_graph->selectedSeries());
@@ -157,12 +159,14 @@ void tst_bars::initializeProperties()
m_graph->setMultiSeriesUniform(true);
m_graph->setBarThickness(0.2f);
m_graph->setBarSpacing(QSizeF(0.1f, 0.1f));
+ m_graph->setBarSeriesMargin(QSizeF(0.3f, 0.3f));
m_graph->setBarSpacingRelative(false);
m_graph->setFloorLevel(1.0f);
QCOMPARE(m_graph->isMultiSeriesUniform(), true);
QCOMPARE(m_graph->barThickness(), 0.2f);
QCOMPARE(m_graph->barSpacing(), QSizeF(0.1f, 0.1f));
+ QCOMPARE(m_graph->barSeriesMargin(), QSizeF(0.3f, 0.3f));
QCOMPARE(m_graph->isBarSpacingRelative(), false);
QCOMPARE(m_graph->floorLevel(), 1.0f);
@@ -297,6 +301,15 @@ void tst_bars::removeMultipleSeries()
delete series3;
}
+void tst_bars::hasSeries()
+{
+ QBar3DSeries *series1 = newSeries();
+ m_graph->addSeries(series1);
+ QCOMPARE(m_graph->hasSeries(series1), true);
+ QBar3DSeries *series2 = newSeries();
+ QCOMPARE(m_graph->hasSeries(series2), false);
+}
+
// The following tests are not required for scatter or surface, as they are handled identically
void tst_bars::addInputHandler()
{
diff --git a/tests/auto/cpptest/q3dscatter/tst_scatter.cpp b/tests/auto/cpptest/q3dscatter/tst_scatter.cpp
index 502c2923..cd39ab8d 100644
--- a/tests/auto/cpptest/q3dscatter/tst_scatter.cpp
+++ b/tests/auto/cpptest/q3dscatter/tst_scatter.cpp
@@ -54,6 +54,7 @@ private slots:
void selectSeries();
void removeSeries();
void removeMultipleSeries();
+ void hasSeries();
private:
Q3DScatter *m_graph;
@@ -253,5 +254,14 @@ void tst_scatter::removeMultipleSeries()
delete series3;
}
+void tst_scatter::hasSeries()
+{
+ QScatter3DSeries *series1 = newSeries();
+ m_graph->addSeries(series1);
+ QCOMPARE(m_graph->hasSeries(series1), true);
+ QScatter3DSeries *series2 = newSeries();
+ QCOMPARE(m_graph->hasSeries(series2), false);
+}
+
QTEST_MAIN(tst_scatter)
#include "tst_scatter.moc"
diff --git a/tests/auto/cpptest/q3dsurface-modelproxy-nan/CMakeLists.txt b/tests/auto/cpptest/q3dsurface-modelproxy-nan/CMakeLists.txt
new file mode 100644
index 00000000..8125bd21
--- /dev/null
+++ b/tests/auto/cpptest/q3dsurface-modelproxy-nan/CMakeLists.txt
@@ -0,0 +1,11 @@
+qt_internal_add_test(q3dsurface-modelproxy-nan
+ SOURCES
+ tst_proxy.cpp
+ INCLUDE_DIRECTORIES
+ ../common
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::GuiPrivate
+ Qt::Widgets
+ Qt::DataVisualization
+)
diff --git a/tests/auto/cpptest/q3dsurface-modelproxy-nan/tst_proxy.cpp b/tests/auto/cpptest/q3dsurface-modelproxy-nan/tst_proxy.cpp
new file mode 100644
index 00000000..53b9ac39
--- /dev/null
+++ b/tests/auto/cpptest/q3dsurface-modelproxy-nan/tst_proxy.cpp
@@ -0,0 +1,292 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 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$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <QtDataVisualization/QItemModelSurfaceDataProxy>
+#include <QtDataVisualization/Q3DSurface>
+
+#include "cpptestutil.h"
+
+class tst_proxy: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+ void dataContainingNaNFirstRow();
+ void dataContainingNaNLastRow();
+ void dataContainingNaNFirstLastRow();
+};
+
+void tst_proxy::initTestCase()
+{
+}
+
+void tst_proxy::cleanupTestCase()
+{
+}
+
+void tst_proxy::init()
+{
+}
+
+void tst_proxy::cleanup()
+{
+}
+
+void tst_proxy::dataContainingNaNFirstRow()
+{
+ if (!CpptestUtil::isOpenGLSupported())
+ QSKIP("OpenGL not supported on this platform");
+
+ const int size = 10;
+ const int missingRow = 0;
+
+ QItemModelSurfaceDataProxy *proxy = new QItemModelSurfaceDataProxy();
+ QSurface3DSeries *series = new QSurface3DSeries(proxy);
+ Q3DSurface *graph = new Q3DSurface();
+ graph->addSeries(series);
+
+ // X
+ QSurfaceDataArray *array = new QSurfaceDataArray();
+ array->reserve(size);
+ for (int i = 0; i < size; i++) {
+ QSurfaceDataRow *row = new QSurfaceDataRow(size);
+ for (int j = 0; j < size; j++) {
+ (*row)[j].setPosition(QVector3D((i == missingRow) ? std::numeric_limits<float>::quiet_NaN()
+ : static_cast<float>(i),
+ qSin(static_cast<float>(i)), static_cast<float>(j)));
+ }
+ *array << row;
+ }
+ proxy->resetArray(array);
+ QVERIFY(!qIsNaN(graph->axisX()->min()));
+ QVERIFY(!qIsNaN(graph->axisX()->max()));
+ QVERIFY(!qIsNaN(graph->axisY()->min()));
+ QVERIFY(!qIsNaN(graph->axisY()->max()));
+ QVERIFY(!qIsNaN(graph->axisZ()->min()));
+ QVERIFY(!qIsNaN(graph->axisZ()->max()));
+
+ // Y
+ for (int i = 0; i < size; i++) {
+ QSurfaceDataRow *row = new QSurfaceDataRow(size);
+ for (int j = 0; j < size; j++) {
+ (*row)[j].setPosition(QVector3D(static_cast<float>(i),
+ (i == missingRow) ? std::numeric_limits<float>::quiet_NaN()
+ : qSin(static_cast<float>(i)),
+ static_cast<float>(j)));
+ }
+ *array << row;
+ }
+ proxy->resetArray(array);
+ QVERIFY(!qIsNaN(graph->axisX()->min()));
+ QVERIFY(!qIsNaN(graph->axisX()->max()));
+ QVERIFY(!qIsNaN(graph->axisY()->min()));
+ QVERIFY(!qIsNaN(graph->axisY()->max()));
+ QVERIFY(!qIsNaN(graph->axisZ()->min()));
+ QVERIFY(!qIsNaN(graph->axisZ()->max()));
+
+ // Z
+ for (int i = 0; i < size; i++) {
+ QSurfaceDataRow *row = new QSurfaceDataRow(size);
+ for (int j = 0; j < size; j++) {
+ (*row)[j].setPosition(QVector3D(static_cast<float>(i),
+ qSin(static_cast<float>(i)),
+ (i == missingRow) ? std::numeric_limits<float>::quiet_NaN()
+ : static_cast<float>(j)));
+ }
+ *array << row;
+ }
+ proxy->resetArray(array);
+ QVERIFY(!qIsNaN(graph->axisX()->min()));
+ QVERIFY(!qIsNaN(graph->axisX()->max()));
+ QVERIFY(!qIsNaN(graph->axisY()->min()));
+ QVERIFY(!qIsNaN(graph->axisY()->max()));
+ QVERIFY(!qIsNaN(graph->axisZ()->min()));
+ QVERIFY(!qIsNaN(graph->axisZ()->max()));
+
+ delete graph;
+
+}
+
+void tst_proxy::dataContainingNaNLastRow()
+{
+ if (!CpptestUtil::isOpenGLSupported())
+ QSKIP("OpenGL not supported on this platform");
+
+ const int size = 10;
+ const int missingRow = size - 1;
+ QItemModelSurfaceDataProxy *proxy = new QItemModelSurfaceDataProxy();
+ QSurface3DSeries *series = new QSurface3DSeries(proxy);
+ Q3DSurface *graph = new Q3DSurface();
+ graph->addSeries(series);
+
+ // X
+ QSurfaceDataArray *array = new QSurfaceDataArray();
+ array->reserve(size);
+ for (int i = 0; i < size; i++) {
+ QSurfaceDataRow *row = new QSurfaceDataRow(size);
+ for (int j = 0; j < size; j++) {
+ (*row)[j].setPosition(QVector3D((i == missingRow) ? std::numeric_limits<float>::quiet_NaN()
+ : static_cast<float>(i),
+ qSin(static_cast<float>(i)), static_cast<float>(j)));
+ }
+ *array << row;
+ }
+ proxy->resetArray(array);
+ QVERIFY(!qIsNaN(graph->axisX()->min()));
+ QVERIFY(!qIsNaN(graph->axisX()->max()));
+ QVERIFY(!qIsNaN(graph->axisY()->min()));
+ QVERIFY(!qIsNaN(graph->axisY()->max()));
+ QVERIFY(!qIsNaN(graph->axisZ()->min()));
+ QVERIFY(!qIsNaN(graph->axisZ()->max()));
+
+ // Y
+ for (int i = 0; i < size; i++) {
+ QSurfaceDataRow *row = new QSurfaceDataRow(size);
+ for (int j = 0; j < size; j++) {
+ (*row)[j].setPosition(QVector3D(static_cast<float>(i),
+ (i == missingRow) ? std::numeric_limits<float>::quiet_NaN()
+ : qSin(static_cast<float>(i)),
+ static_cast<float>(j)));
+ }
+ *array << row;
+ }
+ proxy->resetArray(array);
+ QVERIFY(!qIsNaN(graph->axisX()->min()));
+ QVERIFY(!qIsNaN(graph->axisX()->max()));
+ QVERIFY(!qIsNaN(graph->axisY()->min()));
+ QVERIFY(!qIsNaN(graph->axisY()->max()));
+ QVERIFY(!qIsNaN(graph->axisZ()->min()));
+ QVERIFY(!qIsNaN(graph->axisZ()->max()));
+
+ // Z
+ for (int i = 0; i < size; i++) {
+ QSurfaceDataRow *row = new QSurfaceDataRow(size);
+ for (int j = 0; j < size; j++) {
+ (*row)[j].setPosition(QVector3D(static_cast<float>(i),
+ qSin(static_cast<float>(i)),
+ (i == missingRow) ? std::numeric_limits<float>::quiet_NaN()
+ : static_cast<float>(j)));
+ }
+ *array << row;
+ }
+ proxy->resetArray(array);
+ QVERIFY(!qIsNaN(graph->axisX()->min()));
+ QVERIFY(!qIsNaN(graph->axisX()->max()));
+ QVERIFY(!qIsNaN(graph->axisY()->min()));
+ QVERIFY(!qIsNaN(graph->axisY()->max()));
+ QVERIFY(!qIsNaN(graph->axisZ()->min()));
+ QVERIFY(!qIsNaN(graph->axisZ()->max()));
+ delete graph;
+}
+
+void tst_proxy::dataContainingNaNFirstLastRow()
+{
+ if (!CpptestUtil::isOpenGLSupported())
+ QSKIP("OpenGL not supported on this platform");
+
+ const int size = 10;
+ const int rowFirst = 0;
+ const int rowLast = size - 1;
+ QItemModelSurfaceDataProxy *proxy = new QItemModelSurfaceDataProxy();
+ QSurface3DSeries *series = new QSurface3DSeries(proxy);
+ Q3DSurface *graph = new Q3DSurface();
+ graph->addSeries(series);
+
+ // X
+ QSurfaceDataArray *array = new QSurfaceDataArray();
+ array->reserve(size);
+ for (int i = 0; i < size; i++) {
+ bool missingRow = (i == rowFirst || i == rowLast);
+ QSurfaceDataRow *row = new QSurfaceDataRow(size);
+ for (int j = 0; j < size; j++) {
+ (*row)[j].setPosition(QVector3D(missingRow ? std::numeric_limits<float>::quiet_NaN()
+ : static_cast<float>(i),
+ qSin(static_cast<float>(i)), static_cast<float>(j)));
+ }
+ *array << row;
+ }
+ proxy->resetArray(array);
+ QVERIFY(!qIsNaN(graph->axisX()->min()));
+ QVERIFY(!qIsNaN(graph->axisX()->max()));
+ QVERIFY(!qIsNaN(graph->axisY()->min()));
+ QVERIFY(!qIsNaN(graph->axisY()->max()));
+ QVERIFY(!qIsNaN(graph->axisZ()->min()));
+ QVERIFY(!qIsNaN(graph->axisZ()->max()));
+
+ // Y
+ for (int i = 0; i < size; i++) {
+ bool missingRow = (i == rowFirst || i == rowLast);
+ QSurfaceDataRow *row = new QSurfaceDataRow(size);
+ for (int j = 0; j < size; j++) {
+ (*row)[j].setPosition(QVector3D(static_cast<float>(i),
+ missingRow ? std::numeric_limits<float>::quiet_NaN()
+ : qSin(static_cast<float>(i)),
+ static_cast<float>(j)));
+ }
+ *array << row;
+ }
+ proxy->resetArray(array);
+ QVERIFY(!qIsNaN(graph->axisX()->min()));
+ QVERIFY(!qIsNaN(graph->axisX()->max()));
+ QVERIFY(!qIsNaN(graph->axisY()->min()));
+ QVERIFY(!qIsNaN(graph->axisY()->max()));
+ QVERIFY(!qIsNaN(graph->axisZ()->min()));
+ QVERIFY(!qIsNaN(graph->axisZ()->max()));
+
+ // Z
+ for (int i = 0; i < size; i++) {
+ bool missingRow = (i == rowFirst || i == rowLast);
+ QSurfaceDataRow *row = new QSurfaceDataRow(size);
+ for (int j = 0; j < size; j++) {
+ (*row)[j].setPosition(QVector3D(static_cast<float>(i),
+ qSin(static_cast<float>(i)),
+ missingRow ? std::numeric_limits<float>::quiet_NaN()
+ : static_cast<float>(j)));
+ }
+ *array << row;
+ }
+ proxy->resetArray(array);
+ QVERIFY(!qIsNaN(graph->axisX()->min()));
+ QVERIFY(!qIsNaN(graph->axisX()->max()));
+ QVERIFY(!qIsNaN(graph->axisY()->min()));
+ QVERIFY(!qIsNaN(graph->axisY()->max()));
+ QVERIFY(!qIsNaN(graph->axisZ()->min()));
+ QVERIFY(!qIsNaN(graph->axisZ()->max()));
+ delete graph;
+}
+
+QTEST_MAIN(tst_proxy)
+#include "tst_proxy.moc"
diff --git a/tests/auto/cpptest/q3dsurface-series/tst_series.cpp b/tests/auto/cpptest/q3dsurface-series/tst_series.cpp
index 23f86dd5..9a097d6e 100644
--- a/tests/auto/cpptest/q3dsurface-series/tst_series.cpp
+++ b/tests/auto/cpptest/q3dsurface-series/tst_series.cpp
@@ -92,7 +92,7 @@ void tst_series::initialProperties()
QCOMPARE(m_series->isFlatShadingEnabled(), true);
QCOMPARE(m_series->isFlatShadingSupported(), true);
QCOMPARE(m_series->selectedPoint(), m_series->invalidSelectionPosition());
-
+ QCOMPARE(m_series->wireFrameColor(), QColor(Qt::black));
// Common properties. The ones identical between different series are tested in QBar3DSeries tests
QCOMPARE(m_series->itemLabelFormat(), QString("@xLabel, @yLabel, @zLabel"));
QCOMPARE(m_series->mesh(), QAbstract3DSeries::MeshSphere);
@@ -107,10 +107,12 @@ void tst_series::initializeProperties()
m_series->setDrawMode(QSurface3DSeries::DrawWireframe);
m_series->setFlatShadingEnabled(false);
m_series->setSelectedPoint(QPoint(0, 0));
+ m_series->setWireFrameColor(QColor(Qt::red));
QCOMPARE(m_series->drawMode(), QSurface3DSeries::DrawWireframe);
QCOMPARE(m_series->isFlatShadingEnabled(), false);
QCOMPARE(m_series->selectedPoint(), QPoint(0, 0));
+ QCOMPARE(m_series->wireFrameColor(), QColor(Qt::red));
// Common properties. The ones identical between different series are tested in QBar3DSeries tests
m_series->setMesh(QAbstract3DSeries::MeshPyramid);
diff --git a/tests/auto/cpptest/q3dsurface/tst_surface.cpp b/tests/auto/cpptest/q3dsurface/tst_surface.cpp
index e0add57c..fc1068e3 100644
--- a/tests/auto/cpptest/q3dsurface/tst_surface.cpp
+++ b/tests/auto/cpptest/q3dsurface/tst_surface.cpp
@@ -54,6 +54,7 @@ private slots:
void selectSeries();
void removeSeries();
void removeMultipleSeries();
+ void hasSeries();
private:
Q3DSurface *m_graph;
@@ -263,5 +264,14 @@ void tst_surface::removeMultipleSeries()
delete series3;
}
+void tst_surface::hasSeries()
+{
+ QSurface3DSeries *series1 = newSeries();
+ m_graph->addSeries(series1);
+ QCOMPARE(m_graph->hasSeries(series1), true);
+ QSurface3DSeries *series2 = newSeries();
+ QCOMPARE(m_graph->hasSeries(series2), false);
+}
+
QTEST_MAIN(tst_surface)
#include "tst_surface.moc"
diff --git a/tests/auto/qmltest/bars3d/tst_bars.qml b/tests/auto/qmltest/bars3d/tst_bars.qml
index 75cf10a2..80c1d9e4 100644
--- a/tests/auto/qmltest/bars3d/tst_bars.qml
+++ b/tests/auto/qmltest/bars3d/tst_bars.qml
@@ -28,7 +28,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtDataVisualization 1.2
+import QtDataVisualization
import QtTest 1.0
Item {
@@ -41,7 +41,7 @@ Item {
function constructBars() {
bars3d = Qt.createQmlObject("
import QtQuick 2.2
- import QtDataVisualization 1.2
+ import QtDataVisualization
Bars3D {
anchors.fill: parent
}", top)
@@ -89,6 +89,14 @@ Item {
compare(bars3d.selectedSeries, series1)
waitForRendering(top)
+ }
+
+ function test_6_has_series() {
+ bars3d.seriesList = [series1]
+ compare(bars3d.hasSeries(series1), true)
+ compare(bars3d.hasSeries(series2), false)
+
+ waitForRendering(top)
bars3d.destroy()
waitForRendering(top)
}
@@ -104,7 +112,7 @@ Item {
function constructBarsWithCustomItemList() {
bars3d = Qt.createQmlObject("
import QtQuick 2.2
- import QtDataVisualization 1.2
+ import QtDataVisualization
Bars3D {
anchors.fill: parent
customItemList: [item1, item2]
diff --git a/tests/auto/qmltest/bars3d/tst_barseries.qml b/tests/auto/qmltest/bars3d/tst_barseries.qml
index 3db19615..77dd0895 100644
--- a/tests/auto/qmltest/bars3d/tst_barseries.qml
+++ b/tests/auto/qmltest/bars3d/tst_barseries.qml
@@ -28,7 +28,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtDataVisualization 1.2
+import QtDataVisualization
import QtTest 1.0
Item {
@@ -64,6 +64,20 @@ Item {
]
}
+ ThemeColor {
+ id: rowColor1
+ color: "green"
+ }
+
+ ThemeColor {
+ id: rowColor2
+ color: "blue"
+ }
+ ThemeColor {
+ id: rowColor3
+ color: "red"
+ }
+
Bar3DSeries {
id: initialized
dataProxy: ItemModelBarDataProxy {
@@ -92,6 +106,7 @@ Item {
singleHighlightGradient: gradient3
userDefinedMesh: ":/customitem.obj"
visible: false
+ rowColors: [ rowColor1, rowColor2, rowColor3 ]
}
ItemModelBarDataProxy {
@@ -118,6 +133,7 @@ Item {
compare(initial.invalidSelectionPosition, Qt.point(-1, -1))
compare(initial.meshAngle, 0)
compare(initial.selectedBar, Qt.point(-1, -1))
+ compare(initial.rowColors.length, 0)
}
function test_2_initial_common() {
@@ -149,6 +165,7 @@ Item {
compare(initialized.dataProxy.rowCount, 2)
fuzzyCompare(initialized.meshAngle, 15.0, 0.01)
compare(initialized.selectedBar, Qt.point(0, 0))
+ compare(initialized.rowColors.length, 3)
}
function test_2_initialized_common() {
@@ -177,6 +194,7 @@ Item {
change.dataProxy = proxy1
change.meshAngle = 15.0
change.selectedBar = Qt.point(0, 0)
+ change.rowColors = [rowColor1, rowColor2, rowColor3]
}
function test_2_test_change() {
@@ -222,5 +240,10 @@ Item {
gradient1.stops[0].color = "yellow"
compare(change.baseGradient.stops[0].color, "#ffff00")
}
+
+ function test_5_change_rowColors() {
+ rowColor2.color = "purple"
+ compare(change.rowColors[1].color, "#800080")
+ }
}
}
diff --git a/tests/auto/qmltest/bars3d/tst_basic.qml b/tests/auto/qmltest/bars3d/tst_basic.qml
index 3ef7101d..ea303356 100644
--- a/tests/auto/qmltest/bars3d/tst_basic.qml
+++ b/tests/auto/qmltest/bars3d/tst_basic.qml
@@ -28,7 +28,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtDataVisualization 1.2
+import QtDataVisualization
import QtTest 1.0
Item {
@@ -44,7 +44,7 @@ Item {
function constructEmpty() {
empty = Qt.createQmlObject("
import QtQuick 2.2
- import QtDataVisualization 1.2
+ import QtDataVisualization
Bars3D {
}", top)
}
@@ -52,13 +52,15 @@ Item {
function constructBasic() {
basic = Qt.createQmlObject("
import QtQuick 2.2
- import QtDataVisualization 1.2
+ import QtDataVisualization
Bars3D {
anchors.fill: parent
multiSeriesUniform: true
barThickness: 0.1
barSpacing.width: 0.1
barSpacing.height: 0.1
+ barSeriesMargin.width: 0.3
+ barSeriesMargin.height: 0.3
barSpacingRelative: false
floorLevel: 1.0
}", top)
@@ -68,7 +70,7 @@ Item {
function constructCommon() {
common = Qt.createQmlObject("
import QtQuick 2.2
- import QtDataVisualization 1.2
+ import QtDataVisualization
Bars3D {
anchors.fill: parent
}", top)
@@ -78,7 +80,7 @@ Item {
function constructCommonInit() {
common_init = Qt.createQmlObject("
import QtQuick 2.2
- import QtDataVisualization 1.2
+ import QtDataVisualization
Bars3D {
anchors.fill: parent
selectionMode: AbstractGraph3D.SelectionNone
@@ -112,6 +114,7 @@ Item {
compare(empty.multiSeriesUniform, false, "multiSeriesUniform")
compare(empty.barThickness, 1.0, "barThickness")
compare(empty.barSpacing, Qt.size(1.0, 1.0), "barSpacing")
+ compare(empty.barSeriesMargin, Qt.size(0.0, 0.0), "barSeriesMargin")
compare(empty.barSpacingRelative, true, "barSpacingRelative")
compare(empty.seriesList.length, 0, "seriesList")
compare(empty.selectedSeries, null, "selectedSeries")
@@ -140,6 +143,7 @@ Item {
compare(basic.multiSeriesUniform, true, "multiSeriesUniform")
compare(basic.barThickness, 0.1, "barThickness")
compare(basic.barSpacing, Qt.size(0.1, 0.1), "barSpacing")
+ compare(basic.barSeriesMargin, Qt.size(0.3, 0.3), "barSeriesMargin")
compare(basic.barSpacingRelative, false, "barSpacingRelative")
compare(basic.floorLevel, 1.0, "floorLevel")
waitForRendering(top)
@@ -149,11 +153,13 @@ Item {
basic.multiSeriesUniform = false
basic.barThickness = 0.5
basic.barSpacing = Qt.size(1.0, 0.0)
+ basic.barSeriesMargin = Qt.size(0.5, 0.0)
basic.barSpacingRelative = true
basic.floorLevel = 0.2
compare(basic.multiSeriesUniform, false, "multiSeriesUniform")
compare(basic.barThickness, 0.5, "barThickness")
compare(basic.barSpacing, Qt.size(1.0, 0.0), "barSpacing")
+ compare(basic.barSeriesMargin, Qt.size(0.5, 0.0), "barSeriesMargin")
compare(basic.barSpacingRelative, true, "barSpacingRelative")
compare(basic.floorLevel, 0.2, "floorLevel")
waitForRendering(top)
@@ -162,8 +168,10 @@ Item {
function test_3_basic_change_invalid() {
basic.barThickness = -1
basic.barSpacing = Qt.size(-1.0, -1.0)
+ basic.barSeriesMargin = Qt.size(-1.0, -1.0)
compare(basic.barThickness, -1/*0.5*/, "barThickness") // TODO: Fix once QTRD-3367 is done
compare(basic.barSpacing, Qt.size(-1.0, -1.0), "barSpacing")
+ compare(basic.barSeriesMargin, Qt.size(-1.0, -1.0), "barSeriesMargin")
waitForRendering(top)
basic.destroy()
waitForRendering(top)
diff --git a/tests/auto/qmltest/bars3d/tst_proxy.qml b/tests/auto/qmltest/bars3d/tst_proxy.qml
index ca8b8516..428000ac 100644
--- a/tests/auto/qmltest/bars3d/tst_proxy.qml
+++ b/tests/auto/qmltest/bars3d/tst_proxy.qml
@@ -28,7 +28,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtDataVisualization 1.2
+import QtDataVisualization
import QtTest 1.0
Item {
diff --git a/tests/auto/qmltest/scatter3d/tst_scatter.qml b/tests/auto/qmltest/scatter3d/tst_scatter.qml
index 9805b2e9..d871f891 100644
--- a/tests/auto/qmltest/scatter3d/tst_scatter.qml
+++ b/tests/auto/qmltest/scatter3d/tst_scatter.qml
@@ -28,7 +28,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtDataVisualization 1.2
+import QtDataVisualization
import QtTest 1.0
Item {
@@ -67,5 +67,11 @@ Item {
series.seriesList[0].selectedItem = 0
compare(series.selectedSeries, series1)
}
+
+ function test_5_has_series() {
+ series.seriesList = [series1]
+ compare(series.hasSeries(series1), true)
+ compare(series.hasSeries(series2), false)
+ }
}
}
diff --git a/tests/auto/qmltest/surface3d/tst_surface.qml b/tests/auto/qmltest/surface3d/tst_surface.qml
index 2ec96007..e112295f 100644
--- a/tests/auto/qmltest/surface3d/tst_surface.qml
+++ b/tests/auto/qmltest/surface3d/tst_surface.qml
@@ -28,7 +28,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtDataVisualization 1.2
+import QtDataVisualization
import QtTest 1.0
Item {
@@ -67,5 +67,11 @@ Item {
series.seriesList[0].selectedPoint = Qt.point(0, 0)
compare(series.selectedSeries, series1)
}
+
+ function test_5_has_series() {
+ series.seriesList = [series1]
+ compare(series.hasSeries(series1), true)
+ compare(series.hasSeries(series2), false)
+ }
}
}
diff --git a/tests/auto/qmltest/surface3d/tst_surfaceseries.qml b/tests/auto/qmltest/surface3d/tst_surfaceseries.qml
index a4593c94..e4707f60 100644
--- a/tests/auto/qmltest/surface3d/tst_surfaceseries.qml
+++ b/tests/auto/qmltest/surface3d/tst_surfaceseries.qml
@@ -28,7 +28,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtDataVisualization 1.2
+import QtDataVisualization
import QtTest 1.0
Item {
@@ -79,6 +79,7 @@ Item {
flatShadingEnabled: false
selectedPoint: Qt.point(0, 0)
textureFile: ":\customtexture.jpg"
+ wireFrameColor: "red"
baseColor: "blue"
baseGradient: gradient1
@@ -123,6 +124,7 @@ Item {
compare(initial.flatShadingEnabled, true)
compare(initial.flatShadingSupported, true)
compare(initial.selectedPoint, Qt.point(-1, -1))
+ compare(initial.wireFrameColor, "#000000")
}
function test_2_initial_common() {
@@ -156,6 +158,7 @@ Item {
compare(initialized.flatShadingEnabled, false)
compare(initialized.selectedPoint, Qt.point(0, 0))
compare(initialized.textureFile, ":\customtexture.jpg")
+ compare(initialized.wireFrameColor, "#ff0000")
}
function test_2_initialized_common() {
@@ -187,6 +190,7 @@ Item {
change.flatShadingEnabled = false
change.selectedPoint = Qt.point(0, 0)
change.textureFile = ":\customtexture.jpg"
+ change.wireFrameColor = "green"
}
function test_2_test_change() {
@@ -196,6 +200,7 @@ Item {
compare(change.flatShadingEnabled, false)
compare(change.selectedPoint, Qt.point(0, 0))
compare(change.textureFile, ":\customtexture.jpg")
+ compare(change.wireFrameColor, "#008000")
}
function test_3_change_common() {
diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt
index 36175991..922fe921 100644
--- a/tests/manual/CMakeLists.txt
+++ b/tests/manual/CMakeLists.txt
@@ -4,6 +4,8 @@ if(TARGET Qt::Quick)
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)
diff --git a/tests/manual/barstest/chart.cpp b/tests/manual/barstest/chart.cpp
index 7d878046..4f006024 100644
--- a/tests/manual/barstest/chart.cpp
+++ b/tests/manual/barstest/chart.cpp
@@ -54,6 +54,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),
@@ -1624,6 +1626,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;
diff --git a/tests/manual/barstest/chart.h b/tests/manual/barstest/chart.h
index 9a4cd60e..dabaa5e2 100644
--- a/tests/manual/barstest/chart.h
+++ b/tests/manual/barstest/chart.h
@@ -75,6 +75,8 @@ public:
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);
@@ -153,6 +155,8 @@ private:
bool 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/main.cpp b/tests/manual/barstest/main.cpp
index a0379fd7..1b14d08d 100644
--- a/tests/manual/barstest/main.cpp
+++ b/tests/manual/barstest/main.cpp
@@ -304,6 +304,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);
@@ -433,6 +445,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);
@@ -472,7 +487,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();
@@ -489,6 +504,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,
diff --git a/tests/manual/directional/scatterdatamodifier.h b/tests/manual/directional/scatterdatamodifier.h
index 7ca463c3..3120b6f6 100644
--- a/tests/manual/directional/scatterdatamodifier.h
+++ b/tests/manual/directional/scatterdatamodifier.h
@@ -65,7 +65,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/qmlbarsrowcolors/CMakeLists.txt b/tests/manual/qmlbarsrowcolors/CMakeLists.txt
new file mode 100644
index 00000000..bd8da958
--- /dev/null
+++ b/tests/manual/qmlbarsrowcolors/CMakeLists.txt
@@ -0,0 +1,52 @@
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+qt_internal_add_manual_test(qmlbarsrowcolors
+ GUI
+ SOURCES
+ main.cpp
+ )
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Qml)
+find_package(Qt6 COMPONENTS Quick)
+find_package(Qt6 COMPONENTS DataVisualization)
+
+set_target_properties(qmlbarsrowcolors PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_compile_definitions(qmlbarsrowcolors PUBLIC
+ QT_DISABLE_DEPRECATED_BEFORE=0x050F00
+)
+
+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}
+)
+
+install(TARGETS qmlbarsrowcolors
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/tests/manual/qmlbarsrowcolors/main.cpp b/tests/manual/qmlbarsrowcolors/main.cpp
new file mode 100644
index 00000000..25ed1447
--- /dev/null
+++ b/tests/manual/qmlbarsrowcolors/main.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 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$
+**
+****************************************************************************/
+
+#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..e17ca521
--- /dev/null
+++ b/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Axes.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 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
+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..cabb6522
--- /dev/null
+++ b/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/Data.qml
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 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
+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..0d72369b
--- /dev/null
+++ b/tests/manual/qmlbarsrowcolors/qml/qmlbarsrowcolors/main.qml
@@ -0,0 +1,418 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 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
+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/qmlheightmap/CMakeLists.txt b/tests/manual/qmlheightmap/CMakeLists.txt
new file mode 100644
index 00000000..174b7bcf
--- /dev/null
+++ b/tests/manual/qmlheightmap/CMakeLists.txt
@@ -0,0 +1,41 @@
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+qt_internal_add_manual_test(qmlheightmap
+ GUI
+ SOURCES
+ main.cpp
+ )
+target_link_libraries(qmlheightmap PUBLIC
+ Qt::Gui
+ 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
new file mode 100644
index 00000000..28df3673
--- /dev/null
+++ b/tests/manual/qmlheightmap/gradientGRAY16.png
Binary files differ
diff --git a/tests/manual/qmlheightmap/gradientGRAY8.png b/tests/manual/qmlheightmap/gradientGRAY8.png
new file mode 100644
index 00000000..6696e57c
--- /dev/null
+++ b/tests/manual/qmlheightmap/gradientGRAY8.png
Binary files differ
diff --git a/tests/manual/qmlheightmap/gradientRGB16.png b/tests/manual/qmlheightmap/gradientRGB16.png
new file mode 100644
index 00000000..b62e510b
--- /dev/null
+++ b/tests/manual/qmlheightmap/gradientRGB16.png
Binary files differ
diff --git a/tests/manual/qmlheightmap/gradientRGB8.png b/tests/manual/qmlheightmap/gradientRGB8.png
new file mode 100644
index 00000000..79879f35
--- /dev/null
+++ b/tests/manual/qmlheightmap/gradientRGB8.png
Binary files differ
diff --git a/tests/manual/qmlheightmap/main.cpp b/tests/manual/qmlheightmap/main.cpp
new file mode 100644
index 00000000..b54e9fea
--- /dev/null
+++ b/tests/manual/qmlheightmap/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 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$
+**
+****************************************************************************/
+
+#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..d7e29514
--- /dev/null
+++ b/tests/manual/qmlheightmap/qml/qmlheightmap/main.qml
@@ -0,0 +1,207 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 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
+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"
+ }
+ }
+ }
+ }
+ }
+}