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

Hans-Peter Jansen hpj at urpla.net
Mon Oct 23 17:22:11 BST 2006


Am Sonntag, 22. Oktober 2006 23:32 schrieb Hans-Peter Jansen:
> 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)

Update: to avoid the SC_All value for the sub parameter, I added:

        sub = QStyle.SC_SpinWidgetUp | QStyle.SC_SpinWidgetDown | QStyle.SC_SpinWidgetFrame | \
              QStyle.SC_SpinWidgetEditField | QStyle.SC_SpinWidgetButtonField

and use this value, which in theory should do the right thing.

Unfortunately, it leads to the earlier mentioned core dump with an
interesting back trace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1077229248 (LWP 1016)]
0x40fd6f67 in QSpinWidget::buttonSymbols () from /usr/lib/libqt-mt.so.3
(gdb) bt
#0  0x40fd6f67 in QSpinWidget::buttonSymbols () from /usr/lib/libqt-mt.so.3
#1  0x409d01bd in sipQCheckBox::sipProtect_setOn () from /usr/lib/python2.4/site-packages/qt.so
#2  0x40088583 in PyCFunction_Call () from /usr/lib/libpython2.4.so.1.0
#3  0x400bfbf1 in PyEval_EvalFrame () from /usr/lib/libpython2.4.so.1.0
#4  0x400c1d21 in PyEval_EvalCodeEx () from /usr/lib/libpython2.4.so.1.0
#5  0x4007813a in function_call () from /usr/lib/libpython2.4.so.1.0
#6  0x40060c37 in PyObject_Call () from /usr/lib/libpython2.4.so.1.0
#7  0x40069edb in instancemethod_call () from /usr/lib/libpython2.4.so.1.0
#8  0x40060c37 in PyObject_Call () from /usr/lib/libpython2.4.so.1.0
#9  0x400bbaf8 in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.4.so.1.0
#10 0x40c08afd in sip_api_free () from /usr/lib/python2.4/site-packages/sip.so
#11 0x406f637a in sipVH_qt_31 () from /usr/lib/python2.4/site-packages/qt.so
#12 0x40a854ec in sipQWidget::paintEvent () from /usr/lib/python2.4/site-packages/qt.so
#13 0x40ee1342 in QWidget::event () from /usr/lib/libqt-mt.so.3
#14 0x40a7b61c in sipQWidget::event () from /usr/lib/python2.4/site-packages/qt.so
#15 0x40e4767f in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#16 0x40e49263 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#17 0x40a69263 in sipQApplication::notify () from /usr/lib/python2.4/site-packages/qt.so
#18 0x40e12d20 in QWidget::repaint () from /usr/lib/libqt-mt.so.3
#19 0x40e484a6 in QApplication::sendPostedEvents () from /usr/lib/libqt-mt.so.3
#20 0x40e48544 in QApplication::sendPostedEvents () from /usr/lib/libqt-mt.so.3
#21 0x40df3c28 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#22 0x40e5f441 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#23 0x40e5f286 in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#24 0x40e4912f in QApplication::exec () from /usr/lib/libqt-mt.so.3
#25 0x40a52b5e in sipQBitmap::~sipQBitmap () from /usr/lib/python2.4/site-packages/qt.so
#26 0x40088583 in PyCFunction_Call () from /usr/lib/libpython2.4.so.1.0
#27 0x400bfbf1 in PyEval_EvalFrame () from /usr/lib/libpython2.4.so.1.0
#28 0x400c1d21 in PyEval_EvalCodeEx () from /usr/lib/libpython2.4.so.1.0
#29 0x400c1ff5 in PyEval_EvalCode () from /usr/lib/libpython2.4.so.1.0
#30 0x400dc778 in run_node () from /usr/lib/libpython2.4.so.1.0
#31 0x400ddf13 in PyRun_SimpleFileExFlags () from /usr/lib/libpython2.4.so.1.0
#32 0x400de4da in PyRun_AnyFileExFlags () from /usr/lib/libpython2.4.so.1.0
#33 0x400e466a in Py_Main () from /usr/lib/libpython2.4.so.1.0
#34 0x0804871a in main ()

The question is, why the heck does paintEvent call into QSpinWidget::buttonSymbol 
at all? At least, I wouldn't expect this, but may be it's due to some
self.style().drawComplexControl() side effect?

> Any ideas, what's wrong here?

Sticking state persists.. New core dumping version with more debugging code 
applied is attached.

Pete

> 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: 10604 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20061023/5411f574/spinwidget.bin


More information about the PyQt mailing list