[PyQt] Fwd: Re: Convert code from C++ to Python

oliver oliver.schoenborn at gmail.com
Thu Jan 7 03:28:31 GMT 2016


Pedro,
I forgot a couple steps to convert a C++ Qt example code to PyQt. The list
may seem daunting but it is really straightforward:

- replace the includes by imports from PyQt5
- replace all -> and :: by dot
- replace all object instantiations by Pythonic form foo=Foo(…) (regardless
of new / local)
- replace all { by colon
- fix constructors to be named __init__
- move data members from class, and initializers from constructor, into
__init__ body
- convert derivation to python syntax such as class Foo(BaseClass)
- add self. as appropriate and replace this-> by self.
- remove all &, *, ;, }, parentheses around if/while/etc conditions, type
declarations (return types, parameter types), virtuals, consts, and deletes
- (other TBD?)
- convert custom signals to use pyqtSignal at class level
- convert connections to use new style pythonic syntax
- run and fix iteratively until works
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160106/9e4cc3c6/attachment.html>


More information about the PyQt mailing list