[PyQt] QItemDelegate

Alexandre Badez alexandre.badez at gmail.com
Thu Nov 22 12:54:58 GMT 2007


On Nov 22, 2007 11:48 AM, Phil Thompson <phil at riverbankcomputing.co.uk>
wrote:

> 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
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>

Thanks everybody for your answers.
I swear I will try not to use private method anymore :P

By the way, is there a better than re implement the complete paint method ?
I mean, I just want to change the color of the line according to the "type"
of the node (but not in every view).

@Andreas: I wish I could update my different versions.
But, my unix administration service his quiet... crappy? So they do not want
to upgrade (it's the same for python (2.4), PyQt, and dozen of other library
/ framework). That their politic...

-- 
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20071122/60089d42/attachment.html


More information about the PyQt mailing list