PDA

View Full Version : embed Python in Qt C++ program and use signals/slots



phenoboy
25th August 2016, 12:04
I want to embed Python in my Qt c++ project so that I can run Python scripts within the main Qt C++ program.

I have several c++ QObject-derived classes that emit signals. I would like have these c++ objects exposed in Python-side so that I can create Python classes with slots connected to signals that are emitted from c++.

Is this possible ? I don't necessary need a full solution but some pointers on where to start. Thanks!

d_stranz
26th August 2016, 00:27
Ever tried that "Google" thing? Click here! (http://lmgtfy.com/?q=embed+python+in+c%2B%2B)

phenoboy
29th August 2016, 10:32
Thanks!

I read that.. very good info!

But something was missing. I couldn't find any info about how to 'glue' a signal emitted from "c++" side into an object living in Python script runtime.

d_stranz
29th August 2016, 15:54
You should really try that Google thing (http://pyqt.sourceforge.net/Docs/PyQt4/old_style_signals_slots.html). This is for PyQt4; PyQt5 supports the new style of signal / slot connections as well as the old style.