pythonqt icon indicating copy to clipboard operation
pythonqt copied to clipboard

Get slot information from PythonQt object

Open tonka3000 opened this issue 5 years ago • 1 comments

Hey @florianlink , @sboehmann ,

I've try to build a .pyi stub file (PEP 484) generator for the PythonQt module. I have to introspect the objects via dir function, but that's the same approach as PySide2 has. My main problem is that I can not get the slots information to get all overloads (and also not from __init__). When I call and PythonQt function wrong, I always get an ValueError with the possible slots, which would be exactly the content I need, but throw an exception for every PythonQt module, class, method, etc. is extremely slow.

Is there any possiblity (maybe via patch) to get to this information without raising an error per PythonQt object?

The information seems to be stored in PythonQtSlot.cpp.

Any idea, help?

Thanks in advance

Tonka

tonka3000 avatar Jan 23 '20 13:01 tonka3000

Sorry, I overlooked this...

Slots have the following methods, which return tuples for all overloads:

parameterTypes", (PyCFunction)PythonQtSlotFunction_parameterTypes, METH_NOARGS, "Returns a tuple of tuples of the C++ parameter types for all overloads of the slot" }, {"parameterNames", (PyCFunction)PythonQtSlotFunction_parameterNames, METH_NOARGS, "Returns a tuple of tuples of the C++ parameter type names (if available), for all overloads of the slot" }, {"typeName", (PyCFunction)PythonQtSlotFunction_typeName, METH_NOARGS, "Returns a tuple of the C++ return value types of each slot overload" },

florianlink avatar Aug 09 '20 12:08 florianlink