python binding on Qt application
-
Hello! I am planning to extend my Qt C++ application capabilities with additional python modules. I have heard of Qt for Python for binding qt GUI within python. But is the vice versa is possible?
I mean, if I have a Qt C++ application, can I run python scripts within my C++ code? Is it possible ? -
-
Check out PyBind11. I used to use Boost.Python for binding C++ code to expose it to Python, but Pybind11 is a lot more convenient to use and more modern.
-
+1 to pybind11, I started with it 2 weeks ago and I already have editor in qt & python coding environment & access between py-c++ stuff. Awesome So far!
One thing I wonder, does any1 know if we use PySide2 on python and Qt, can we directly send QVectors or we always have to convert them to std ones?
-
+1 to pybind11, I started with it 2 weeks ago and I already have editor in qt & python coding environment & access between py-c++ stuff. Awesome So far!
One thing I wonder, does any1 know if we use PySide2 on python and Qt, can we directly send QVectors or we always have to convert them to std ones?
@Dariusz said in python binding on Qt application:
if we use PySide2 on python and Qt, can we directly send QVectors or we always have to convert them to std ones?
Can you please explain what you mean? Send what to where? You can use QVector in PySide.
-
@Dariusz said in python binding on Qt application:
if we use PySide2 on python and Qt, can we directly send QVectors or we always have to convert them to std ones?
Can you please explain what you mean? Send what to where? You can use QVector in PySide.
@jsulm said in python binding on Qt application:
@Dariusz said in python binding on Qt application:
if we use PySide2 on python and Qt, can we directly send QVectors or we always have to convert them to std ones?
Can you please explain what you mean? Send what to where? You can use QVector in PySide.
well if we use QT in c++ project, and Pybind11 + python&pyside2, it means that we have QVector on C++ side and QVector on PySide2 as well. As pybind11 only accepts native structures as far as I'm aware, if I wish to send shared_ptr<QVector<classData>> to PySide2, can I just send it as QVector or do I need to always convert it to std::vector and then send that? - or return. Its about accessing c++ data from python.
-
@jsulm said in python binding on Qt application:
@Dariusz said in python binding on Qt application:
if we use PySide2 on python and Qt, can we directly send QVectors or we always have to convert them to std ones?
Can you please explain what you mean? Send what to where? You can use QVector in PySide.
well if we use QT in c++ project, and Pybind11 + python&pyside2, it means that we have QVector on C++ side and QVector on PySide2 as well. As pybind11 only accepts native structures as far as I'm aware, if I wish to send shared_ptr<QVector<classData>> to PySide2, can I just send it as QVector or do I need to always convert it to std::vector and then send that? - or return. Its about accessing c++ data from python.