Adding a class to Qt for Python: Difference between revisions
Jump to navigation
Jump to search
(Turn Cristián's mailing-list message into a wiki page.) |
(Add a link to Alexandru's blog post.) |
||
Line 18: | Line 18: | ||
* Include new signatures for a certain method | * Include new signatures for a certain method | ||
Join us on <kbd>irc://irc.freenode.net/#qt-pyside</kbd> if you have any further | Join us on <kbd>irc://irc.freenode.net/#qt-pyside</kbd> if you have any further questions. | ||
See also: | |||
* Alexandru's blog post: [http://blog.qt.io/blog/2018/05/31/write-python-bindings/ Write your own Python bindings] |
Latest revision as of 15:50, 27 November 2018
Some C++ Qt classes are not yet exposed in Qt for Python. This page describes how to add one, or even add a class of your own.
Overall the process should consist on:
- Add the new class into the module's type system e.g.: pyside-setup/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
- Add a couple of test cases: e.g.: pyside-setup/sources/pyside2/tests/QtCore/ (don't forget to include the name of the scripts in the cmake file in the same directory)
If you are lucky, the new class will require no extra steps, but probably it will, so for this we recommend that you look at a similar class so you can get an idea of how to solve the issues you find. These issues could include:
- Ownership transfer
- Casting argument to different types
- Explicitly declare enums
- Adapt method signatures
- Include new signatures for a certain method
Join us on irc://irc.freenode.net/#qt-pyside if you have any further questions.
See also:
- Alexandru's blog post: Write your own Python bindings