[PyKDE] QColor.fromRgb and QColor.setRgb bug??

David Boddie david at boddie.org.uk
Sat Sep 30 00:24:56 BST 2006


On Friday 29 September 2006 09:07:58 -0500, Allen Bierbaum wrote:

> From the documentation to PyQt it seems that this line should work:
> >>> QtGui.QColor.fromRgb(QtGui.QApplication.style().styleHint(QtGui.QStyle.
> >>>SH_Table_GridLineColor,option))
>
> Traceback (most recent call last):
>   File "<string>", line 1, in <string>
> TypeError: insufficient number of arguments to QColor.fromRgb()
>
> Unfortunately calling setRgb has the same problem.  Does anyone see
> anything I am doing wrong here or is there a way to work around this
> problem?

I imagine you're getting a negative integer from styleHint(), where
QColor.fromRgb() expected an unsigned integer. It should be possible
to add 2^32 to any negative values to obtain a suitable unsigned
integer for use with QColor.fromRgb().

Maybe this case could be handled by adding an extra overloaded fromRgb()
function to QColor in sip/QtCore/qcolor.sip that accepts negative integers.

David




More information about the PyQt mailing list