[Kde-bindings] One Smoke question

Arno Rehn arno at arnorehn.de
Fri Aug 27 14:39:06 UTC 2010


On Friday 27 August 2010 16:16:09 Sven Aßmann wrote:
> Can Anyone say me what happens when i passed a char* as an argument for a
> methodsignature that contains QString& ??
> 
> Is it possible that Smoke or the underlying class cannot call a cast method
> for e.g. char* to QString?
That won't work. If a method expects a QString, you have to pass it a QString, 
even if you normally can implicitly convert a char* to a QString. The reason 
is that the string is passed-by-reference, i.e. in a void*. The wrapper method 
only has the information that it's a QString and that something's in the 
s_voidp field of the StackItem. So it will do this:

void x_0(Smoke::Stack s) {
	wrappedMethod(*(QString*)s[1].s_voidp);
}

All implicit conversion options are lost this way (which is a good thing - 
otherwise it could interfere with the bindings language's conversions).

> i work on a smoke based php binding for qt/kde..
Have you checked out PHPQt? We're currently looking for a maintainer and it's 
already pretty good at binding Qt. We just need KDE extensions for it. Its 
syntax is also nicer (my opinion, only) than your current code. In PHPQt, you 
can use classes directly, as in 

<?php
$app = new QApplication($argc, $argv);
?>

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list