diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-10-04 12:06:57 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-02-28 16:52:41 +0100 |
commit | bb35f031a9680be6f8cf92ddc8e2cc9f3e309612 (patch) | |
tree | 171f3e32c4c247ab0383dbc45591071c2c0272fa | |
parent | b08c24890d8c5c09ba7a25a69c8c3600dcca5dc3 (diff) |
Adapt to QtGraphs changed API
Task-number: QTBUG-114091
Task-number: PYSIDE-2497
Change-Id: I62b6c50ea4cafd240ef75b2814849821f4eb2c3b
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r-- | examples/graphs/3d/widgetgallery/axesinputhandler.py | 5 | ||||
-rw-r--r-- | examples/graphs/3d/widgetgallery/bargraph.py | 12 | ||||
-rw-r--r-- | examples/graphs/3d/widgetgallery/custominputhandler.py | 2 | ||||
-rw-r--r-- | examples/graphs/3d/widgetgallery/graphmodifier.py | 55 | ||||
-rw-r--r-- | examples/graphs/3d/widgetgallery/highlightseries.py | 2 | ||||
-rw-r--r-- | examples/graphs/3d/widgetgallery/scatterdatamodifier.py | 23 | ||||
-rw-r--r-- | examples/graphs/3d/widgetgallery/scattergraph.py | 8 | ||||
-rw-r--r-- | examples/graphs/3d/widgetgallery/surfacegraphmodifier.py | 19 | ||||
-rw-r--r-- | sources/pyside6/PySide6/QtGraphs/CMakeLists.txt | 14 | ||||
-rw-r--r-- | sources/pyside6/PySide6/QtGraphs/qtgraphs_helper.cpp | 30 | ||||
-rw-r--r-- | sources/pyside6/PySide6/QtGraphs/typesystem_graphs.xml | 257 | ||||
-rw-r--r-- | sources/pyside6/PySide6/glue/qtgraphs.cpp | 2 | ||||
-rw-r--r-- | sources/pyside6/PySide6/qtgraphs_helper.h | 4 |
13 files changed, 142 insertions, 291 deletions
diff --git a/examples/graphs/3d/widgetgallery/axesinputhandler.py b/examples/graphs/3d/widgetgallery/axesinputhandler.py index 768fac5ff..4c4202974 100644 --- a/examples/graphs/3d/widgetgallery/axesinputhandler.py +++ b/examples/graphs/3d/widgetgallery/axesinputhandler.py @@ -69,9 +69,8 @@ class AxesInputHandler(Q3DInputHandler): def handleAxisDragging(self): distance = 0.0 # Get scene orientation from active camera - ac = self.scene().activeCamera() - xRotation = ac.xRotation() - yRotation = ac.yRotation() + xRotation = self.cameraXRotation() + yRotation = self.cameraYRotation() # Calculate directional drag multipliers based on rotation xMulX = cos(degrees(xRotation)) diff --git a/examples/graphs/3d/widgetgallery/bargraph.py b/examples/graphs/3d/widgetgallery/bargraph.py index db0dd8e52..822acb4a9 100644 --- a/examples/graphs/3d/widgetgallery/bargraph.py +++ b/examples/graphs/3d/widgetgallery/bargraph.py @@ -48,12 +48,12 @@ class BarGraph(QObject): smoothCheckBox.setChecked(False) barStyleList = QComboBox(self._barsWidget) - barStyleList.addItem("Bar", QAbstract3DSeries.MeshBar) - barStyleList.addItem("Pyramid", QAbstract3DSeries.MeshPyramid) - barStyleList.addItem("Cone", QAbstract3DSeries.MeshCone) - barStyleList.addItem("Cylinder", QAbstract3DSeries.MeshCylinder) - barStyleList.addItem("Bevel bar", QAbstract3DSeries.MeshBevelBar) - barStyleList.addItem("Sphere", QAbstract3DSeries.MeshSphere) + barStyleList.addItem("Bar", QAbstract3DSeries.Mesh.Bar) + barStyleList.addItem("Pyramid", QAbstract3DSeries.Mesh.Pyramid) + barStyleList.addItem("Cone", QAbstract3DSeries.Mesh.Cone) + barStyleList.addItem("Cylinder", QAbstract3DSeries.Mesh.Cylinder) + barStyleList.addItem("Bevel bar", QAbstract3DSeries.Mesh.BevelBar) + barStyleList.addItem("Sphere", QAbstract3DSeries.Mesh.Sphere) barStyleList.setCurrentIndex(4) cameraButton = QPushButton(self._barsWidget) diff --git a/examples/graphs/3d/widgetgallery/custominputhandler.py b/examples/graphs/3d/widgetgallery/custominputhandler.py index 458ef62d1..15fe00e70 100644 --- a/examples/graphs/3d/widgetgallery/custominputhandler.py +++ b/examples/graphs/3d/widgetgallery/custominputhandler.py @@ -110,7 +110,7 @@ class CustomInputHandler(Q3DInputHandler): distance = 0.0 # Get scene orientation from active camera - xRotation = self.scene().activeCamera().xRotation() + xRotation = self.scene().cameraXRotation() # Calculate directional drag multipliers based on rotation xMulX = cos(degrees(xRotation)) diff --git a/examples/graphs/3d/widgetgallery/graphmodifier.py b/examples/graphs/3d/widgetgallery/graphmodifier.py index 938e09cff..2eaafa792 100644 --- a/examples/graphs/3d/widgetgallery/graphmodifier.py +++ b/examples/graphs/3d/widgetgallery/graphmodifier.py @@ -9,7 +9,7 @@ from PySide6.QtCore import QObject, QPropertyAnimation, Signal, Slot from PySide6.QtGui import QFont, QVector3D from PySide6.QtGraphs import (QAbstract3DGraph, QAbstract3DSeries, QBarDataItem, QBar3DSeries, QCategory3DAxis, - QValue3DAxis, Q3DCamera, Q3DTheme) + QValue3DAxis, Q3DTheme) from rainfalldata import RainfallData @@ -63,7 +63,7 @@ class GraphModifier(QObject): self._subSegments = 3 self._minval = float(-20) self._maxval = float(20) - self._barMesh = QAbstract3DSeries.MeshBevelBar + self._barMesh = QAbstract3DSeries.Mesh.BevelBar self._smooth = False self._animationCameraX = QPropertyAnimation() self._animationCameraY = QPropertyAnimation() @@ -75,7 +75,7 @@ class GraphModifier(QObject): self._defaultTarget = [] self._customData = None - self._graph.setShadowQuality(QAbstract3DGraph.ShadowQualitySoftMedium) + self._graph.setShadowQuality(QAbstract3DGraph.ShadowQuality.SoftMedium) theme = self._graph.activeTheme() theme.setBackgroundEnabled(False) theme.setFont(QFont("Times New Roman", self._fontSize)) @@ -109,12 +109,12 @@ class GraphModifier(QObject): format = "Oulu - @colLabel @rowLabel: @valueLabel" self._primarySeries.setItemLabelFormat(format) - self._primarySeries.setMesh(QAbstract3DSeries.MeshBevelBar) + self._primarySeries.setMesh(QAbstract3DSeries.Mesh.BevelBar) self._primarySeries.setMeshSmooth(False) format = "Helsinki - @colLabel @rowLabel: @valueLabel" self._secondarySeries.setItemLabelFormat(format) - self._secondarySeries.setMesh(QAbstract3DSeries.MeshBevelBar) + self._secondarySeries.setMesh(QAbstract3DSeries.Mesh.BevelBar) self._secondarySeries.setMeshSmooth(False) self._secondarySeries.setVisible(False) @@ -126,21 +126,20 @@ class GraphModifier(QObject): self.resetTemperatureData() # Set up property animations for zooming to the selected bar - camera = self._graph.scene().activeCamera() - self._defaultAngleX = camera.xRotation() - self._defaultAngleY = camera.yRotation() - self._defaultZoom = camera.zoomLevel() - self._defaultTarget = camera.target() + self._defaultAngleX = self._graph.cameraXRotation() + self._defaultAngleY = self._graph.cameraYRotation() + self._defaultZoom = self._graph.cameraZoomLevel() + self._defaultTarget = self._graph.cameraTargetPosition() - self._animationCameraX.setTargetObject(camera) - self._animationCameraY.setTargetObject(camera) - self._animationCameraZoom.setTargetObject(camera) - self._animationCameraTarget.setTargetObject(camera) + self._animationCameraX.setTargetObject(self._graph) + self._animationCameraY.setTargetObject(self._graph) + self._animationCameraZoom.setTargetObject(self._graph) + self._animationCameraTarget.setTargetObject(self._graph) - self._animationCameraX.setPropertyName(b"xRotation") - self._animationCameraY.setPropertyName(b"yRotation") - self._animationCameraZoom.setPropertyName(b"zoomLevel") - self._animationCameraTarget.setPropertyName(b"target") + self._animationCameraX.setPropertyName(b"cameraXRotation") + self._animationCameraY.setPropertyName(b"cameraYRotation") + self._animationCameraZoom.setPropertyName(b"cameraZoomLevel") + self._animationCameraTarget.setPropertyName(b"cameraTargetPosition") duration = 1700 self._animationCameraX.setDuration(duration) @@ -206,16 +205,15 @@ class GraphModifier(QObject): self._animationCameraTarget.stop() # Restore camera target in case animation has changed it - self._graph.scene().activeCamera().setTarget(QVector3D(0.0, 0.0, 0.0)) + self._graph.setCameraTargetPosition(QVector3D(0.0, 0.0, 0.0)) - self._preset = Q3DCamera.CameraPresetFront.value + self._preset = QAbstract3DGraph.CameraPreset.Front.value - camera = self._graph.scene().activeCamera() - camera.setCameraPreset(Q3DCamera.CameraPreset(self._preset)) + self._graph.setCameraPreset(QAbstract3DGraph.CameraPreset(self._preset)) self._preset += 1 - if self._preset > Q3DCamera.CameraPresetDirectlyBelow.value: - self._preset = Q3DCamera.CameraPresetFrontLow.value + if self._preset > QAbstract3DGraph.CameraPreset.DirectlyBelow.value: + self._preset = QAbstract3DGraph.CameraPreset.FrontLow.value @Slot(int) def changeTheme(self, theme): @@ -277,11 +275,10 @@ class GraphModifier(QObject): self._animationCameraZoom.stop() self._animationCameraTarget.stop() - camera = self._graph.scene().activeCamera() - currentX = camera.xRotation() - currentY = camera.yRotation() - currentZoom = camera.zoomLevel() - currentTarget = camera.target() + currentX = self._graph.cameraXRotation() + currentY = self._graph.cameraYRotation() + currentZoom = self._graph.cameraZoomLevel() + currentTarget = self._graph.cameraTargetPosition() self._animationCameraX.setStartValue(currentX) self._animationCameraY.setStartValue(currentY) diff --git a/examples/graphs/3d/widgetgallery/highlightseries.py b/examples/graphs/3d/widgetgallery/highlightseries.py index 93ef3a751..8c7b91633 100644 --- a/examples/graphs/3d/widgetgallery/highlightseries.py +++ b/examples/graphs/3d/widgetgallery/highlightseries.py @@ -91,4 +91,4 @@ class HighlightSeries(QSurface3DSeries): gr.setColorAt(DARK_RED_POS * ratio, Qt.darkRed) self.setBaseGradient(gr) - self.setColorStyle(Q3DTheme.ColorStyleRangeGradient) + self.setColorStyle(Q3DTheme.ColorStyle.RangeGradient) diff --git a/examples/graphs/3d/widgetgallery/scatterdatamodifier.py b/examples/graphs/3d/widgetgallery/scatterdatamodifier.py index a9ca38224..15064b412 100644 --- a/examples/graphs/3d/widgetgallery/scatterdatamodifier.py +++ b/examples/graphs/3d/widgetgallery/scatterdatamodifier.py @@ -7,7 +7,7 @@ from PySide6.QtCore import QObject, Signal, Slot, Qt from PySide6.QtGui import QVector3D from PySide6.QtGraphs import (QAbstract3DGraph, QAbstract3DSeries, QScatterDataItem, QScatterDataProxy, - QScatter3DSeries, Q3DCamera, Q3DTheme) + QScatter3DSeries, Q3DTheme) from axesinputhandler import AxesInputHandler @@ -29,7 +29,7 @@ class ScatterDataModifier(QObject): self._graph = scatter - self._style = QAbstract3DSeries.MeshSphere + self._style = QAbstract3DSeries.Mesh.Sphere self._smooth = True self._inputHandler = AxesInputHandler(scatter) self._autoAdjust = True @@ -37,16 +37,17 @@ class ScatterDataModifier(QObject): self._CURVE_DIVIDER = LOWER_CURVE_DIVIDER self._inputHandler = AxesInputHandler(scatter) - self._graph.activeTheme().setType(Q3DTheme.ThemeStoneMoss) - self._graph.setShadowQuality(QAbstract3DGraph.ShadowQualitySoftHigh) - self._graph.scene().activeCamera().setCameraPreset(Q3DCamera.CameraPresetFront) - self._graph.scene().activeCamera().setZoomLevel(80.0) + self._graph.activeTheme().setType(Q3DTheme.Theme.StoneMoss) + self._graph.setShadowQuality(QAbstract3DGraph.ShadowQuality.SoftHigh) + self._graph.setCameraPreset(QAbstract3DGraph.CameraPreset.Front) + self._graph.setCameraZoomLevel(80.0) self._proxy = QScatterDataProxy() self._series = QScatter3DSeries(self._proxy) self._series.setItemLabelFormat("@xTitle: @xLabel @yTitle: @yLabel @zTitle: @zLabel") self._series.setMeshSmooth(self._smooth) self._graph.addSeries(self._series) + self._preset = QAbstract3DGraph.CameraPreset.FrontLow.value # Give ownership of the handler to the graph and make it the active # handler @@ -98,14 +99,12 @@ class ScatterDataModifier(QObject): @Slot() def changePresetCamera(self): - preset = Q3DCamera.CameraPresetFrontLow.value - camera = self._graph.scene().activeCamera() - camera.setCameraPreset(Q3DCamera.CameraPreset(preset)) + camera.setCameraPreset(QAbstract3DGraph.CameraPreset(self._preset)) - preset += 1 - if preset > Q3DCamera.CameraPresetDirectlyBelow.value: - preset = Q3DCamera.CameraPresetFrontLow.value + self._preset += 1 + if self._preset > QAbstract3DGraph.CameraPreset.DirectlyBelow.value: + self._preset = QAbstract3DGraph.CameraPreset.FrontLow.value @Slot(QAbstract3DGraph.ShadowQuality) def shadowQualityUpdatedByVisual(self, sq): diff --git a/examples/graphs/3d/widgetgallery/scattergraph.py b/examples/graphs/3d/widgetgallery/scattergraph.py index 236348e55..79e8933eb 100644 --- a/examples/graphs/3d/widgetgallery/scattergraph.py +++ b/examples/graphs/3d/widgetgallery/scattergraph.py @@ -56,10 +56,10 @@ class ScatterGraph(QObject): smoothCheckBox.setChecked(True) itemStyleList = QComboBox(self._scatterWidget) - itemStyleList.addItem("Sphere", QAbstract3DSeries.MeshSphere) - itemStyleList.addItem("Cube", QAbstract3DSeries.MeshCube) - itemStyleList.addItem("Minimal", QAbstract3DSeries.MeshMinimal) - itemStyleList.addItem("Point", QAbstract3DSeries.MeshPoint) + itemStyleList.addItem("Sphere", QAbstract3DSeries.Mesh.Sphere) + itemStyleList.addItem("Cube", QAbstract3DSeries.Mesh.Cube) + itemStyleList.addItem("Minimal", QAbstract3DSeries.Mesh.Minimal) + itemStyleList.addItem("Point", QAbstract3DSeries.Mesh.Point) itemStyleList.setCurrentIndex(0) themeList = QComboBox(self._scatterWidget) diff --git a/examples/graphs/3d/widgetgallery/surfacegraphmodifier.py b/examples/graphs/3d/widgetgallery/surfacegraphmodifier.py index cb0ec4a8a..b2706c6fa 100644 --- a/examples/graphs/3d/widgetgallery/surfacegraphmodifier.py +++ b/examples/graphs/3d/widgetgallery/surfacegraphmodifier.py @@ -12,7 +12,7 @@ from PySide6.QtGraphs import (QAbstract3DGraph, QCustom3DItem, QCustom3DLabel, QHeightMapSurfaceDataProxy, QValue3DAxis, QSurfaceDataItem, QSurfaceDataProxy, QSurface3DSeries, - Q3DInputHandler, Q3DCamera, Q3DTheme) + Q3DInputHandler, Q3DTheme) from highlightseries import HighlightSeries @@ -73,10 +73,9 @@ class SurfaceGraphModifier(QObject): self._customInputHandler = None self._defaultInputHandler = Q3DInputHandler() - ac = self._graph.scene().activeCamera() - ac.setZoomLevel(85.0) - ac.setCameraPreset(Q3DCamera.CameraPresetIsometricRight) - self._graph.activeTheme().setType(Q3DTheme.ThemeRetro) + self._graph.setCameraZoomLevel(85.0) + self._graph.setCameraPreset(QAbstract3DGraph.CameraPreset.IsometricRight) + self._graph.activeTheme().setType(Q3DTheme.Theme.Retro) self._x_axis = QValue3DAxis() self._y_axis = QValue3DAxis() @@ -128,19 +127,19 @@ class SurfaceGraphModifier(QObject): grOne.setColorAt(0.5, Qt.darkGray) grOne.setColorAt(1.0, Qt.gray) self._heightMapSeriesOne.setBaseGradient(grOne) - self._heightMapSeriesOne.setColorStyle(Q3DTheme.ColorStyleRangeGradient) + self._heightMapSeriesOne.setColorStyle(Q3DTheme.ColorStyle.RangeGradient) grTwo = QLinearGradient() grTwo.setColorAt(0.39, Qt.blue) grTwo.setColorAt(0.4, Qt.white) self._heightMapSeriesTwo.setBaseGradient(grTwo) - self._heightMapSeriesTwo.setColorStyle(Q3DTheme.ColorStyleRangeGradient) + self._heightMapSeriesTwo.setColorStyle(Q3DTheme.ColorStyle.RangeGradient) grThree = QLinearGradient() grThree.setColorAt(0.0, Qt.white) grThree.setColorAt(0.05, Qt.black) self._heightMapSeriesThree.setBaseGradient(grThree) - self._heightMapSeriesThree.setColorStyle(Q3DTheme.ColorStyleRangeGradient) + self._heightMapSeriesThree.setColorStyle(Q3DTheme.ColorStyle.RangeGradient) # Custom items and label self._graph.selectedElementChanged.connect(self.handleElementSelected) @@ -420,7 +419,7 @@ class SurfaceGraphModifier(QObject): gr.setColorAt(1.0, Qt.yellow) self._sqrtSinSeries.setBaseGradient(gr) - self._sqrtSinSeries.setColorStyle(Q3DTheme.ColorStyleRangeGradient) + self._sqrtSinSeries.setColorStyle(Q3DTheme.ColorStyle.RangeGradient) def setGreenToRedGradient(self): gr = QLinearGradient() @@ -430,7 +429,7 @@ class SurfaceGraphModifier(QObject): gr.setColorAt(1.0, Qt.darkRed) self._sqrtSinSeries.setBaseGradient(gr) - self._sqrtSinSeries.setColorStyle(Q3DTheme.ColorStyleRangeGradient) + self._sqrtSinSeries.setColorStyle(Q3DTheme.ColorStyle.RangeGradient) @Slot(bool) def toggleItemOne(self, show): diff --git a/sources/pyside6/PySide6/QtGraphs/CMakeLists.txt b/sources/pyside6/PySide6/QtGraphs/CMakeLists.txt index 1fc47dc8f..751f8108e 100644 --- a/sources/pyside6/PySide6/QtGraphs/CMakeLists.txt +++ b/sources/pyside6/PySide6/QtGraphs/CMakeLists.txt @@ -6,6 +6,7 @@ project(QtGraphs) list(APPEND QtGraphs_src "${QtGraphs_SOURCE_DIR}/qtgraphs_helper.cpp") set(QtGraphs_SRC +# 3D ${QtGraphs_GEN_DIR}/qabstract3daxis_wrapper.cpp ${QtGraphs_GEN_DIR}/qcategory3daxis_wrapper.cpp ${QtGraphs_GEN_DIR}/qlogvalue3daxisformatter_wrapper.cpp @@ -41,6 +42,19 @@ ${QtGraphs_GEN_DIR}/q3dinputhandler_wrapper.cpp ${QtGraphs_GEN_DIR}/qabstract3dinputhandler_wrapper.cpp ${QtGraphs_GEN_DIR}/qtouch3dinputhandler_wrapper.cpp ${QtGraphs_GEN_DIR}/q3dtheme_wrapper.cpp +# 2D +${QtGraphs_GEN_DIR}/qbarcategoryaxis_wrapper.cpp +${QtGraphs_GEN_DIR}/qabstractaxis_wrapper.cpp +${QtGraphs_GEN_DIR}/qvalueaxis_wrapper.cpp +${QtGraphs_GEN_DIR}/qabstractbarseries_wrapper.cpp +${QtGraphs_GEN_DIR}/qbarseries_wrapper.cpp +${QtGraphs_GEN_DIR}/qbarset_wrapper.cpp +${QtGraphs_GEN_DIR}/qlineseries_wrapper.cpp +${QtGraphs_GEN_DIR}/qabstractseries_wrapper.cpp +${QtGraphs_GEN_DIR}/qscatterseries_wrapper.cpp +${QtGraphs_GEN_DIR}/qgraphtheme_wrapper.cpp +${QtGraphs_GEN_DIR}/qseriestheme_wrapper.cpp +${QtGraphs_GEN_DIR}/qxyseries_wrapper.cpp # module is always needed ${QtGraphs_GEN_DIR}/qtgraphs_module_wrapper.cpp ) diff --git a/sources/pyside6/PySide6/QtGraphs/qtgraphs_helper.cpp b/sources/pyside6/PySide6/QtGraphs/qtgraphs_helper.cpp index 05d6b00a3..19fe4f818 100644 --- a/sources/pyside6/PySide6/QtGraphs/qtgraphs_helper.cpp +++ b/sources/pyside6/PySide6/QtGraphs/qtgraphs_helper.cpp @@ -18,28 +18,28 @@ static void populateArray(double xStart, double deltaX, double zStart, double de const qsizetype zStride = zStrideBytes / sizeof(T); double z = zStart; for (qsizetype zi = 0; zi < zSize; ++zi) { - auto *row = new QSurfaceDataRow; - row->reserve(xSize); - result->append(row); + QSurfaceDataRow row; + row.reserve(xSize); double x = xStart; auto *rowDataEnd = data + xSize; for (auto *d = data; d < rowDataEnd; ++d) { - row->append(QSurfaceDataItem(QVector3D(x, *d, z))); + row.append(QSurfaceDataItem(QVector3D(x, *d, z))); x += deltaX; } + result->append(row); data += zStride; z += deltaZ; } } -QSurfaceDataArray *surfaceDataFromNp(double xStart, double deltaX, double zStart, double deltaZ, - PyObject *pyData) +QSurfaceDataArray surfaceDataFromNp(double xStart, double deltaX, double zStart, double deltaZ, + PyObject *pyData) { static const char funcName[] = "QSurfaceDataProxy.resetArrayNp"; - auto *result = new QSurfaceDataArray; + QSurfaceDataArray result; auto view = Shiboken::Numpy::View::fromPyObject(pyData); if (!view) { @@ -59,35 +59,35 @@ QSurfaceDataArray *surfaceDataFromNp(double xStart, double deltaX, double zStart switch (view.type) { case Shiboken::Numpy::View::Int16: populateArray(xStart, deltaX, zStart, deltaZ, xSize, zSize, view.stride[0], - reinterpret_cast<const int16_t *>(view.data), result); + reinterpret_cast<const int16_t *>(view.data), &result); break; case Shiboken::Numpy::View::Unsigned16: populateArray(xStart, deltaX, zStart, deltaZ, xSize, zSize, view.stride[0], - reinterpret_cast<const uint16_t *>(view.data), result); + reinterpret_cast<const uint16_t *>(view.data), &result); break; case Shiboken::Numpy::View::Int: populateArray(xStart, deltaX, zStart, deltaZ, xSize, zSize, view.stride[0], - reinterpret_cast<const int *>(view.data), result); + reinterpret_cast<const int *>(view.data), &result); break; case Shiboken::Numpy::View::Unsigned: populateArray(xStart, deltaX, zStart, deltaZ, xSize, zSize, view.stride[0], - reinterpret_cast<const unsigned *>(view.data), result); + reinterpret_cast<const unsigned *>(view.data), &result); break; case Shiboken::Numpy::View::Int64: populateArray(xStart, deltaX, zStart, deltaZ, xSize, zSize, view.stride[0], - reinterpret_cast<const int64_t *>(view.data), result); + reinterpret_cast<const int64_t *>(view.data), &result); break; case Shiboken::Numpy::View::Unsigned64: populateArray(xStart, deltaX, zStart, deltaZ, xSize, zSize, view.stride[0], - reinterpret_cast<const uint64_t *>(view.data), result); + reinterpret_cast<const uint64_t *>(view.data), &result); break; case Shiboken::Numpy::View::Float: populateArray(xStart, deltaX, zStart, deltaZ, xSize, zSize, view.stride[0], - reinterpret_cast<const float *>(view.data), result); + reinterpret_cast<const float *>(view.data), &result); break; case Shiboken::Numpy::View::Double: populateArray(xStart, deltaX, zStart, deltaZ, xSize, zSize, view.stride[0], - reinterpret_cast<const double *>(view.data), result); + reinterpret_cast<const double *>(view.data), &result); break; } diff --git a/sources/pyside6/PySide6/QtGraphs/typesystem_graphs.xml b/sources/pyside6/PySide6/QtGraphs/typesystem_graphs.xml index eb893b2a0..a0c22cf9c 100644 --- a/sources/pyside6/PySide6/QtGraphs/typesystem_graphs.xml +++ b/sources/pyside6/PySide6/QtGraphs/typesystem_graphs.xml @@ -14,40 +14,6 @@ <function signature="qDefaultSurfaceFormat(bool)"/> - <primitive-type name="QBarDataArray"> - <include file-name="qbardataproxy.h" location="global"/> - <conversion-rule> - <native-to-target> - <insert-template name="cppqlistofptrtoqlists_to_py_conversion"> - <replace from="%INTYPE_0" to="QBarDataItem"/> - </insert-template> - </native-to-target> - <target-to-native> - <add-conversion type="PySequence"> - <insert-template name="py_to_cppqlistofptrtoqlists_conversion"> - <replace from="%OUTTYPE_0" to="QBarDataItem"/> - </insert-template> - </add-conversion> - </target-to-native> - </conversion-rule> - </primitive-type> - <primitive-type name="QSurfaceDataArray"> - <include file-name="qsurfacedataproxy.h" location="global"/> - <conversion-rule> - <native-to-target> - <insert-template name="cppqlistofptrtoqlists_to_py_conversion"> - <replace from="%INTYPE_0" to="QSurfaceDataItem"/> - </insert-template> - </native-to-target> - <target-to-native> - <add-conversion type="PySequence"> - <insert-template name="py_to_cppqlistofptrtoqlists_conversion"> - <replace from="%OUTTYPE_0" to="QSurfaceDataItem"/> - </insert-template> - </add-conversion> - </target-to-native> - </conversion-rule> - </primitive-type> <object-type name="QAbstract3DAxis"> <enum-type name="AxisOrientation"/> @@ -63,37 +29,12 @@ </modify-function> </object-type> <object-type name="QValue3DAxisFormatter"> - <inject-code class="native" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="qvalue3daxisformatter-friend"/> <modify-function signature="createNewInstance() const"> <modify-argument index="return"> <define-ownership class="native" owner="c++"/> <define-ownership class="target" owner="default"/> </modify-argument> </modify-function> - <!-- PYSIDE-2025: gridPositions(), labelPositions(), labelStrings() return - non-const-references to lists for modifications. Add setters for them. --> - <add-function signature="setGridPositions(const QList<float>&@grid_positions@)"> - <inject-documentation format="target" mode="append"> - Sets the normalized grid line positions to ``grid_positions``. - </inject-documentation> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="qvalue3daxisformatter-setgridpositions"/> - </add-function> - <add-function signature="setLabelPositions(const QList<float>&@label_positions@)"> - <inject-documentation format="target" mode="append"> - Sets the normalized label positions to ``label_positions``. - </inject-documentation> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="qvalue3daxisformatter-setlabelpositions"/> - </add-function> - <add-function signature="setLabelStrings(const QStringList&@label_strings@)"> - <inject-documentation format="target" mode="append"> - Sets the label strings to ``label_strings``. - </inject-documentation> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="qvalue3daxisformatter-setlabelstrings"/> - </add-function> </object-type> <object-type name="QAbstract3DSeries"> <enum-type name="Mesh"/> @@ -111,89 +52,6 @@ </object-type> <value-type name="QBarDataItem"/> <object-type name="QBarDataProxy"> - <modify-function signature="resetArray(QBarDataArray*)" remove="all"/> - <add-function signature="resetArray(const QBarDataArray&)"> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="dataproxy-resetarray"/> - </add-function> - <modify-function signature="resetArray(QBarDataArray*,const QStringList&,const QStringList&)" - remove="all"/> - <add-function signature="resetArray(const QBarDataArray&,const QStringList&,const QStringList&)"> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="dataproxy-resetarray2"/> - </add-function> - <modify-function signature="resetArray(QBarDataArray*,const QStringList&,const QStringList&)"> - <modify-argument index="1"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - - <!-- PYSIDE-1438: Replace all add/set/insertRow() taking a 'QList*' by overloads - taking 'const QList &' since an allocated list needs to be passed. --> - <modify-function signature="addRow(QList<QBarDataItem>*)" remove="all"/> - <add-function signature="addRow(const QList<QBarDataItem>&)" return-type="int"> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="dataproxy-addrow"/> - </add-function> - <modify-function signature="addRow(QList<QBarDataItem>*,const QString&)" remove="all"/> - <add-function signature="addRow(const QList<QBarDataItem>&,const QString&)" - return-type="int"> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="dataproxy-addrow-string"/> - </add-function> - - <modify-function signature="insertRow(int,QList<QBarDataItem>*)" remove="all"/> - <add-function signature="insertRow(int,const QList<QBarDataItem>&)"> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="dataproxy-insertrow"/> - </add-function> - <modify-function signature="insertRow(int,QList<QBarDataItem>*,const QString&)" remove="all"/> - <add-function signature="insertRow(int,const QList<QBarDataItem>&, const QString&)"> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="dataproxy-insertrow-string"/> - </add-function> - - <modify-function signature="setRow(int,QList<QBarDataItem>*)" remove="all"/> - <add-function signature="setRow(int,const QList<QBarDataItem>&)"> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="dataproxy-setrow"/> - </add-function> - <modify-function signature="setRow(int,QList<QBarDataItem>*,const QString&)" remove="all"/> - <add-function signature="setRow(int,const QList<QBarDataItem>&,const QString&)"> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="dataproxy-setrow-string"/> - </add-function> - - <modify-function signature="addRows(const QBarDataArray&)"> - <modify-argument index="1"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - <modify-function signature="addRows(const QBarDataArray&, const QStringList&)"> - <modify-argument index="1"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - <modify-function signature="insertRows(int, const QBarDataArray&)"> - <modify-argument index="2"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - <modify-function signature="insertRows(int, const QBarDataArray&, const QStringList&)"> - <modify-argument index="2"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - <modify-function signature="setRows(int, const QBarDataArray&)"> - <modify-argument index="2"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - <modify-function signature="setRows(int, const QBarDataArray&, const QStringList&)"> - <modify-argument index="2"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> </object-type> <object-type name="QCustom3DItem"/> <object-type name="QCustom3DLabel"/> @@ -221,42 +79,6 @@ </object-type> <value-type name="QScatterDataItem"/> <object-type name="QScatterDataProxy"> - <modify-function signature="resetArray(QList<QScatterDataItem>*)" - remove="all"/> - <add-function signature="resetArray(QList<QScatterDataItem>*)"> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="scatterdataproxy-resetarray"/> - </add-function> - <modify-function signature="addItem(const QScatterDataItem&)"> - <modify-argument index="1"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - <modify-function signature="addItems(const QList<QScatterDataItem>&)"> - <modify-argument index="1"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - <modify-function signature="insertItem(int, const QScatterDataItem&)"> - <modify-argument index="2"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - <modify-function signature="insertItems(int, const QList<QScatterDataItem>&)"> - <modify-argument index="2"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - <modify-function signature="setItem(int, const QScatterDataItem&)"> - <modify-argument index="2"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - <modify-function signature="setItems(int, const QList<QScatterDataItem>&)"> - <modify-argument index="2"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> </object-type> <object-type name="QSurface3DSeries"> <enum-type name="DrawFlag" flags="DrawFlags"/> @@ -277,35 +99,6 @@ #include <sbknumpycheck.h> #include <qtgraphs_helper.h> </inject-code> - <!-- PYSIDE-1438: Replace all add/set/insertRow() taking a 'QList*' by overloads - taking 'const QList &' since an allocated list needs to be passed. --> - <modify-function signature="addRow(QList<QSurfaceDataItem>*)" remove="all"/> - <add-function signature="addRow(const QList<QSurfaceDataItem>&)" return-type="int"> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="dataproxy-addrow"/> - </add-function> - - <modify-function signature="insertRow(int,QList<QSurfaceDataItem>*)" remove="all"/> - <add-function signature="insertRow(int,const QList<QSurfaceDataItem>&)"> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="dataproxy-insertrow"/> - </add-function> - - <modify-function signature="setRow(int,QList<QSurfaceDataItem>*)" remove="all"/> - <add-function signature="setRow(int,const QList<QSurfaceDataItem>&)"> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="dataproxy-setrow"/> - </add-function> - - <modify-function signature="resetArray(QSurfaceDataArray*)" remove="all"/> - <add-function signature="resetArray(const QSurfaceDataArray&)"> - <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp" - snippet="dataproxy-resetarray"/> - <modify-argument index="1"> - <parent index="this" action="add"/> - </modify-argument> - </add-function> - <add-function signature="resetArrayNp(double@x@,double@deltaX@,double@z@,double@deltaZ@,PyArrayObject*@data@)"> <inject-code file="../glue/qtgraphs.cpp" snippet="graphs-qsurfacedataproxy-resetarraynp"/> @@ -461,6 +254,56 @@ <enum-type name="ColorStyle"/> <enum-type name="Theme"/> </object-type> + + <!-- 2D --> + <object-type name="QBarCategoryAxis"/> + <object-type name="QAbstractAxis"> + <enum-type name="AxisType"/> + </object-type> + <object-type name="QValueAxis"/> + <object-type name="QAbstractBarSeries"> + <enum-type name="LabelsPosition"/> + <modify-function signature="append(QBarSet*)"> + <modify-argument index="1"> + <parent index="this" action="add"/> + </modify-argument> + </modify-function> + <modify-function signature="append(QList<QBarSet*>)"> + <modify-argument index="1"> + <parent index="this" action="add"/> + </modify-argument> + </modify-function> + <modify-function signature="insert(int,QBarSet*)"> + <modify-argument index="2"> + <parent index="this" action="add"/> + </modify-argument> + </modify-function> + <modify-function signature="take(QBarSet*)"> + <modify-argument index="1"> + <parent index="this" action="add"/> + </modify-argument> + </modify-function> + </object-type> + <object-type name="QBarSeries"/> + <object-type name="QBarSet"/> + <object-type name="QLineSeries"/> + <object-type name="QAbstractSeries"> + <enum-type name="SeriesType"/> + </object-type> + <object-type name="QScatterSeries"/> + <object-type name="QGraphTheme"> + <enum-type name="ColorTheme"/> + <!-- missing symbols --> + <modify-function signature="graphSeriesCount()const" remove="all"/> + <modify-function signature="setGraphSeriesCount(int)" remove="all"/> + <modify-function signature="graphSeriesColor(int)const" remove="all"/> + </object-type> + <object-type name="QSeriesTheme"> + <enum-type name="SeriesColorTheme"/> + </object-type> + <object-type name="QXYSeries"> + </object-type> + <extra-includes> <include file-name="qutils.h" location="global"/> </extra-includes> diff --git a/sources/pyside6/PySide6/glue/qtgraphs.cpp b/sources/pyside6/PySide6/glue/qtgraphs.cpp index cf1a10eba..b5a5db799 100644 --- a/sources/pyside6/PySide6/glue/qtgraphs.cpp +++ b/sources/pyside6/PySide6/glue/qtgraphs.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only // @snippet graphs-qsurfacedataproxy-resetarraynp -auto *data = QtGraphsHelper::surfaceDataFromNp(%1, %2, %3, %4, %5); +auto data = QtGraphsHelper::surfaceDataFromNp(%1, %2, %3, %4, %5); // %CPPSELF.%FUNCTION_NAME %CPPSELF.resetArray(data); // @snippet graphs-qsurfacedataproxy-resetarraynp diff --git a/sources/pyside6/PySide6/qtgraphs_helper.h b/sources/pyside6/PySide6/qtgraphs_helper.h index 91ef818d3..726f5fb37 100644 --- a/sources/pyside6/PySide6/qtgraphs_helper.h +++ b/sources/pyside6/PySide6/qtgraphs_helper.h @@ -11,8 +11,8 @@ namespace QtGraphsHelper { -QSurfaceDataArray *surfaceDataFromNp(double x, double deltaX, double z, double deltaZ, - PyObject *data); +QSurfaceDataArray surfaceDataFromNp(double x, double deltaX, double z, double deltaZ, + PyObject *data); } // namespace QtGraphsHelper |