PythonQt is a small library developed an Open Source dynamic Python binding for Qt that allows developers to embed the Python language into C++ Qt applications.
PythonQt is created to help you embed Python into an existing C++ application. The program is not built for writing the entire application in Python.
PythonQt can be used to make any QObject derived object scriptable via Python without the need of wrapper code generation.
Here are some key features of "PythonQt":
· Access all slots, properties, children and registered enums of any QObject derived class from Python
· Connecting Qt Signals to Python functions (both from within Python and from C++)
· Easy wrapping of Python objects from C++ with smart, reference-counting PythonQtObjectPtr.
· Convenient conversions to/from QVariant for PythonQtObjectPtr.
· Wrapping of C++ objects (which are not derived from QObject) via PythonQtCppWrapperFactory
· Extending C++ and QObject derived classes with additional slots, static methods and constructors (see Decorators)
· StdOut/Err redirection to Qt signals instead of cout
· Interface for creating your own import replacement, so that Python scripts can be e.g. signed/verified before they are executed (PythonQtImportFileInterface)
· Mapping of plain-old-datatypes and ALL QVariant types to and from Python
· Support for wrapping of user QVariant types which are registerd via QMetaType
· Support for Qt namespace (with all enumerators)
· All PythonQt wrapped objects support the dir() statement, so that you can see easily which attributes a QObject, CPP object or QVariant has
· No preprocessing/wrapping tool needs to be started, PythonQt can script any QObject without prior knowledge about it (except for the MetaObject information from the moc)
· Multiple inheritance for C++ objects (e.g. a QWidget is derived from QObject and QPaintDevice, PythonQt will automatically cast a QWidget to a QPaintDevice when needed)
· Polymorphic downcasting (if e.g. PythonQt sees a QEvent, it can downcast it depending on the type(), so the Python e.g. sees a QPaintEvent instead of a plain QEvent)
· Deriving C++ objects from Python and overwriting virtual method with a Python implementation (requires usage of wrapper generator or manual work!)
· Extensible handler for Python/C++ conversion of complex types, e.g. mapping of QVector to/from a Python array
· Setting of dynamic QObject properties via setProperty(), dynamic properties can be accessed for reading and writing like normal Python attributes (but creating a new property needs to be done with setProperty(), to distinguish from normal Python attributes)
Requirements:
· Python
· Qt