[Kde-bindings] Trouble instantiating a QPainter with smoke for Qt 4

Ashley Winters jahqueel at yahoo.com
Thu Sep 18 06:21:34 UTC 2008


--- On Mon, 9/15/08, Chris Burel <chrisburel at gmail.com> wrote:
> Yep, that was it.  I guess what this really comes down to
> is me not
> understanding what the difference is between using
> smoke->cast to get
> the ptr to be a qwidget, instead of just doing
> (QWidget*)ptr.
> But since the QPainter method takes a QPaintDevice, but it
> really
> wants a QWidget/QImage/QPixmap etc., how do you get that to
> work
> through the autoload method?

That's a topic for a book chapter... It's all encapsulated in some OO classes which convert the argument stack from language format to smoke format.

Checking the qtruby source, it seems they still do it much the same as I did in PerlQt. There's a MethodCall class which has a next() method. That method iterates through the expected arguments and marshals them into the Smoke stack.

The getMarshallFn() is the gateway between the autoload dispatcher and the marshaling library -- for a class pointer, it dispatches to marshall_basetype() { case Smoke::t_class: } which performs the actual smoke->cast() for the given language. In qtruby, this is wrapped via a specialized template instantiation, but it still calls smoke->cast() in the end.

- Ashley Winters


      



More information about the Kde-bindings mailing list