diff options
author | Christian Tismer <ctismer@gmail.com> | 2015-07-20 20:42:11 +0200 |
---|---|---|
committer | Christian Tismer <ctismer@gmail.com> | 2015-07-20 20:42:11 +0200 |
commit | 638c4adf4f27d5133361a152890db299f0d7036b (patch) | |
tree | 38efcf80377b0c0993273a2d11cdfa51a23b33e3 | |
parent | aa9e8b2b529d012e0a324c5d1082737456be5c6e (diff) |
fix the matrix handling of QtGui.
This was pretty hairy for me, but finally I found a solution this timer.
See comment on "HAIRY TRICK" in typesystem_gui_common.xml
Took more than half the day to figure this out.
-rw-r--r-- | PySide/QtGui/CMakeLists.txt | 9 | ||||
-rw-r--r-- | PySide/QtGui/typesystem_gui_common.xml | 148 | ||||
-rw-r--r-- | PySide/typesystem_templates.xml | 10 |
3 files changed, 90 insertions, 77 deletions
diff --git a/PySide/QtGui/CMakeLists.txt b/PySide/QtGui/CMakeLists.txt index d48a7d376..67cd5798d 100644 --- a/PySide/QtGui/CMakeLists.txt +++ b/PySide/QtGui/CMakeLists.txt @@ -63,6 +63,15 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qkeyevent_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qkeysequence_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qlineargradient_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmatrix_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmatrix2x2_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmatrix2x3_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmatrix2x4_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmatrix3x2_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmatrix3x3_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmatrix3x4_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmatrix4x2_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmatrix4x3_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmatrix4x4_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmouseevent_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmoveevent_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmovie_wrapper.cpp diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index e023abf45..e06f4959f 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -167,7 +167,6 @@ <rejection class="QPolygon" function-name="point"/> <rejection class="QActionGroup" function-name="selected"/> <rejection class="QPaintEngine" function-name="fix_neg_rect"/> - <rejection class="*" enum-name="enum_1"/> <value-type name="QTransform"> <enum-type name="TransformationType"/> <add-function signature="__repr__" return-type="PyObject*"> @@ -658,6 +657,8 @@ </value-type> <value-type name="QItemSelection" /> + + <!-- Qt5: this _should_ be obsolete, but QImage is still using it... --> <value-type name="QMatrix"> <extra-includes> <include file-name="QPainterPath" location="global"/> @@ -721,6 +722,7 @@ </inject-code> </modify-function> </value-type> + <value-type name="QConicalGradient" polymorphic-id-expression="%1->type() == QGradient::ConicalGradient" /> <value-type name="QFontInfo" /> <value-type name="QRadialGradient" polymorphic-id-expression="%1->type() == QGradient::RadialGradient" /> @@ -1523,7 +1525,6 @@ <object-type name="QRegExpValidator" /> - <!-- Qt5: QtMultimedia <object-type name="QSound"/> --> <object-type name="QStandardItem"> <enum-type name="ItemType"/> <modify-function signature="operator<(QStandardItem)const"> @@ -2394,33 +2395,12 @@ </modify-function> </object-type> - <!-- _______ Qt5: begin of matrix block _________ - - """ - The problem: - QMatrixNxM objects were always based upon the qreal type. - Since Qt5.0, this has been changed to the float type, for some - complicated reasons (long discussions, see for instance - https://groups.google.com/forum/#!topic/qt-project-list-development/dPcP3NASY1k - ) - - This creates a few problems in doing the conversion right, and also - looses accuracy. I understand the lengthy discussion about this, - my question is simply if it is worth the effort to support these - functions in python, when it looses accuracy, but python uses double, anyway. - Does this make sense? - - Before we agree on a strategy how to treat these matrices in the future, - I (ctismer) am saving the time to implement this change. Therefore, the matrix - stuff is commented out for now. - """ - <value-type name="QMatrix2x2" since="4.6"> <add-function signature="__repr__" return-type="PyObject*"> <inject-code class="target" position="beginning"> <insert-template name="repr_code_matrix"> <replace from="%MATRIX_SIZE" to="4" /> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> </insert-template> </inject-code> </add-function> @@ -2428,7 +2408,7 @@ <add-function signature="__reduce__" return-type="PyObject*"> <inject-code class="target" position="beginning"> <insert-template name="reduce_code_matrix"> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> <replace from="%MATRIX_SIZE" to="4" /> </insert-template> </inject-code> @@ -2440,7 +2420,7 @@ </insert-template> </inject-code> </add-function> - <add-function signature="data()" return-type="qreal"> + <add-function signature="data()" return-type="float"> <inject-code class="target" position="beginning"> <insert-template name="matrix_data_function"> <replace from="%MATRIX_SIZE" to="4" /> @@ -2480,7 +2460,7 @@ return %CONVERTTOPYTHON[%RETURN_TYPE](*%CPPSELF); </template> - <add-function signature="operator*=(qreal)" return-type="QMatrix2x2" > + <add-function signature="operator*=(float)" return-type="QMatrix2x2" > <inject-code class="target" position="beginning"> <insert-template name="inplace_mult"/> </inject-code> @@ -2495,7 +2475,7 @@ <insert-template name="inplace_sub"/> </inject-code> </add-function> - <add-function signature="operator/=(qreal)" return-type="QMatrix2x2" > + <add-function signature="operator/=(float)" return-type="QMatrix2x2" > <inject-code class="target" position="beginning"> <insert-template name="inplace_div"/> </inject-code> @@ -2508,7 +2488,7 @@ <inject-code class="target" position="beginning"> <insert-template name="repr_code_matrix"> <replace from="%MATRIX_SIZE" to="6" /> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> </insert-template> </inject-code> </add-function> @@ -2516,7 +2496,7 @@ <add-function signature="__reduce__" return-type="PyObject*"> <inject-code class="target" position="beginning"> <insert-template name="reduce_code_matrix"> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> <replace from="%MATRIX_SIZE" to="6" /> </insert-template> </inject-code> @@ -2528,7 +2508,7 @@ </insert-template> </inject-code> </add-function> - <add-function signature="data()" return-type="qreal"> + <add-function signature="data()" return-type="float"> <inject-code class="target" position="beginning"> <insert-template name="matrix_data_function"> <replace from="%MATRIX_SIZE" to="6" /> @@ -2550,7 +2530,7 @@ </inject-code> </add-function> <add-function signature="operator!=(const QMatrix2x3&)" return-type="bool" /> - <add-function signature="operator*=(qreal)" return-type="QMatrix2x3" > + <add-function signature="operator*=(float)" return-type="QMatrix2x3" > <inject-code class="target" position="beginning"> <insert-template name="inplace_mult"/> </inject-code> @@ -2565,7 +2545,7 @@ <insert-template name="inplace_sub"/> </inject-code> </add-function> - <add-function signature="operator/=(qreal)" return-type="QMatrix2x3" > + <add-function signature="operator/=(float)" return-type="QMatrix2x3" > <inject-code class="target" position="beginning"> <insert-template name="inplace_div"/> </inject-code> @@ -2578,7 +2558,7 @@ <inject-code class="target" position="beginning"> <insert-template name="repr_code_matrix"> <replace from="%MATRIX_SIZE" to="8" /> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> </insert-template> </inject-code> </add-function> @@ -2586,7 +2566,7 @@ <add-function signature="__reduce__" return-type="PyObject*"> <inject-code class="target" position="beginning"> <insert-template name="reduce_code_matrix"> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> <replace from="%MATRIX_SIZE" to="8" /> </insert-template> </inject-code> @@ -2598,7 +2578,7 @@ </insert-template> </inject-code> </add-function> - <add-function signature="data()" return-type="qreal"> + <add-function signature="data()" return-type="float"> <inject-code class="target" position="beginning"> <insert-template name="matrix_data_function"> <replace from="%MATRIX_SIZE" to="8" /> @@ -2620,7 +2600,7 @@ </inject-code> </add-function> <add-function signature="operator!=(const QMatrix2x4&)" return-type="bool" /> - <add-function signature="operator*=(qreal)" return-type="QMatrix2x4" > + <add-function signature="operator*=(float)" return-type="QMatrix2x4" > <inject-code class="target" position="beginning"> <insert-template name="inplace_mult"/> </inject-code> @@ -2635,7 +2615,7 @@ <insert-template name="inplace_sub"/> </inject-code> </add-function> - <add-function signature="operator/=(qreal)" return-type="QMatrix2x4" > + <add-function signature="operator/=(float)" return-type="QMatrix2x4" > <inject-code class="target" position="beginning"> <insert-template name="inplace_div"/> </inject-code> @@ -2648,7 +2628,7 @@ <inject-code class="target" position="beginning"> <insert-template name="repr_code_matrix"> <replace from="%MATRIX_SIZE" to="6" /> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> </insert-template> </inject-code> </add-function> @@ -2656,7 +2636,7 @@ <add-function signature="__reduce__" return-type="PyObject*"> <inject-code class="target" position="beginning"> <insert-template name="reduce_code_matrix"> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> <replace from="%MATRIX_SIZE" to="6" /> </insert-template> </inject-code> @@ -2668,7 +2648,7 @@ </insert-template> </inject-code> </add-function> - <add-function signature="data()" return-type="qreal"> + <add-function signature="data()" return-type="float"> <inject-code class="target" position="beginning"> <insert-template name="matrix_data_function"> <replace from="%MATRIX_SIZE" to="6" /> @@ -2690,7 +2670,7 @@ </inject-code> </add-function> <add-function signature="operator!=(const QMatrix3x2&)" return-type="bool" /> - <add-function signature="operator*=(qreal)" return-type="QMatrix3x2" > + <add-function signature="operator*=(float)" return-type="QMatrix3x2" > <inject-code class="target" position="beginning"> <insert-template name="inplace_mult"/> </inject-code> @@ -2705,7 +2685,7 @@ <insert-template name="inplace_sub"/> </inject-code> </add-function> - <add-function signature="operator/=(qreal)" return-type="QMatrix3x2" > + <add-function signature="operator/=(float)" return-type="QMatrix3x2" > <inject-code class="target" position="beginning"> <insert-template name="inplace_div"/> </inject-code> @@ -2718,7 +2698,7 @@ <inject-code class="target" position="beginning"> <insert-template name="repr_code_matrix"> <replace from="%MATRIX_SIZE" to="9" /> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> </insert-template> </inject-code> </add-function> @@ -2726,7 +2706,7 @@ <add-function signature="__reduce__" return-type="PyObject*"> <inject-code class="target" position="beginning"> <insert-template name="reduce_code_matrix"> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> <replace from="%MATRIX_SIZE" to="9" /> </insert-template> </inject-code> @@ -2738,7 +2718,7 @@ </insert-template> </inject-code> </add-function> - <add-function signature="data()" return-type="qreal"> + <add-function signature="data()" return-type="float"> <inject-code class="target" position="beginning"> <insert-template name="matrix_data_function"> <replace from="%MATRIX_SIZE" to="9" /> @@ -2760,7 +2740,7 @@ </inject-code> </add-function> <add-function signature="operator!=(const QMatrix3x3&)" return-type="bool" /> - <add-function signature="operator*=(qreal)" return-type="QMatrix3x3" > + <add-function signature="operator*=(float)" return-type="QMatrix3x3" > <inject-code class="target" position="beginning"> <insert-template name="inplace_mult"/> </inject-code> @@ -2775,7 +2755,7 @@ <insert-template name="inplace_sub"/> </inject-code> </add-function> - <add-function signature="operator/=(qreal)" return-type="QMatrix3x3" > + <add-function signature="operator/=(float)" return-type="QMatrix3x3" > <inject-code class="target" position="beginning"> <insert-template name="inplace_div"/> </inject-code> @@ -2788,7 +2768,7 @@ <inject-code class="target" position="beginning"> <insert-template name="repr_code_matrix"> <replace from="%MATRIX_SIZE" to="12" /> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> </insert-template> </inject-code> </add-function> @@ -2796,7 +2776,7 @@ <add-function signature="__reduce__" return-type="PyObject*"> <inject-code class="target" position="beginning"> <insert-template name="reduce_code_matrix"> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> <replace from="%MATRIX_SIZE" to="12" /> </insert-template> </inject-code> @@ -2808,7 +2788,7 @@ </insert-template> </inject-code> </add-function> - <add-function signature="data()" return-type="qreal"> + <add-function signature="data()" return-type="float"> <inject-code class="target" position="beginning"> <insert-template name="matrix_data_function"> <replace from="%MATRIX_SIZE" to="12" /> @@ -2830,7 +2810,7 @@ </inject-code> </add-function> <add-function signature="operator!=(const QMatrix3x4&)" return-type="bool" /> - <add-function signature="operator*=(qreal)" return-type="QMatrix3x4" > + <add-function signature="operator*=(float)" return-type="QMatrix3x4" > <inject-code class="target" position="beginning"> <insert-template name="inplace_mult"/> </inject-code> @@ -2845,7 +2825,7 @@ <insert-template name="inplace_sub"/> </inject-code> </add-function> - <add-function signature="operator/=(qreal)" return-type="QMatrix3x4" > + <add-function signature="operator/=(float)" return-type="QMatrix3x4" > <inject-code class="target" position="beginning"> <insert-template name="inplace_div"/> </inject-code> @@ -2858,7 +2838,7 @@ <inject-code class="target" position="beginning"> <insert-template name="repr_code_matrix"> <replace from="%MATRIX_SIZE" to="8" /> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> </insert-template> </inject-code> </add-function> @@ -2866,7 +2846,7 @@ <add-function signature="__reduce__" return-type="PyObject*"> <inject-code class="target" position="beginning"> <insert-template name="reduce_code_matrix"> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> <replace from="%MATRIX_SIZE" to="8" /> </insert-template> </inject-code> @@ -2878,7 +2858,7 @@ </insert-template> </inject-code> </add-function> - <add-function signature="data()" return-type="qreal"> + <add-function signature="data()" return-type="float"> <inject-code class="target" position="beginning"> <insert-template name="matrix_data_function"> <replace from="%MATRIX_SIZE" to="8" /> @@ -2900,7 +2880,7 @@ </inject-code> </add-function> <add-function signature="operator!=(const QMatrix4x2&)" return-type="bool" /> - <add-function signature="operator*=(qreal)" return-type="QMatrix4x2" > + <add-function signature="operator*=(float)" return-type="QMatrix4x2" > <inject-code class="target" position="beginning"> <insert-template name="inplace_mult"/> </inject-code> @@ -2915,7 +2895,7 @@ <insert-template name="inplace_sub"/> </inject-code> </add-function> - <add-function signature="operator/=(qreal)" return-type="QMatrix4x2" > + <add-function signature="operator/=(float)" return-type="QMatrix4x2" > <inject-code class="target" position="beginning"> <insert-template name="inplace_div"/> </inject-code> @@ -2928,7 +2908,7 @@ <inject-code class="target" position="beginning"> <insert-template name="repr_code_matrix"> <replace from="%MATRIX_SIZE" to="12" /> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> </insert-template> </inject-code> </add-function> @@ -2936,7 +2916,7 @@ <add-function signature="__reduce__" return-type="PyObject*"> <inject-code class="target" position="beginning"> <insert-template name="reduce_code_matrix"> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> <replace from="%MATRIX_SIZE" to="12" /> </insert-template> </inject-code> @@ -2948,7 +2928,7 @@ </insert-template> </inject-code> </add-function> - <add-function signature="data()" return-type="qreal"> + <add-function signature="data()" return-type="float"> <inject-code class="target" position="beginning"> <insert-template name="matrix_data_function"> <replace from="%MATRIX_SIZE" to="12" /> @@ -2970,7 +2950,7 @@ </inject-code> </add-function> <add-function signature="operator!=(const QMatrix4x3&)" return-type="bool" /> - <add-function signature="operator*=(qreal)" return-type="QMatrix4x3" > + <add-function signature="operator*=(float)" return-type="QMatrix4x3" > <inject-code class="target" position="beginning"> <insert-template name="inplace_mult"/> </inject-code> @@ -2985,7 +2965,7 @@ <insert-template name="inplace_sub"/> </inject-code> </add-function> - <add-function signature="operator/=(qreal)" return-type="QMatrix4x3" > + <add-function signature="operator/=(float)" return-type="QMatrix4x3" > <inject-code class="target" position="beginning"> <insert-template name="inplace_div"/> </inject-code> @@ -2994,11 +2974,34 @@ </value-type> <value-type name="QMatrix4x4" since="4.6"> + + + <!-- Qt5: HAIRY TRICK ALERT ahead! + Qt5 partially replaced 'qreal' by float. + That had the side effect that all matrix types did not work any longer. + + Reason (I guess): + + The signature "QList<qreal>" is needed by the __reduce__ methods, + but created by some other object used elsewhere. + After the matrix type was changed, "QList<float>" was nowhere created. + + I don't know an explicit way to produce the right conversion function, so what I did + was to create a dummy function and immediately dele it again. + This has the desired effect of creating the implicitly needed "QList<float>" + conversion, although the dummy function goes away. + + Q: Do you know a better solution? + --> + <add-function signature="__dummy(const QList<float > &)"/> + <modify-function signature="__dummy(const QList<float > &)" remove="all"/> + <!-- that was the trick ^^^^^^^^^^^^^^^^^^^^^^ --> + <add-function signature="__repr__" return-type="PyObject*"> <inject-code class="target" position="beginning"> <insert-template name="repr_code_matrix"> <replace from="%MATRIX_SIZE" to="16" /> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> </insert-template> </inject-code> </add-function> @@ -3006,13 +3009,13 @@ <add-function signature="__reduce__" return-type="PyObject*"> <inject-code class="target" position="beginning"> <insert-template name="reduce_code_matrix"> - <replace from="%MATRIX_TYPE" to="qreal" /> + <replace from="%MATRIX_TYPE" to="float" /> <replace from="%MATRIX_SIZE" to="16" /> </insert-template> </inject-code> </add-function> - --> <!-- ### "QMatrix4x4(const qreal*,int,int)" is an internal constructor. --> <!-- + <!-- ### "QMatrix4x4(const float*,int,int)" is an internal constructor. --> <modify-function signature="QMatrix4x4(const float*,int,int)" remove="all"/> <modify-function signature="QMatrix4x4(const float*)"> @@ -3021,7 +3024,7 @@ </modify-argument> <inject-code class="target" position="beginning"> if (PySequence_Size(%PYARG_1) == 16) { - qreal values[16]; + float values[16]; for(int i=0; i < 16; i++) { PyObject *pv = PySequence_Fast_GET_ITEM(%PYARG_1, i); values[i] = PyFloat_AsDouble(pv); @@ -3049,7 +3052,7 @@ <replace-type modified-type="PyTupleObject*"/> </modify-argument> <inject-code class="target" position="beginning"> - qreal values[16]; + float values[16]; %CPPSELF.%FUNCTION_NAME(values); %PYARG_0 = PyTuple_New(16); for(int i=0; i < 16; i++) { @@ -3071,10 +3074,10 @@ </inject-code> </modify-function> - --> <!-- ### "constData() const" and "data() const" are unnecessary in Python and their function is performed by "data()". --> <!-- + <!-- ### "constData() const" and "data() const" are unnecessary in Python and their function is performed by "data()". --> <modify-function signature="data() const" remove="all"/> <modify-function signature="constData() const" remove="all"/> - --> <!-- ### --> <!-- + <!-- ### --> <modify-function signature="operator()(int, int) const" remove="all"/> <modify-function signature="operator()(int, int)" remove="all"/> <add-function signature="__mgetitem__" return-type="PyObject*"> @@ -3086,8 +3089,8 @@ PyObject* posy = PySequence_Fast_GET_ITEM(key.object(), 1); Py_ssize_t x = PyInt_AsSsize_t(posx); Py_ssize_t y = PyInt_AsSsize_t(posy); - qreal ret = (*%CPPSELF)(x,y); - return %CONVERTTOPYTHON[qreal](ret); + float ret = (*%CPPSELF)(x,y); + return %CONVERTTOPYTHON[float](ret); } } PyErr_SetString(PyExc_IndexError, "Invalid matrix index."); @@ -3221,6 +3224,7 @@ <suppress-warning text="enum 'q_static_assert_result39' does not have a type entry or is not an enum"/> <suppress-warning text="template baseclass 'QListSpecialMethods<T>' of 'QList' is not known"/> <suppress-warning text="horribly broken type ''"/> + <suppress-warning text="template baseclass 'QGenericMatrix<float>' of '*' is not known"/> <!-- Qt5: this whole printer stuff goes to module QtPrintSupport diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index 980a5fb3a..c72c25821 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -326,27 +326,27 @@ <template name="matrix_constructor"> if (PySequence_Size(%PYARG_1) == %SIZE) { Shiboken::AutoDecRef fast(PySequence_Fast(%PYARG_1, "Failed to parse sequence on %TYPE constructor.")); - qreal values[%SIZE]; + float values[%SIZE]; for(int i=0; i < %SIZE; i++) { PyObject *pv = PySequence_Fast_GET_ITEM(fast.object(), i); - values[i] = %CONVERTTOCPP[qreal](pv); + values[i] = %CONVERTTOCPP[float](pv); } %0 = new %TYPE(values); } </template> <template name="matrix_data_function"> - const qreal* data = %CPPSELF.constData(); + const float* data = %CPPSELF.constData(); PyObject *pyData = PyTuple_New(%MATRIX_SIZE); if (data) { for(int i=0; i < %MATRIX_SIZE; i++) - PyTuple_SET_ITEM(pyData, i, %CONVERTTOPYTHON[qreal](data[i])); + PyTuple_SET_ITEM(pyData, i, %CONVERTTOPYTHON[float](data[i])); } return pyData; </template> <template name="matrix_fill_function"> - qreal value = %CONVERTTOCPP[qreal](%PYARG_1); + float value = %CONVERTTOCPP[float](%PYARG_1); %CPPSELF.fill(value); </template> |