[PyQt] Docstrings for signals

Denis Rouzaud denis.rouzaud at gmail.com
Mon Feb 26 17:23:59 GMT 2018


Hi Phil,

I've been looking a bit more, and it seems signals do have docstring.
At least I set them in my code and Sphinx seems to pick them up:

See SIP code:
https://github.com/qgis/QGIS/blob/master/python/gui/qgsmapcanvas.sip.in#L912-L917

Resulting doc:
http://python.qgis.org/api/gui/Map/QgsMapCanvas.html#qgis.gui.QgsMapCanvas.currentLayerChanged

Is this expected to you?

If yes, would there be a way to add the signature in the Docstring? Shall
we modify the sip gen to achieve this?
In Python, doing QgsMapCanvas.currentLayerChanged returns:

<unbound PYQT_SIGNAL currentLayerChanged(QgsMapLayer*)>

Cheers,

Denis

Le mar. 20 févr. 2018 à 08:27, Phil Thompson <phil at riverbankcomputing.com>
a écrit :

> On 20 Feb 2018, at 12:13 pm, Denis Rouzaud <denis.rouzaud at gmail.com>
> wrote:
> >
> > Hi Phil,
> >
> > Another issue for Docstrings...
> > Would it be possible to get a signature for signals too?
> > They are listed as attribute (and not method in sphinx).
>
> Signals *are* attributes and attributes cannot have docstrings.
>
> Phil
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180226/2d1d1d3b/attachment.html>


More information about the PyQt mailing list