From 2487a080624a74a0db9dc068174d23453d18c114 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Wed, 31 Aug 2011 16:57:28 -0300 Subject: Fixed QColor reduce function. Fixes bug #989. Reviewer: Luciano Wolf Marcelo Lira --- PySide/QtGui/typesystem_gui_common.xml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'PySide') 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 @@ + + + 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); + + - PyObject *createFunction = 0; - switch(%CPPSELF.spec()) { case QColor::Rgb: { qreal r, g, b, a; - createFunction = PyObject_GetAttrString(%PYSELF, "fromRgbF"); %CPPSELF.getRgbF(&r, &g, &b, &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(&h, &s, &v, &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(&c, &m, &y, &k, &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(&h, &s, &l, &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 -- cgit v1.2.3