[PyKDE] Re: Q___Style wrapper

Mike Rovner mrovner at cadence.com
Thu May 11 23:12:17 BST 2006


I wrapped QWindowsStyle (attached) and after exiting test application

from PyQt4.QtGui import *
app = QApplication([])
app.setStyle(QWindowsStyle())
lbl = QLabel("Windows")
lbl.show()
app.exec_()

got a crash:

(gdb) where
#0  PyThreadState_New (interp=0x0) at Python/pystate.c:194
#1  0x080d993c in PyGILState_Ensure () at Python/pystate.c:489
#2  0xb67cddf5 in initsip ()
    from /home/mrovner/tools/linux-x86_32/lib/python2.4/site-packages/sip.so
#3  0xb6e42b79 in initQtGui ()
    from 
/home/mrovner/tools/linux-x86_32/lib/python2.4/site-packages/PyQt4/QtGui.so
#4  0xb68f6410 in QApplication::~QApplication() ()
    from /lan/dfm/grp_mm_data1/dev/tools/linux-x86_32/lib/libQtGui.so.4
#5  0xb70d3341 in initQtGui ()
    from 
/home/mrovner/tools/linux-x86_32/lib/python2.4/site-packages/PyQt4/QtGui.so
#6  0xb6e286b9 in ?? ()
    from 
/home/mrovner/tools/linux-x86_32/lib/python2.4/site-packages/PyQt4/QtGui.so
#7  0xb67cbfa9 in initsip ()
    from /home/mrovner/tools/linux-x86_32/lib/python2.4/site-packages/sip.so
#8  0x080db5dd in call_ll_exitfuncs () at Python/pythonrun.c:1564
#9  0x08055466 in Py_Main (argc=0, argv=0xbfffefa4) at Modules/main.c:504
#10 0x08054f8b in main (argc=1, argv=0x1) at Modules/python.c:23

Any leads how to debug it?

Thanks,
Mike


-------------- next part --------------
%ModuleHeaderCode
#include <qwindowsstyle.h>
%End


class QWindowsStyle : QStyle //QCommonStyle
{
%TypeHeaderCode
#include <qwindowsstyle.h>
%End

public:
    QWindowsStyle();
    virtual ~QWindowsStyle();
    //*
    virtual void drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w = 0) const;
    virtual void drawControl(QStyle::ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w = 0) const;
    virtual QRect subElementRect(QStyle::SubElement subElement, const QStyleOption *option, const QWidget *widget = 0) const;
    virtual void drawComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget = 0) const;
    virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *widget = 0) const;
    virtual QRect subControlRect(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, QStyle::SubControl sc, const QWidget *widget = 0) const;
    virtual int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
    virtual QSize sizeFromContents(QStyle::ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w = 0) const;
    virtual int styleHint(QStyle::StyleHint stylehint, const QStyleOption *opt = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const;
    virtual QPixmap standardPixmap(QStyle::StandardPixmap standardPixmap, const QStyleOption *opt = 0, const QWidget *widget = 0) const;
    virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const;
    //*/
private:
    QWindowsStyle(const QWindowsStyle&);
};


More information about the PyQt mailing list