[PyKDE] sipParseArgs

Phil Thompson phil at river-bank.demon.co.uk
Wed May 15 11:51:01 BST 2002


"John J. Lee" wrote:
> 
> Given the lack of documentation for sip, here is a list of format
> characters for sipParseArgs as of sip 3.0, as far as I understand them
> (poorly).  The other versions of this list I've seen were out of date.
> 
> Questions:
> 
> 1. What is the 'func' C arg for ('y' and 'q' format characters)?

When you connect a Qt signal to a Python slot a QObject derived proxy is
created. The proxy has a Qt slot for every signal signature that the
module might emit. The connection is actually made to the proxy - the
proxy then calls the Python slot/method/function.

'func' is a pointer to a function that will return an instance of the
correct proxy.

> 2. Why does PyQt's QValidator::validate() use the 'm' format character
>  to get the C++ this, rather than t?  According to my copy of the Qt
>  docs, this method is not static.

You are misunderstanding 't' - because the comments in the code are
misleading. 't' is used to get the Python object that wraps every C++
address (ie. "sipThis"). 'm' is used to get the C++ address.

> 3. I don't understand the code for 'G' and 'S'

Qt implements the SIGNAL() and SLOT() macros by pasting "2" and "1"
respectively to the start of their argument. The PyQt implementations do
the same - and PYSIGNAL does the same and uses "9". 'G' and 'S' are just
checking that the correct SIGNAL(), SLOT() or PYSIGNAL() functions have
been used.

Phil




More information about the PyQt mailing list