[PyKDE] Newbie pyQt user needs some slot help

Pete Ware ware at cis.ohio-state.edu
Thu May 4 17:55:39 BST 2000


Phil Thompson <phil at river-bank.demon.co.uk> writes:

> That's not as necessary as it used to be before v0.11.  The bindings now
> know that a QObject is responsible for deleting its children and so
> Python doesn't do it when the Python object is deleted.
Cool!  I was also worried I was getting some circular references so
that should minimize them.

> The bindings can't tell what you intended, but they could include the
> number of arguments successfully parsed.  For example if a class had the
> following C++ functions...
> 
> 	void foo(int,QObject *,QColor *)
> 	void foo(int,QRect *,QWidget *)
> 
> ...and you called...
> 
> 	foo(int,QRect *,QColor *)
Would it be possible to actually print that out?

"Wrong argument type:
 You called:
        foo(int,QRect,QColor)
 when only the following are supported:
 	foo(int,QObject, QColor)
 	foo(int,QRect, QWidget)"

I'd guess in the 2nd half, sip could handle that as just a standard
message/string for each function.  That might also have general
usefulness as some simple documentation.

The first half you'd have to actually have code looping through the
arguments and printing out their type -- which I don't know how
difficult and error prone that would be.  On the plus side, it
wouldn't represent any runtime overhead since the code would only
execute when the wrong argument types are passed.

Boy, it sure is fun to suggest work for someone else to do :-)

--pete




More information about the PyQt mailing list