[PyQt] connecting python code to a c++ signal

ale rimoldi ale.comp_06 at xox.ch
Thu Oct 2 14:21:33 BST 2014


hi

> but now i'm stuck with the next non conform line and i really don't
> get what the function is supposed to do / what the problem is :-(

ok, after a long mumbling time, i think that at least now i understand
the problem:

- Scripter.createMenu.connect(createMenu)
- leads to a call to "def __getattr__(self, name)"
- self is <class 'mikro.ScripterImpl'> and name is "createMenu"

so i went and dig into "def create_pyqt_class(metaobject)" and i found
that ig queries metaobject for property(i) and method(i), but
the signals are explicitly ignored ("if meta_method.methodType() !=
QMetaMethod.Signal :").

https://github.com/aoloe/scribus-plugin-scripter/blob/master/src/python/mikro.py#L393

now, i did some checks and "createMenu" is indeed among the methods, but
-- of course -- getting it added to the list of the methods inherited
does not help.

any idea, how to get that signal to be connectable from python3 / PyQt5?


i've found a document that could be helpful

http://doc.qt.digia.com/qq/qq16-dynamicqobject.html

but it's rather lengthy, old, based on pyqt4... so i prefer to ask here
before starting reading something that, at the end, has an high risk to
be useless.


thanks for your help!
a.l.e


More information about the PyQt mailing list