Implemented support to deep copy on QtCore.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Lauro Neto <lauro.neto@openbossa.org>
This commit is contained in:
parent
eb9b436390
commit
ce09bd623b
3 changed files with 203 additions and 71 deletions
|
|
@ -671,6 +671,14 @@
|
||||||
</extra-includes>
|
</extra-includes>
|
||||||
</object-type>
|
</object-type>
|
||||||
<value-type name="QLine" hash-function="PySide::hash">
|
<value-type name="QLine" hash-function="PySide::hash">
|
||||||
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="reduce_code">
|
||||||
|
<replace from="%REDUCE_FORMAT" to="(iiii)" />
|
||||||
|
<replace from="%REDUCE_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()" />
|
||||||
|
</insert-template>
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
<inject-code class="native" position="beginning">
|
<inject-code class="native" position="beginning">
|
||||||
namespace PySide {
|
namespace PySide {
|
||||||
template<> inline uint hash(const QLine& v) {
|
template<> inline uint hash(const QLine& v) {
|
||||||
|
|
@ -681,6 +689,14 @@
|
||||||
</value-type>
|
</value-type>
|
||||||
<value-type name="QLineF">
|
<value-type name="QLineF">
|
||||||
<enum-type name="IntersectType" />
|
<enum-type name="IntersectType" />
|
||||||
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="reduce_code">
|
||||||
|
<replace from="%REDUCE_FORMAT" to="(dddd)" />
|
||||||
|
<replace from="%REDUCE_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()" />
|
||||||
|
</insert-template>
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
<modify-function signature="intersect(QLineF, QPointF*)const">
|
<modify-function signature="intersect(QLineF, QPointF*)const">
|
||||||
<modify-argument index="2">
|
<modify-argument index="2">
|
||||||
<remove-argument />
|
<remove-argument />
|
||||||
|
|
@ -726,13 +742,12 @@
|
||||||
<include file-name="datetime.h" location="global"/>
|
<include file-name="datetime.h" location="global"/>
|
||||||
</extra-includes>
|
</extra-includes>
|
||||||
<enum-type name="MonthNameType"/>
|
<enum-type name="MonthNameType"/>
|
||||||
<modify-function signature="julianToGregorian(uint,int&,int&,int&)" remove="all"/>
|
|
||||||
<add-function signature="__reduce__" return-type="PyObject*">
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
<inject-code class="target" position="beginning">
|
<inject-code class="target" position="beginning">
|
||||||
<insert-template name="reduce_start"/>
|
<insert-template name="reduce_code">
|
||||||
args = Py_BuildValue("(iii)", %CPPSELF.year(), %CPPSELF.month(),
|
<replace from="%REDUCE_FORMAT" to="(iii)" />
|
||||||
%CPPSELF.day());
|
<replace from="%REDUCE_ARGS" to="%CPPSELF.year(), %CPPSELF.month(), %CPPSELF.day()" />
|
||||||
<insert-template name="reduce_finish"/>
|
</insert-template>
|
||||||
</inject-code>
|
</inject-code>
|
||||||
</add-function>
|
</add-function>
|
||||||
<modify-function signature="getDate(int*,int*,int*)" >
|
<modify-function signature="getDate(int*,int*,int*)" >
|
||||||
|
|
@ -767,6 +782,7 @@
|
||||||
%PYARG_0 = Shiboken::makeTuple(week, yearNumber);
|
%PYARG_0 = Shiboken::makeTuple(week, yearNumber);
|
||||||
</inject-code>
|
</inject-code>
|
||||||
</modify-function>
|
</modify-function>
|
||||||
|
<modify-function signature="julianToGregorian(uint,int&,int&,int&)" remove="all"/>
|
||||||
</value-type>
|
</value-type>
|
||||||
<value-type name="QDateTime" hash-function="PySide::hash">
|
<value-type name="QDateTime" hash-function="PySide::hash">
|
||||||
<conversion-rule class="target" file="qdatetime_conversions.h"/>
|
<conversion-rule class="target" file="qdatetime_conversions.h"/>
|
||||||
|
|
@ -786,24 +802,36 @@
|
||||||
</add-function>
|
</add-function>
|
||||||
<add-function signature="__reduce__" return-type="PyObject*">
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
<inject-code class="target" position="beginning">
|
<inject-code class="target" position="beginning">
|
||||||
<insert-template name="reduce_start"/>
|
<insert-template name="reduce_code">
|
||||||
QDate date = %CPPSELF.date();
|
<replace from="%REDUCE_FORMAT" to="(iiiiiiii)" />
|
||||||
QTime time = %CPPSELF.time();
|
<replace from="%REDUCE_ARGS" to="%CPPSELF.date().year(), %CPPSELF.date().month(), %CPPSELF.date().day(), %CPPSELF.time().hour(), %CPPSELF.time().minute(), %CPPSELF.time().second(), %CPPSELF.time().msec(), (int)%CPPSELF.timeSpec()" />
|
||||||
args = Py_BuildValue("(iiiiiiii)", date.year(), date.month(),
|
</insert-template>
|
||||||
date.day(), time.hour(),
|
|
||||||
time.minute(), time.second(),
|
|
||||||
time.msec(), (int)%CPPSELF.timeSpec());
|
|
||||||
<insert-template name="reduce_finish"/>
|
|
||||||
</inject-code>
|
</inject-code>
|
||||||
</add-function>
|
</add-function>
|
||||||
</value-type>
|
</value-type>
|
||||||
<value-type name="QDir">
|
<value-type name="QDir">
|
||||||
<enum-type name="Filter" flags="QDir::Filters"/>
|
<enum-type name="Filter" flags="QDir::Filters"/>
|
||||||
<enum-type name="SortFlag" flags="QDir::SortFlags" />
|
<enum-type name="SortFlag" flags="QDir::SortFlags" />
|
||||||
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="reduce_code">
|
||||||
|
<replace from="%REDUCE_FORMAT" to="(s)" />
|
||||||
|
<replace from="%REDUCE_ARGS" to="qPrintable(%CPPSELF.path())" />
|
||||||
|
</insert-template>
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
<modify-function signature="QDir(QString,QString,QFlags<QDir::SortFlag>,QFlags<QDir::Filter>)" remove="all" />
|
<modify-function signature="QDir(QString,QString,QFlags<QDir::SortFlag>,QFlags<QDir::Filter>)" remove="all" />
|
||||||
</value-type>
|
</value-type>
|
||||||
|
|
||||||
<value-type name="QPoint" hash-function="PySide::hash">
|
<value-type name="QPoint" hash-function="PySide::hash">
|
||||||
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="reduce_code">
|
||||||
|
<replace from="%REDUCE_FORMAT" to="(ii)" />
|
||||||
|
<replace from="%REDUCE_ARGS" to="%CPPSELF.x(), %CPPSELF.y()" />
|
||||||
|
</insert-template>
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
<inject-code class="native" position="beginning">
|
<inject-code class="native" position="beginning">
|
||||||
namespace PySide {
|
namespace PySide {
|
||||||
template<> inline uint hash(const QPoint& v) {
|
template<> inline uint hash(const QPoint& v) {
|
||||||
|
|
@ -815,10 +843,26 @@
|
||||||
<modify-function signature="ry()" remove="all"/>
|
<modify-function signature="ry()" remove="all"/>
|
||||||
</value-type>
|
</value-type>
|
||||||
<value-type name="QPointF">
|
<value-type name="QPointF">
|
||||||
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="reduce_code">
|
||||||
|
<replace from="%REDUCE_FORMAT" to="(dd)" />
|
||||||
|
<replace from="%REDUCE_ARGS" to="%CPPSELF.x(), %CPPSELF.y()" />
|
||||||
|
</insert-template>
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
<modify-function signature="rx()" remove="all"/>
|
<modify-function signature="rx()" remove="all"/>
|
||||||
<modify-function signature="ry()" remove="all"/>
|
<modify-function signature="ry()" remove="all"/>
|
||||||
</value-type>
|
</value-type>
|
||||||
<value-type name="QRect" hash-function="PySide::hash">
|
<value-type name="QRect" hash-function="PySide::hash">
|
||||||
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="reduce_code">
|
||||||
|
<replace from="%REDUCE_FORMAT" to="(iiii)" />
|
||||||
|
<replace from="%REDUCE_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.width(), %CPPSELF.height()" />
|
||||||
|
</insert-template>
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
<inject-code class="native" position="beginning">
|
<inject-code class="native" position="beginning">
|
||||||
namespace PySide {
|
namespace PySide {
|
||||||
template<> inline uint hash(const QRect& v) {
|
template<> inline uint hash(const QRect& v) {
|
||||||
|
|
@ -832,35 +876,32 @@
|
||||||
<modify-function signature="getRect(int*,int*,int*,int*)const">
|
<modify-function signature="getRect(int*,int*,int*,int*)const">
|
||||||
<remove/>
|
<remove/>
|
||||||
</modify-function>
|
</modify-function>
|
||||||
<add-function signature="__reduce__" return-type="PyObject*">
|
|
||||||
<inject-code class="target" position="beginning">
|
|
||||||
<insert-template name="reduce_start"/>
|
|
||||||
args = Py_BuildValue("(iiii)", %CPPSELF.x(), %CPPSELF.y(),
|
|
||||||
%CPPSELF.width(), %CPPSELF.height());
|
|
||||||
<insert-template name="reduce_finish"/>
|
|
||||||
</inject-code>
|
|
||||||
</add-function>
|
|
||||||
</value-type>
|
</value-type>
|
||||||
<value-type name="QRectF">
|
<value-type name="QRectF">
|
||||||
<modify-function signature="getCoords(qreal*,qreal*,qreal*,qreal*)const">
|
<!--
|
||||||
<remove/>
|
FIXME These functions return qreal. Will convert to double (format
|
||||||
</modify-function>
|
string) mess things up in other architectures?
|
||||||
<modify-function signature="getRect(qreal*,qreal*,qreal*,qreal*)const">
|
-->
|
||||||
<remove/>
|
|
||||||
</modify-function>
|
|
||||||
<add-function signature="__reduce__" return-type="PyObject*">
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
<inject-code class="target" position="beginning">
|
<inject-code class="target" position="beginning">
|
||||||
<insert-template name="reduce_start"/>
|
<insert-template name="reduce_code">
|
||||||
// FIXME These functions return qreal. Will convert to double (format
|
<replace from="%REDUCE_FORMAT" to="(dddd)" />
|
||||||
// string) mess things up in other architectures?
|
<replace from="%REDUCE_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.width(), %CPPSELF.height()" />
|
||||||
args = Py_BuildValue("(dddd)", %CPPSELF.x(), %CPPSELF.y(),
|
</insert-template>
|
||||||
%CPPSELF.width(), %CPPSELF.height());
|
|
||||||
<insert-template name="reduce_finish"/>
|
|
||||||
</inject-code>
|
</inject-code>
|
||||||
</add-function>
|
</add-function>
|
||||||
|
<modify-function signature="getCoords(qreal*,qreal*,qreal*,qreal*)const" remove="all" />
|
||||||
|
<modify-function signature="getRect(qreal*,qreal*,qreal*,qreal*)const" remove="all" />
|
||||||
</value-type>
|
</value-type>
|
||||||
|
|
||||||
<value-type name="QSize" hash-function="PySide::hash">
|
<value-type name="QSize" hash-function="PySide::hash">
|
||||||
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="reduce_code">
|
||||||
|
<replace from="%REDUCE_FORMAT" to="(ii)" />
|
||||||
|
<replace from="%REDUCE_ARGS" to="%CPPSELF.width(), %CPPSELF.height()" />
|
||||||
|
</insert-template>
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
<inject-code class="native" position="beginning">
|
<inject-code class="native" position="beginning">
|
||||||
namespace PySide {
|
namespace PySide {
|
||||||
template<> inline uint hash(const QSize& v) {
|
template<> inline uint hash(const QSize& v) {
|
||||||
|
|
@ -870,41 +911,33 @@
|
||||||
</inject-code>
|
</inject-code>
|
||||||
<modify-function signature="rheight()" remove="all"/>
|
<modify-function signature="rheight()" remove="all"/>
|
||||||
<modify-function signature="rwidth()" remove="all"/>
|
<modify-function signature="rwidth()" remove="all"/>
|
||||||
<add-function signature="__reduce__" return-type="PyObject*">
|
|
||||||
<inject-code class="target" position="beginning">
|
|
||||||
<insert-template name="reduce_start"/>
|
|
||||||
args = Py_BuildValue("(ii)", %CPPSELF.width(), %CPPSELF.height());
|
|
||||||
<insert-template name="reduce_finish"/>
|
|
||||||
</inject-code>
|
|
||||||
</add-function>
|
|
||||||
</value-type>
|
</value-type>
|
||||||
<value-type name="QSizeF">
|
<value-type name="QSizeF">
|
||||||
<modify-function signature="rheight()" remove="all" />
|
|
||||||
<modify-function signature="rwidth()" remove="all" />
|
|
||||||
<add-function signature="__reduce__" return-type="PyObject*">
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
<inject-code class="target" position="beginning">
|
<inject-code class="target" position="beginning">
|
||||||
<insert-template name="reduce_start"/>
|
<insert-template name="reduce_code">
|
||||||
// FIXME These functions return qreal. Will convert to double (format
|
<replace from="%REDUCE_FORMAT" to="(dd)" />
|
||||||
// string) mess things up in other architectures?
|
<replace from="%REDUCE_ARGS" to="%CPPSELF.width(), %CPPSELF.height()" />
|
||||||
args = Py_BuildValue("(dd)", %CPPSELF.width(), %CPPSELF.height());
|
</insert-template>
|
||||||
<insert-template name="reduce_finish"/>
|
|
||||||
</inject-code>
|
</inject-code>
|
||||||
</add-function>
|
</add-function>
|
||||||
|
<modify-function signature="rheight()" remove="all" />
|
||||||
|
<modify-function signature="rwidth()" remove="all" />
|
||||||
</value-type>
|
</value-type>
|
||||||
|
|
||||||
<value-type name="QTime" hash-function="PySide::hash">
|
<value-type name="QTime" hash-function="PySide::hash">
|
||||||
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="reduce_code">
|
||||||
|
<replace from="%REDUCE_FORMAT" to="(iiii)" />
|
||||||
|
<replace from="%REDUCE_ARGS" to="%CPPSELF.hour(), %CPPSELF.minute(), %CPPSELF.second(), %CPPSELF.msec()" />
|
||||||
|
</insert-template>
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
<conversion-rule class="target" file="qtime_conversions.h"/>
|
<conversion-rule class="target" file="qtime_conversions.h"/>
|
||||||
<extra-includes>
|
<extra-includes>
|
||||||
<include file-name="datetime.h" location="global"/>
|
<include file-name="datetime.h" location="global"/>
|
||||||
</extra-includes>
|
</extra-includes>
|
||||||
<add-function signature="__reduce__" return-type="PyObject*">
|
|
||||||
<inject-code class="target" position="beginning">
|
|
||||||
<insert-template name="reduce_start"/>
|
|
||||||
args = Py_BuildValue("(iiii)", %CPPSELF.hour(), %CPPSELF.minute(),
|
|
||||||
%CPPSELF.second(), %CPPSELF.msec());
|
|
||||||
<insert-template name="reduce_finish"/>
|
|
||||||
</inject-code>
|
|
||||||
</add-function>
|
|
||||||
</value-type>
|
</value-type>
|
||||||
<value-type name="QPersistentModelIndex">
|
<value-type name="QPersistentModelIndex">
|
||||||
<modify-function signature="internalPointer()const" remove="all"/>
|
<modify-function signature="internalPointer()const" remove="all"/>
|
||||||
|
|
@ -913,6 +946,14 @@
|
||||||
<value-type name="QUuid">
|
<value-type name="QUuid">
|
||||||
<enum-type name="Variant"/>
|
<enum-type name="Variant"/>
|
||||||
<enum-type name="Version"/>
|
<enum-type name="Version"/>
|
||||||
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="reduce_code">
|
||||||
|
<replace from="%REDUCE_FORMAT" to="(s)" />
|
||||||
|
<replace from="%REDUCE_ARGS" to="qPrintable(%CPPSELF.toString())" />
|
||||||
|
</insert-template>
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
<modify-function signature="QUuid(const char*)" remove="all" />
|
<modify-function signature="QUuid(const char*)" remove="all" />
|
||||||
</value-type>
|
</value-type>
|
||||||
|
|
||||||
|
|
@ -1336,6 +1377,14 @@
|
||||||
<extra-includes>
|
<extra-includes>
|
||||||
<include file-name="QStringList" location="global"/>
|
<include file-name="QStringList" location="global"/>
|
||||||
</extra-includes>
|
</extra-includes>
|
||||||
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="reduce_code">
|
||||||
|
<replace from="%REDUCE_FORMAT" to="(s)" />
|
||||||
|
<replace from="%REDUCE_ARGS" to="qPrintable(%CPPSELF.toString())" />
|
||||||
|
</insert-template>
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
</value-type>
|
</value-type>
|
||||||
<value-type name="QRegExp">
|
<value-type name="QRegExp">
|
||||||
<enum-type name="CaretMode"/>
|
<enum-type name="CaretMode"/>
|
||||||
|
|
@ -1343,17 +1392,41 @@
|
||||||
<extra-includes>
|
<extra-includes>
|
||||||
<include file-name="QStringList" location="global"/>
|
<include file-name="QStringList" location="global"/>
|
||||||
</extra-includes>
|
</extra-includes>
|
||||||
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="reduce_code">
|
||||||
|
<replace from="%REDUCE_FORMAT" to="(sii)" />
|
||||||
|
<replace from="%REDUCE_ARGS" to="qPrintable(%CPPSELF.pattern()), (int)%CPPSELF.caseSensitivity(), (int)%CPPSELF.patternSyntax()" />
|
||||||
|
</insert-template>
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
</value-type>
|
</value-type>
|
||||||
<value-type name="QFileInfo">
|
<value-type name="QFileInfo">
|
||||||
<extra-includes>
|
<extra-includes>
|
||||||
<include file-name="QDateTime" location="global"/>
|
<include file-name="QDateTime" location="global"/>
|
||||||
<include file-name="QDir" location="global"/>
|
<include file-name="QDir" location="global"/>
|
||||||
</extra-includes>
|
</extra-includes>
|
||||||
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="reduce_code">
|
||||||
|
<replace from="%REDUCE_FORMAT" to="(s)" />
|
||||||
|
<replace from="%REDUCE_ARGS" to="qPrintable(%CPPSELF.filePath())" />
|
||||||
|
</insert-template>
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
</value-type>
|
</value-type>
|
||||||
<value-type name="QByteArray" hash-function="qHash">
|
<value-type name="QByteArray" hash-function="qHash">
|
||||||
<extra-includes>
|
<extra-includes>
|
||||||
<include file-name="QNoImplicitBoolCast" location="global"/>
|
<include file-name="QNoImplicitBoolCast" location="global"/>
|
||||||
</extra-includes>
|
</extra-includes>
|
||||||
|
<add-function signature="__reduce__" return-type="PyObject*">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
<insert-template name="reduce_code">
|
||||||
|
<replace from="%REDUCE_FORMAT" to="(s)" />
|
||||||
|
<replace from="%REDUCE_ARGS" to="%CPPSELF.constData()" />
|
||||||
|
</insert-template>
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
<modify-function signature="QByteArray(const char *)">
|
<modify-function signature="QByteArray(const char *)">
|
||||||
<!-- Keep \x00 bytes passed in python strings -->
|
<!-- Keep \x00 bytes passed in python strings -->
|
||||||
<inject-code class="target" position="beginning">
|
<inject-code class="target" position="beginning">
|
||||||
|
|
@ -1370,14 +1443,6 @@
|
||||||
#endif
|
#endif
|
||||||
</inject-code>
|
</inject-code>
|
||||||
|
|
||||||
<add-function signature="__reduce__" return-type="PyObject*">
|
|
||||||
<inject-code class="target" position="beginning">
|
|
||||||
<insert-template name="reduce_start"/>
|
|
||||||
args = Py_BuildValue("(s)", %CPPSELF.constData());
|
|
||||||
<insert-template name="reduce_finish"/>
|
|
||||||
</inject-code>
|
|
||||||
</add-function>
|
|
||||||
|
|
||||||
<!-- removed functions -->
|
<!-- removed functions -->
|
||||||
<modify-function signature="begin()" remove="all"/>
|
<modify-function signature="begin()" remove="all"/>
|
||||||
<modify-function signature="begin()const" remove="all"/>
|
<modify-function signature="begin()const" remove="all"/>
|
||||||
|
|
|
||||||
|
|
@ -187,12 +187,56 @@
|
||||||
Shiboken::setParent(%CONVERTTOPYTHON[QApplication*](qApp), %PYARG_0);
|
Shiboken::setParent(%CONVERTTOPYTHON[QApplication*](qApp), %PYARG_0);
|
||||||
</template>
|
</template>
|
||||||
<!-- templates for __reduce__ -->
|
<!-- templates for __reduce__ -->
|
||||||
<template name="reduce_start">
|
<template name="reduce_code">
|
||||||
PyObject *type = PyObject_Type(%PYSELF);
|
PyObject *type = PyObject_Type(%PYSELF);
|
||||||
PyObject *args = NULL;
|
PyObject *args = NULL;
|
||||||
|
args = Py_BuildValue("%REDUCE_FORMAT", %REDUCE_ARGS);
|
||||||
|
%PYARG_0 = Py_BuildValue("(NN)", type, args);
|
||||||
</template>
|
</template>
|
||||||
<template name="reduce_finish">
|
<template name="reduce_code_matrix">
|
||||||
%PYARG_0 = Py_BuildValue("(OO)", type, args);
|
QList< %MATRIX_TYPE > cppArgs;
|
||||||
|
%MATRIX_TYPE data[%MATRIX_SIZE];
|
||||||
|
%CPPSELF.copyDataTo(data);
|
||||||
|
int matrixSize = %MATRIX_SIZE;
|
||||||
|
for(int size=0; size < matrixSize; size++)
|
||||||
|
cppArgs.append(data[size]);
|
||||||
|
|
||||||
|
PyObject *type = PyObject_Type(%PYSELF);
|
||||||
|
PyObject *args = Py_BuildValue("(N)", %CONVERTTOPYTHON[QList<%MATRIX_TYPE> ](cppArgs));
|
||||||
|
%PYARG_0 = Py_BuildValue("(NN)", type, args);
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<!-- Matrix Aux functions -->
|
||||||
|
<template name="matrix_constructor">
|
||||||
|
if (PySequence_Size(%PYARG_1) == %SIZE) {
|
||||||
|
Shiboken::AutoDecRef fast(PySequence_Fast(%PYARG_1, "Fail to parse sequnce on %TYPE constructor."));
|
||||||
|
qreal values[%SIZE];
|
||||||
|
for(int i=0; i < %SIZE; i++) {
|
||||||
|
PyObject *pv = PySequence_Fast_GET_ITEM(fast.object(), i);
|
||||||
|
values[i] = %CONVERTTOCPP[qreal](pv);
|
||||||
|
}
|
||||||
|
%0 = new %TYPE(values);
|
||||||
|
}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template name="matrix_data_function">
|
||||||
|
const qreal* 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]));
|
||||||
|
}
|
||||||
|
return pyData;
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template name="matrix_fill_function">
|
||||||
|
qreal value = %CONVERTTOCPP[qreal](%PYARG_1);
|
||||||
|
%CPPSELF.fill(value);
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template name="matrix_transposed_function">
|
||||||
|
return %CONVERTTOPYTHON[%TRANSPOSED_TYPE](%CPPSELF.transposed());
|
||||||
|
</template>
|
||||||
|
|
||||||
</typesystem>
|
</typesystem>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
import unittest
|
import unittest
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from PySide.QtCore import QByteArray, QDate, QDateTime, QTime
|
from PySide.QtCore import QByteArray, QDate, QDateTime, QTime, QLine, QLineF
|
||||||
from PySide.QtCore import Qt, QSize, QSizeF, QRect, QRectF
|
from PySide.QtCore import Qt, QSize, QSizeF, QRect, QRectF, QDir, QPoint, QPointF
|
||||||
|
from PySide.QtCore import QUuid
|
||||||
|
|
||||||
class DeepCopyHelper:
|
class DeepCopyHelper:
|
||||||
|
|
||||||
def testCopy(self):
|
def testCopy(self):
|
||||||
copy = deepcopy([self.original])[0]
|
copy = deepcopy([self.original])[0]
|
||||||
self.assert_(copy is not self.original)
|
self.assert_(copy is not self.original)
|
||||||
|
|
@ -51,6 +51,29 @@ class QRectFDeepCopy(DeepCopyHelper, unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.original = QRectF(100.33, 200.254, 300.321, 400.123)
|
self.original = QRectF(100.33, 200.254, 300.321, 400.123)
|
||||||
|
|
||||||
|
class QLineDeepCopy(DeepCopyHelper, unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.original = QLine(1, 2, 3, 4)
|
||||||
|
|
||||||
|
class QLineFDeepCopy(DeepCopyHelper, unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.original = QLineF(1.1, 2.2, 3.3, 4.4)
|
||||||
|
|
||||||
|
class QPointDeepCopy(DeepCopyHelper, unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.original = QPoint(1, 2)
|
||||||
|
|
||||||
|
class QPointFDeepCopy(DeepCopyHelper, unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.original = QPointF(1.1, 2.2)
|
||||||
|
|
||||||
|
class QDirDeepCopy(DeepCopyHelper, unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.original = QDir("./")
|
||||||
|
|
||||||
|
class QUuiCopy(DeepCopyHelper, unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.original = QUuid("67C8770B-44F1-410A-AB9A-F9B5446F13EE")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue