aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/QtGui
diff options
context:
space:
mode:
authorPaulo Alcantara <paulo.alcantara@openbossa.org>2011-05-10 15:36:03 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:22 -0300
commit6545eb21f52545f2319d853a827a1122dfbac6cf (patch)
treefee3a4370ba844870991580b8c87f2a7f75a654c /PySide/QtGui
parent23a1c436e393c6b414a1022b270dc3edeedec78c (diff)
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/QtGui')
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml66
1 files changed, 66 insertions, 0 deletions
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index 482234059..6cfe6eb97 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"/>