[PyQt] QItemDelegate

Phil Thompson phil at riverbankcomputing.co.uk
Thu Nov 22 10:48:46 GMT 2007


On Thursday 22 November 2007, Alexandre Badez wrote:
> On Nov 22, 2007 11:09 AM, Phil Thompson <phil at riverbankcomputing.co.uk>
>
> wrote:
> > On Thursday 22 November 2007, Alexandre Badez wrote:
> > > On Nov 21, 2007 5:26 PM, Alexandre Badez <alexandre.badez at gmail.com>
> >
> > wrote:
> > > > On Nov 21, 2007 5:06 PM, Andreas Pakulat <apaku at gmx.de> wrote:
> > > > > [...]
> > > > > You can't, unless you copy the code, translate it to python and put
> >
> > it
> >
> > > > > into your own delegate. Only whats documented in the API  docs can
> >
> > be
> >
> > > > > used without copying it, everything else in Qt's code is private.
> > > > >
> > > > > Andreas
> > > > >
> > > > > --
> > > > > Your mode of life will be changed for the better because of new
> > > > > developments.
> > > > > _______________________________________________
> > > > > PyQt mailing list     PyQt at riverbankcomputing.com
> > > > > http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> > > >
> > > > Thanks
> > > >
> > > > --
> > > > Alex
> > >
> > > Hye,
> > >
> > > I'm steel trying to make my deletage, but I've steel have some problem.
> > > My application must be multi-plateform, so I develop for win32 and Unix
> > > (SunOs 5.8).
> > > On Windows I've got:
> > >   PyQt 4.0 (262 144)
> > >   Qt 4.1.5 (even if PyQt give me the information: Qt 4.1.3 (262 403)
> > >
> > > On Unix I've got:
> > >   PyQt 4.1.1 (262 401)
> > >   Qt 4.1.4 (262 404)
> > >
> > > In my delegate I'm doing this:
> > >
> > > from PyQt4 import QtGui
> > > class myDelegate(QtGui.QItemDelegate):
> > >     def paint(self, painter, option, index):
> > >         [...]
> > >         self.decoration(...) # <- method protected declare in C++
> > > object [...]
> > >
> > > This code work great on window, but not on Unix (AttributError).
> > >
> > > What am I doing wrong ?
> >
> > QItemDelegate::decoration() is internal to Qt.
> >
> > Phil
> > _______________________________________________
> > PyQt mailing list    PyQt at riverbankcomputing.com
> > http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
> But why does it work in Win32 and not on Unix ?

Wrong question. Why does it work with PyQt 4.0 and not with PyQt 4.1.1?

...because the very first versions of PyQt4 incorrectly exposed internal Qt 
functions.

> Those method, even if they are not documented, are protected, so I can
> normally do it in C++; so why not in python ?

Because PyQt only exposes the official Qt API.

Phil


More information about the PyQt mailing list