[PyQt] the mechanism behind qt signal and slot
Von
vontio at gmail.com
Sun Sep 19 11:15:15 BST 2010
Hi,Algis,many thanks for all these informations.
At first I thought QtCore.QtObject.connect as static method of
QtObject,later I realized that,this is py style of calling super method.
That's why I asked question (3).
The document of pyqt says "The code (or component) that emits the signal
does not know or care if the signal is being used."
In my head,the implementation of signal and slot is an observer pattern.
Pseudo-code:
def connect(source,signal,slot):
if(not source.slots[signal]):
source.slots[signal] = []
source.slots[signal].append(slot)
def emit(signal,param):
for slot in self.slots[signal]:
slot(param)
I am wondering why signal does not know what slots bind with it?
Best regards,
On Sun, Sep 19, 2010 at 4:32 PM, Algis Kabaila <akabaila at pcug.org.au> wrote:
> On Sunday 19 September 2010 17:41:59 Von wrote:
> > Hi,Algis,
> > I have looked through this chapter "Events, the Clipboard, and Drag and
> > Drop", and I couldn't find anything about signal/slot mechanism.
> >
>
> http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/pyqt4ref.html#new-style-
> signal-and-slot-support
>
> (One line URL!)
> Chapter 7 of the PyQt4 Reference discusses the Signals/Slots in some
> detail.
> Good, clear and detailed explanation!
>
> Al.
> --
> OldAl
> akabaila at pcug.org.au
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100919/d19509db/attachment.html>
More information about the PyQt
mailing list