[PyKDE] Runtime issues on SuSE 8.1
Jim Bublitz
jbublitz at nwinternet.com
Wed Oct 16 18:44:00 BST 2002
On 16-Oct-02 Hans-Peter Jansen wrote:
> Hi Marc, hi Jim,
> I finally touched the khtml_part problem. Here is my mod:
> --- ../PyKDE-3.3.2.orig/sip/khtml_part.sip 2002-08-21
> 20:08:45.000000000 +0200
> +++ ./sip/khtml_part.sip 2002-10-16 13:02:32.000000000 +0200
> @@ -124,8 +124,8 @@
> QRect r;
> int i = 0;
> - if
> (sipParseArgs(&sipArgsParsed,sipArgs,"mJ0J0ii",sipThisObj,sipClass
> _KHTMLPart,&ptr, sipClass_QPainter, p,
> - sipClass_QRect, r, i))
> + if
> (sipParseArgs(&sipArgsParsed,sipArgs,"mJ0J0JOi",sipThisObj,sipClas
> s_KHTMLPart,&ptr, sipClass_QPainter, p,
> + sipClass_QRect, &r, i))
> {
> bool b;
> At least, it compiles, but does this make sense also?
> I moderately sure about the missing &, which fixes the compiler
> complaint, but what about this sip argument format string?
Thanks!
Sloppy coding on my part - it definitely wants a pointer there.
This goes in the "mistakes I made that gcc 2.95 didn't catch"
category.
The format string should be:
m - for the KHTMLPart 'this' pointer (equivalent to self in
Python)
J0 - for the QPainter arg
J0 - for the QRect arg
i - for the int arg
or "mJ0J0i"
The bool* arg isn't passed in under Python; it's the return value
of the paint call instead (yes, sip will let you turn a void method
call into a call that returns a value under Python). In this case,
the contents of the location pointed to by the bool* is modified by
the call to paint, it isn't a parameter that paint uses itself to do
something. That's why the second 'i' in the format string was
incorrect. It's the same thing in both khtmlview.sip and
khtml_part.sip.
In the docs this should read "TAKES a QPainter, QRect, int and
RETURNS an int" (Python not having a bool type for the return value
prior to 2.2.1)
I probably would have spent a week looking for this silly error
(and it's one I've made before too). Thanks again (both Marc and
Hans-Peter)!
Jim
More information about the PyQt
mailing list