aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-08-31 16:57:28 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:49 -0300
commit2487a080624a74a0db9dc068174d23453d18c114 (patch)
tree528d68e457fa11675d5f314eafd2cbee22c31a79
parent57b291fe66dde855ad2d6782eef6034ec914d6c1 (diff)
Fixed QColor reduce function.
Fixes bug #989. Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml21
1 files changed, 11 insertions, 10 deletions
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index c35a759b2..e772cd948 100644
--- a/PySide/QtGui/typesystem_gui_common.xml
+++ b/PySide/QtGui/typesystem_gui_common.xml
@@ -1165,42 +1165,43 @@
<insert-template name="qcolor_repr" />
</inject-code>
</add-function>
+ <add-function signature="__setstate__(PyObject*)" return-type="PyObject">
+ <inject-code>
+ Shiboken::AutoDecRef func(PyObject_GetAttr(%PYSELF, PyTuple_GET_ITEM(%1, 0)));
+ PyObject* args = PyTuple_GET_ITEM(%1, 1);
+ %PYARG_0 = PyObject_Call(func, args, NULL);
+ </inject-code>
+ </add-function>
<add-function signature="__reduce__" return-type="PyObject">
<inject-code class="target" position="beginning">
- PyObject *createFunction = 0;
-
switch(%CPPSELF.spec()) {
case QColor::Rgb:
{
qreal r, g, b, a;
- createFunction = PyObject_GetAttrString(%PYSELF, "fromRgbF");
%CPPSELF.getRgbF(&amp;r, &amp;g, &amp;b, &amp;a);
- %PYARG_0 = Py_BuildValue("(N(ffff))", createFunction, r, g, b, a);
+ %PYARG_0 = Py_BuildValue("(ON(s(ffff)))", Py_TYPE(%PYSELF), PyTuple_New(0), "setRgbF", (float)r, (float)g, (float)b, (float)a);
break;
}
case QColor::Hsv:
{
qreal h, s, v, a;
- createFunction = PyObject_GetAttrString(%PYSELF, "fromHsvF");
%CPPSELF.getHsvF(&amp;h, &amp;s, &amp;v, &amp;a);
- %PYARG_0 = Py_BuildValue("(N(ffff))", createFunction, h, s, v, a);
+ %PYARG_0 = Py_BuildValue("(ON(s(ffff)))", Py_TYPE(%PYSELF), PyTuple_New(0), "setHsvF", (float)h, (float)s, (float)v, (float)a);
break;
}
case QColor::Cmyk:
{
qreal c, m, y, k, a;
- createFunction = PyObject_GetAttrString(%PYSELF, "fromCmykF");
%CPPSELF.getCmykF(&amp;c, &amp;m, &amp;y, &amp;k, &amp;a);
- %PYARG_0 = Py_BuildValue("(N(fffff))", createFunction, c, m, y, k, a);
+ %PYARG_0 = Py_BuildValue("(ON(s(fffff)))", Py_TYPE(%PYSELF), PyTuple_New(0), "setCmykF", (float)c, (float)m, (float)y, (float)k, (float)a);
break;
}
#if QT_VERSION >= 0x040600
case QColor::Hsl:
{
qreal h, s, l, a;
- createFunction = PyObject_GetAttrString(%PYSELF, "fromHslF");
%CPPSELF.getHslF(&amp;h, &amp;s, &amp;l, &amp;a);
- %PYARG_0 = Py_BuildValue("(N(ffff))", createFunction, h, s, l, a);
+ %PYARG_0 = Py_BuildValue("(ON(s(ffff)))", Py_TYPE(%PYSELF), PyTuple_New(0), "setHslF", (float)h, (float)s, (float)l, (float)a);
break;
}
#endif