[PyKDE] Notifying self on all emits _OR_ overriding default emit behavior

Myddrin myddrin at myddrin.com
Tue Oct 7 01:36:00 BST 2003


On Thursday 02 October 2003 15:32, Sundance wrote:
> I heard Myddrin said:
> > No, I mispoke.  Slots should be signals above.
>
> Oh! I see. :)
>
> > I would need to take a generic (or ones that inherit from say
> > MydWidget) object X and discover it's signals so I can subscribe to
> > them and then call the "webbrowser scripts"....
>
> Well, I'm not really sure I grasp your problem there... Signals and
> slots are pretty much a compile-time information, as per Qt's design,
> and I'll venture to say that if you need to discover them at run-time
> there might be a design issue in your program maybe...?
>

Back to my original example.  I webbrowser does _NOT_ know the events (or 
signals or whatever) of every component that might get loaded into it. Yet I 
can use Flash, Real Player, etc in both IE and Netscape and receive events 
without the ie and netscape developers having a priori knowledge of every 
component that might be loaded inside it.

Another example of what one might do (and I'm restricted here by an NDA and 
can't tell you exactly what I'm planning on doing with it) is to expand on 
the .ui format used by qt designer.  Each control would have a tag for each 
signal that it would have python code.

(I'm unfamilar with the ui format so you'll have to bare with me in this bogus 
example.)

<widget>
	<property name="height" value="10" />
	<mouseover>
<![CDATA[ 
# python code goes here
]]>
	</mouseover
</widget>

But I think in this case, I just answered my own question.  I don't need 
connect to all signals, just the ones that are in the file..... 

Heck, since python can add methods at runtime, I could add them to the object 
and do a straight connection rather than having an observer class like I'd 
originally thought......

Thanks, talking this out solved the problem, it was a design issue after all.






More information about the PyQt mailing list