[PyQt] Fwd: I created a demo how to embed PyQt into C++ with some meta programming

Marcus Lindblom Sonestedt macke at yar.nu
Mon Aug 15 10:46:29 BST 2011


2011/8/15 Phil Thompson <phil at riverbankcomputing.com>

> On Mon, 15 Aug 2011 11:28:04 +0200, Marcus Lindblom Sonestedt
> <marcus.s.lindblom at gmail.com> wrote:
> > Henning Schröder skrev 2011-08-10 20:55:
> >> Hello,
> >> please see http://www.henning-schroeder.de/embeddedpyqt/ if you are
> >> interested in this topic.
> >> The idea was to create easy access between Python and C++ and
> >> providing a simple api to the end user.
> >> Feedback welcome.
> >> Regards
> >> Henning
> >
> > Neat! I'll definitely have a look at this someday in the future (as we
> > do mix C++ and Python quite heavily in our apps.)
> >
> > I especially like that you've mapped Qt properties to Python using upper
>
> > case on the first letter
> >
> (
> http://www.henning-schroeder.de/embeddedpyqt/using.html#differences-to-sip
> ).
> >
> > That would be awesome to have in PyQt. It doesn't seem _that_ hard to
> > get in there, if Phil is willing of course. ;)
>
> It is hard...
>
> In C++ the property names are in a different namespace to the class
> methods so their names can clash, for example QObject's objectName property
> and objectName() method. In Python they are in the same namespace (the
> class dict) and so cannot co-exist.
>
> Phil
>

I wrote that mapping the property names to having the first letter in
_uppercase_, they would not clash with the functions.
This works for Qt at least, which is consistent in this case, and would
allow co-existance.
(If it works for Henning...)

Though, I agree it's a bit hackish, but IMHO, it would be worth it to bring
Qt properties into Python.

Cheers
/Marcus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110815/f65e9ce1/attachment.html>


More information about the PyQt mailing list