summaryrefslogtreecommitdiffstats
path: root/PySide
diff options
context:
space:
mode:
authorPaulo Alcantara <paulo.alcantara@openbossa.org>2011-05-10 15:36:03 -0300
committerRenato Filho <renato.filho@openbossa.org>2011-05-13 14:02:41 -0300
commita8b02e046bdf09886972712d201be553d32cedaf (patch)
treeadbb973c49b137505afb237f30b47cfef0424f60 /PySide
parent7780ccddc138a28bd5e3b1c85b3fb48a08693663 (diff)
downloadpyside-a8b02e046bdf09886972712d201be553d32cedaf.tar.gz
pyside-a8b02e046bdf09886972712d201be553d32cedaf.tar.xz
pyside-a8b02e046bdf09886972712d201be553d32cedaf.zip
Fix bug #606
Add toTuple() function to these all classes: - QPoint/QPointF/QSize/QSizeF/QVector2D/QVector3D/QVector4D - QLine/QLineF/QColor Signed-off-by: Paulo Alcantara <paulo.alcantara@openbossa.org> Reviewer: Lauro Moura <lauro.neto@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'PySide')
-rw-r--r--PySide/QtCore/typesystem_core.xml58
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml66
2 files changed, 124 insertions, 0 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index a15cb65..6b50374 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -455,6 +455,15 @@
}
};
</inject-code>
+
+ <add-function signature="toTuple" return-type="PyObject*">
+ <inject-code class="target" position="beginning">
+ <insert-template name="to_tuple">
+ <replace from="%TT_FORMAT" to="iiii" />
+ <replace from="%TT_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()" />
+ </insert-template>
+ </inject-code>
+ </add-function>
</value-type>
<value-type name="QLineF">
<enum-type name="IntersectType" />
@@ -475,6 +484,15 @@
</insert-template>
</inject-code>
</add-function>
+
+ <add-function signature="toTuple" return-type="PyObject*">
+ <inject-code class="target" position="beginning">
+ <insert-template name="to_tuple">
+ <replace from="%TT_FORMAT" to="dddd" />
+ <replace from="%TT_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()" />
+ </insert-template>
+ </inject-code>
+ </add-function>
<modify-function signature="intersect(QLineF, QPointF*)const">
<modify-argument index="2">
<remove-argument />
@@ -677,6 +695,16 @@
}
};
</inject-code>
+
+ <add-function signature="toTuple" return-type="PyObject*">
+ <inject-code class="target" position="beginning">
+ <insert-template name="to_tuple">
+ <replace from="%TT_FORMAT" to="ii" />
+ <replace from="%TT_ARGS" to="%CPPSELF.x(), %CPPSELF.y()" />
+ </insert-template>
+ </inject-code>
+ </add-function>
+
<!--### Functions removed because they return references to Python imutable objects -->
<modify-function signature="rx()" remove="all"/>
<modify-function signature="ry()" remove="all"/>
@@ -700,6 +728,16 @@
</insert-template>
</inject-code>
</add-function>
+
+ <add-function signature="toTuple" return-type="PyObject*">
+ <inject-code class="target" position="beginning">
+ <insert-template name="to_tuple">
+ <replace from="%TT_FORMAT" to="dd" />
+ <replace from="%TT_ARGS" to="%CPPSELF.x(), %CPPSELF.y()" />
+ </insert-template>
+ </inject-code>
+ </add-function>
+
<!--### Functions removed because they return references to Python imutable objects -->
<modify-function signature="rx()" remove="all"/>
<modify-function signature="ry()" remove="all"/>
@@ -866,6 +904,16 @@
}
};
</inject-code>
+
+ <add-function signature="toTuple" return-type="PyObject*">
+ <inject-code class="target" position="beginning">
+ <insert-template name="to_tuple">
+ <replace from="%TT_FORMAT" to="ii" />
+ <replace from="%TT_ARGS" to="%CPPSELF.width(), %CPPSELF.height()" />
+ </insert-template>
+ </inject-code>
+ </add-function>
+
<!--### Functions removed because they return references to Python imutable objects -->
<modify-function signature="rheight()" remove="all"/>
<modify-function signature="rwidth()" remove="all"/>
@@ -889,6 +937,16 @@
</insert-template>
</inject-code>
</add-function>
+
+ <add-function signature="toTuple" return-type="PyObject*">
+ <inject-code class="target" position="beginning">
+ <insert-template name="to_tuple">
+ <replace from="%TT_FORMAT" to="dd" />
+ <replace from="%TT_ARGS" to="%CPPSELF.width(), %CPPSELF.height()" />
+ </insert-template>
+ </inject-code>
+ </add-function>
+
<!--### Functions removed because they return references to Python imutable objects -->
<modify-function signature="rheight()" remove="all" />
<modify-function signature="rwidth()" remove="all" />
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index 4822340..6cfe6eb 100644
--- a/PySide/QtGui/typesystem_gui_common.xml
+++ b/PySide/QtGui/typesystem_gui_common.xml
@@ -1158,6 +1158,43 @@
}
</inject-code>
</add-function>
+
+ <add-function signature="toTuple" return-type="PyObject*">
+ <inject-code class="target" position="beginning">
+ switch(%CPPSELF.spec()) {
+ case QColor::Rgb:
+ {
+ int r, g, b, a;
+ %CPPSELF.getRgb(&amp;r, &amp;g, &amp;b, &amp;a);
+ %PYARG_0 = Py_BuildValue("iiii", r, g, b, a);
+ break;
+ }
+ case QColor::Hsv:
+ {
+ int h, s, v, a;
+ %CPPSELF.getHsv(&amp;h, &amp;s, &amp;v, &amp;a);
+ %PYARG_0 = Py_BuildValue("iiii", h, s, v, a);
+ break;
+ }
+ case QColor::Cmyk:
+ {
+ int c, m, y, k, a;
+ %CPPSELF.getCmyk(&amp;c, &amp;m, &amp;y, &amp;k, &amp;a);
+ %PYARG_0 = Py_BuildValue("iiiii", c, m, y, k, a);
+ break;
+ }
+ case QColor::Hsl:
+ {
+ int h, s, l, a;
+ %CPPSELF.getHsv(&amp;h, &amp;s, &amp;l, &amp;a);
+ %PYARG_0 = Py_BuildValue("iiii", h, s, l, a);
+ break;
+ }
+ default:
+ %PYARG_0 = 0;
+ }
+ </inject-code>
+ </add-function>
<!-- ### "QColor(QColor::Spec)" is an internal method. -->
<modify-function signature="QColor(QColor::Spec)" remove="all"/>
<!-- ### Constructor removed because we already have an overload using QString. -->
@@ -6533,6 +6570,16 @@
</insert-template>
</inject-code>
</add-function>
+
+ <add-function signature="toTuple" return-type="PyObject*">
+ <inject-code class="target" position="beginning">
+ <insert-template name="to_tuple">
+ <replace from="%TT_FORMAT" to="dd" />
+ <replace from="%TT_ARGS" to="%CPPSELF.x(), %CPPSELF.y()" />
+ </insert-template>
+ </inject-code>
+ </add-function>
+
</value-type>
<value-type name="QVector3D" since="4.6">
<extra-includes>
@@ -6555,6 +6602,16 @@
</insert-template>
</inject-code>
</add-function>
+
+ <add-function signature="toTuple" return-type="PyObject*">
+ <inject-code class="target" position="beginning">
+ <insert-template name="to_tuple">
+ <replace from="%TT_FORMAT" to="ddd" />
+ <replace from="%TT_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.z()" />
+ </insert-template>
+ </inject-code>
+ </add-function>
+
</value-type>
<value-type name="QVector4D" since="4.6">
<extra-includes>
@@ -6577,6 +6634,15 @@
</insert-template>
</inject-code>
</add-function>
+
+ <add-function signature="toTuple" return-type="PyObject*">
+ <inject-code class="target" position="beginning">
+ <insert-template name="to_tuple">
+ <replace from="%TT_FORMAT" to="dddd" />
+ <replace from="%TT_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.z(), %CPPSELF.w()" />
+ </insert-template>
+ </inject-code>
+ </add-function>
</value-type>
<suppress-warning text="template baseclass 'QGenericMatrix&lt;qreal&gt;' of '*' is not known"/>