[Development] Python Bindings

Cristián Maureira-Fredes Cristian.Maureira-Fredes at qt.io
Fri Nov 23 15:52:28 CET 2018

On 11/23/18 9:22 AM, Luca Beldi wrote:
> Hi Everyone,
> I wanted to ask if I have to do anything to expose a new class added to 
> Qt to “Qt for Python”.
> Do you have a manual or an example commit of what needs to be done to 
> make it work?
> Thanks in advance.
> Luca Beldi


Regarding the process itself,
I recommend you to follow the implementation of another class
because we don't have any tutorial.

Overall the process should consist on:

- Add the new class into the module's typesystem
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 to the cmake file
on the same directory)

If you are lucky, the new class will require no extra steps,
but probably it will, so for this I recommend you to 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
- etc

Join us on #qt-pyside if you have any further question.


Dr. Cristian Maureira-Fredes
Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin

Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht
Charlottenburg, HRB 144331 B

More information about the Development mailing list