[PyKDE] [PyQt3] QStyle.drawComplexControl() with invalid type in arg 7

Hans-Peter Jansen hpj at urpla.net
Sun Oct 22 22:32:39 BST 2006

Hi Phil et al.,

for some special DecimalSpinBox and DateTimeEdit widgets, I've reimplemented
QSpinWidget in Python. Unfortunately, I'm stuck with a problem in
paintEvent, when executing this line:

            self.style().drawComplexControl(QStyle.CC_SpinWidget, p, self, fr,
                        self.colorGroup(), flags, QStyle.SC_All, active)

emitting this error:

Traceback (most recent call last):
  File "lib/spinwidget.py", line 205, in paintEvent
    self.colorGroup(), flags, QStyle.SC_All, active)
TypeError: argument 7 of QCommonStyle.drawComplexControl() has an invalid type

Looking into PyQt/sip/qt/qstyle.sip, one can find:

        enum SubControl {

        typedef uint SCFlags;

        virtual void drawComplexControl(ComplexControl,QPainter *,
                                        const QWidget *,const QRect &,
                                        const QColorGroup &,
                                        SFlags = Style_Default,
                                        SCFlags = SC_All,SCFlags = SC_None,
                                        const QStyleOption & = QStyleOption()) const = 0;

where SubControl::SC_All is defined as 0xffffffff in qt3/src/kernel/qstyle.h.

print "type(QStyle.SC_All): %s, value: %s" % (type(QStyle.SC_All), QStyle.SC_All)
into the test harness emits:
type(QStyle.SC_All): <class 'qt.SubControl'>, value: -1
although SCFlags is defined as an uint type. May this cause this problem?
Replacing QStyle.SC_All with 0xffffffff as done in the if 1:; else clause,
simply core dumps..

Beware, spinwidget.py may contain more problems, since I couldn't test it
with the defective paintEvent..

Any ideas, what's wrong here?


Python version: 2.4
sip version: 4.4.5
Qt version: 3.3.6
PyQt version: 3.16
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spinwidget.py
Type: application/x-python
Size: 9287 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20061022/f782bb29/spinwidget.bin

More information about the PyQt mailing list