[PyQt] PyQt Digest, Vol 121, Issue 21
David Cortesi
davecortesi at gmail.com
Thu Aug 14 16:31:22 BST 2014
> Date: Thu, 14 Aug 2014 08:45:07 +0100
> From: Phil Thompson <phil at riverbankcomputing.com>
> Subject: Re: [PyQt] adding signal from class method?
>
>
> C++ isn't as dynamic as Python. The QMetaObject (which contains the
> signal definitions) is created when the class is defined and cannot be
> modified later.
Suggest adding words to clarify this restriction under the topic "Defining
New Signals with pyQtSignal()" at
http://pyqt.sourceforge.net/Docs/PyQt5/signals_slots.html.
The syntax of defining a signal is that of assignment to a class variable.
This tempts the user to think of it as a run-time action, not a declarative
statement, and to suppose one could change or add signals at run-time too
-- which Python's dynamic nature permits for other class attributes.
While the doc already says "New signals defined in this way will be
automatically added to the class’s QMetaObject.This means that they will
appear in Qt Designer and can be introspected using the QMetaObject API",
strongly suggesting their static nature, it isn't definitive.
This could be prefixed with something like "The pyQtSignal syntax is
processed only during execution of the class statement (signals cannot be
defined or redefined outside the class statement). New signals defined in
this way..."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140814/1a3c5a3f/attachment.html>
More information about the PyQt
mailing list