Fixed QColor.__reduce__ function.

Fixes bug #960.

Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
          Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
Renato Filho 2011-08-16 13:47:42 -03:00 • committed by Hugo Parente Lima
commit 3c7e551a99

View file

@ -1131,7 +1131,7 @@
case QColor::Hsl: case QColor::Hsl:
{ {
qreal h, s, l, a; qreal h, s, l, a;
%CPPSELF.getHsvF(&amp;h, &amp;s, &amp;l, &amp;a); %CPPSELF.getHslF(&amp;h, &amp;s, &amp;l, &amp;a);
QString repr = QString().sprintf("PySide.QtGui.QColor.fromHslF(%.6f, %.6f, %.6f, %.6f)", h, s, l, a); QString repr = QString().sprintf("PySide.QtGui.QColor.fromHslF(%.6f, %.6f, %.6f, %.6f)", h, s, l, a);
%PYARG_0 = PyString_FromString(qPrintable(repr)); %PYARG_0 = PyString_FromString(qPrintable(repr));
break; break;
@ -1156,7 +1156,7 @@
<insert-template name="qcolor_repr" /> <insert-template name="qcolor_repr" />
</inject-code> </inject-code>
</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">
PyObject *createFunction = 0; PyObject *createFunction = 0;
@ -1190,7 +1190,7 @@
{ {
qreal h, s, l, a; qreal h, s, l, a;
createFunction = PyObject_GetAttrString(%PYSELF, "fromHslF"); createFunction = PyObject_GetAttrString(%PYSELF, "fromHslF");
%CPPSELF.getHsvF(&amp;h, &amp;s, &amp;l, &amp;a); %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("(N(ffff))", createFunction, h, s, l, a);
break; break;
} }
@ -1201,7 +1201,7 @@
</inject-code> </inject-code>
</add-function> </add-function>
<add-function signature="toTuple" return-type="PyObject*"> <add-function signature="toTuple" return-type="PyObject">
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
switch(%CPPSELF.spec()) { switch(%CPPSELF.spec()) {
case QColor::Rgb: case QColor::Rgb:
@ -1228,7 +1228,7 @@
case QColor::Hsl: case QColor::Hsl:
{ {
int h, s, l, a; int h, s, l, a;
%CPPSELF.getHsv(&amp;h, &amp;s, &amp;l, &amp;a); %CPPSELF.getHsl(&amp;h, &amp;s, &amp;l, &amp;a);
%PYARG_0 = Py_BuildValue("iiii", h, s, l, a); %PYARG_0 = Py_BuildValue("iiii", h, s, l, a);
break; break;
} }