[PyQt] Re: problem with createEditor method of QItemDelegate

TP paratribulations at free.fr
Thu Aug 13 15:59:10 BST 2009

Victor Noagbodji wrote:

> Hello Julien,
> to fix it you have to set the contents margins on the layout object.
> so your code should look like this:
> ....
>         qh = QtGui.QHBoxLayout( self )
>         qh.setContentsMargins(0, 0, 0, 0)
>         self.qlabel = QtGui.QLabel()
>         self.qlabel.setText( "foobar" )
>         qh.addWidget( self.qlabel )
> ....

Thanks a lot. There is another problem: the fact that the layout is
transparent. To work around this, I have added the following line:

self.setAutoFillBackground( True )

Now, it works perfectly!


python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\

"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)

More information about the PyQt mailing list