Connecting signals from C++ application with Python?
-
Hi everyone,
I have a C++ application which loads the *.ui files dynamically with the QUiLoader.
For this example MyWidget.uiNow I want to add the connections for QDial and a QLabel in the Python file (MyWidget.py).
What works in C++ currently is to get the QWidget* from the QUiLoader and access the items with findChildren<QLabel*>().
Can someone please help?
-
Hi everyone,
I have a C++ application which loads the *.ui files dynamically with the QUiLoader.
For this example MyWidget.uiNow I want to add the connections for QDial and a QLabel in the Python file (MyWidget.py).
What works in C++ currently is to get the QWidget* from the QUiLoader and access the items with findChildren<QLabel*>().
Can someone please help?
-
Hi,
What exactly are you trying to do ?
Port your C++ code to Python ?
Use your C++ code in a Python application ? -
Hi,
What exactly are you trying to do ?
Port your C++ code to Python ?
Use your C++ code in a Python application ? -
@SGaist The main application is written in C++ and I want to extend it with python scripting
@NoRulez
Here is my $0.02, unless/until someone else knows better.To add "Python scripting" to a C++ program you are best searching for C++ to Python scripting, not to do with Qt. That will be possible.
However, you (apparently) want to be able to handle Qt stuff like signals/slots from your Python "scripting". In order to call and deal with Qt stuff from Python you (normally) need a set of Python bindings/library, as provided by either PySide or PyQt. But these (again, normally) provide and require a full program written with them. I don't know how/whether they would allow you have Qt (with its event loop etc.) in a C++ program and somehow "connect" to that.
If that cannot be done could your "scripting" be done without any reference to anything Qt?
-
@NoRulez
Here is my $0.02, unless/until someone else knows better.To add "Python scripting" to a C++ program you are best searching for C++ to Python scripting, not to do with Qt. That will be possible.
However, you (apparently) want to be able to handle Qt stuff like signals/slots from your Python "scripting". In order to call and deal with Qt stuff from Python you (normally) need a set of Python bindings/library, as provided by either PySide or PyQt. But these (again, normally) provide and require a full program written with them. I don't know how/whether they would allow you have Qt (with its event loop etc.) in a C++ program and somehow "connect" to that.
If that cannot be done could your "scripting" be done without any reference to anything Qt?
Hi,
You might want to check the Scriptable Application example as a starting point.
-
Hi,
You might want to check the Scriptable Application example as a starting point.