Wrapping cpp class into python by using PythonQt Generator
Dynamic Python binding for Qt Applications
Brought to you by:
florianlink,
marcusbarann
Hi every body
I had written simple class in c++ and I want to port it in python. For this I want use PythonQt Generator tool. How can I do it? My class is something like this:
Class MathClass{
Public:
MathClass(){}
int sum(int a, intb){return a+b;}
int sub(int a, intb){return a-b;}
};
Is it possible to wrap it by PythonQt generator tool or not and how?
I should mention that i had witten simple xml for my class but it does not work at all and i don't know what is my problem. i want simple example for doing this.
thanks for helping
Yes, that is possible but not well documented, since it not the main feature of PythonQt.
It was discussed in this thread: https://sourceforge.net/p/pythonqt/discussion/631392/thread/d753683f/
You can also just make your class a QObject with slots and properies and use it without a wrapper (have a look at the example directory). Or you can program your wrappers manually , as seen 8n the examples.
Hi,
Thanks for that reference; but the link has been changed to the following address:
https://doc.qt.io/archives/qtjambi-4.5.2_01/com/trolltech/qt/qtjambi-generatorexample.html