aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6/QtCharts
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-16 10:19:17 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-21 13:20:15 +0200
commit6389561fd75e80c69d7c83f6a87d988450a2e569 (patch)
tree5cbb981cfc1f9f3f3124fbd06a81fd6944498e35 /sources/pyside6/PySide6/QtCharts
parentdb52b6e6ec926f48679d091f7afa42f514b5e71c (diff)
Add a numpy overload for some functions taking lists of QPointF
Add functions taking x,y data in the form of numpy-vectors (as common for matplotlib, etc) for: QPainter::drawPoints() QXYSeries::append(), QXYSeries::replace() They are added as separate functions instead of overloads since there is a restriction in that numpy arrays cause an error: FIXME Subscripted generics cannot be used with class and instance checks when passed to other type check macros. Task-number: PYSIDE-1540 Task-number: PYSIDE-1503 Change-Id: Ie1521ce19127bb0641fbdb4f7320a8707682724e Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6/QtCharts')
-rw-r--r--sources/pyside6/PySide6/QtCharts/typesystem_charts.xml13
1 files changed, 12 insertions, 1 deletions
diff --git a/sources/pyside6/PySide6/QtCharts/typesystem_charts.xml b/sources/pyside6/PySide6/QtCharts/typesystem_charts.xml
index 643201f6d..6a325431b 100644
--- a/sources/pyside6/PySide6/QtCharts/typesystem_charts.xml
+++ b/sources/pyside6/PySide6/QtCharts/typesystem_charts.xml
@@ -266,5 +266,16 @@
<object-type name="QVXYModelMapper"/>
<object-type name="QXYLegendMarker"/>
<object-type name="QXYModelMapper"/>
- <object-type name="QXYSeries"/>
+ <!-- Add numpy versions as separate functions since passing ndarrays to other
+ typecheck macros causes:
+ FIXME Subscripted generics cannot be used with class and instance checks -->
+ <object-type name="QXYSeries">
+ <include file-name="pyside_numpy.h" location="global"/>
+ <add-function signature="appendNp(PyArrayObject *, PyArrayObject *)">
+ <inject-code file="../glue/qtcharts.cpp" snippet="qxyseries-appendnp-numpy-x-y"/>
+ </add-function>
+ <add-function signature="replaceNp(PyArrayObject *, PyArrayObject *)">
+ <inject-code file="../glue/qtcharts.cpp" snippet="qxyseries-replacenp-numpy-x-y"/>
+ </add-function>
+ </object-type>
</typesystem>