[PyQt] Custom Widget

Fernando Cosso ferdemza at gmail.com
Thu Jan 27 04:19:12 GMT 2011


Many Thanks Pete

I forgot to answer back, but eventually I did convert the code from C++ to
Python

I could solve the crash issue doing this:

           richTextLabel.drawContents(QPainter(richTextPixmap),
QRectF(richTextPixmap.rect()))

I am fighting now with Qt Designer. I am trying to put the Html property in
the Property editor panel as a rich Text Property, but no luck.

I am trying to get the right xml on the method domXml of the class
QtDesigner.QPyDesignerCustomWidgetPlugin

(
http://trinity.pearsoncomputing.net/docs/qt4/designer-creating-custom-widgets.html
)


Best Regards

On 26 January 2011 22:03, Hans-Peter Jansen <hpj at urpla.net> wrote:

> On Wednesday 26 January 2011, 14:35:35 ferdemza at gmail.com wrote:
> > Thanks again Pete
> >
> > I think i will do my own custom widget from scratch following a book
> > i have and then use the link you gave me to integrate it to the
> > designer.
>
> As I told you, it is simpler to convert the Qt code.
>
> @Phil: for some reason, the richTextPainter.end() is needed in the PyQt
> version to avoid a SIGSEGV crash during paint event:
>
> QPaintDevice: Cannot destroy paint device that is being painted
>
> (gdb) bt
> #0  0x08339d10 in ?? ()
> #1  0xb647c3f8 in ~QPainter (this=0x1) at painting/qpainter.cpp:1491
> #2  0xb6fdfe80 in release_QPainter (sipCppV=0x82514d8) at
> sipQtGuiQPainter.cpp:5371
> #3  0xb6fdfedc in dealloc_QPainter (sipSelf=0xb4ae4454) at
> sipQtGuiQPainter.cpp:5382
> #4  0xb7fc4f5f in forgetObject (sw=0xb4ae4454) at siplib.c:10004
> #5  0xb7fc4ff1 in sipSimpleWrapper_dealloc (self=0xb4ae4454) at
> siplib.c:9233
> #6  0xb7eba68d in subtype_dealloc (self=0xb4ae4454) at
> Objects/typeobject.c:1018
> #7  0xb7e8c24a in frame_dealloc (f=0x8301c4c) at Objects/frameobject.c:417
> #8  0xb7ef8bec in PyEval_EvalCodeEx (co=0xb7c32260, globals=0xb7c7602c,
> locals=0x0, args=0xb7c42418, argcount=2,
>    kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at
> Python/ceval.c:2953
> #9  0xb7e8da29 in function_call (func=0xb5f37994, arg=0xb7c4240c, kw=0x0)
> at Objects/funcobject.c:524
> #10 0xb7e68c1c in PyObject_Call (func=0xb5f37994, arg=0xb7c4240c, kw=0x0)
> at Objects/abstract.c:2487
> #11 0xb7e769fe in instancemethod_call (func=0xb5f37994, arg=0xb7c4240c,
> kw=0x0) at Objects/classobject.c:2579
> #12 0xb7e68c1c in PyObject_Call (func=0xb7c26694, arg=0xb5f5b02c, kw=0x0)
> at Objects/abstract.c:2487
> #13 0xb7ef177f in PyEval_CallObjectWithKeywords (func=0xb7c26694,
> arg=0xb5f5b02c, kw=0x0) at Python/ceval.c:3548
> #14 0xb7fc6b03 in sip_api_call_method (isErr=0x0, method=0xb7c26694,
> fmt=0xb721cf4c "D") at siplib.c:1721
> #15 0xb6e3b5f9 in sipVH_QtGui_3 (sipGILState=PyGILState_UNLOCKED,
> sipMethod=0xb7c26694, a0=0xbfffdaa4)
>    at sipQtGuicmodule.cpp:7343
> #16 0xb7199dc9 in sipQPushButton::paintEvent (this=0x81f0718,
> a0=0xbfffdaa4) at sipQtGuiQPushButton.cpp:420
>
> Do you want me to prepare that code for inclusion into examples?
>
> Pete
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110126/8e6a84de/attachment-0001.html>


More information about the PyQt mailing list