[Kde-bindings] Trouble instantiating a QPainter with smoke for Qt 4
Chris Burel
chrisburel at gmail.com
Mon Sep 15 04:57:40 UTC 2008
Hey guys,
I'm having trouble getting a QPainter object to work through smoke.
Whenever I try to call QPainter::begin through the smoke library, I
always get this error:
"QPainter::begin: A paint device can only be painted by one painter at a time."
Logically, that would imply that begin() has already been called on
that widget. But if I substitute the smoke call out for a direct one,
it works fine. This is my function:
void customPaintEvent( void* ptr ) {
Smoke::Index methodid = getMethod(qt_Smoke, "QPainter", "QPainter");
Smoke::StackItem args[1];
callMethod( qt_Smoke, 0, methodid, args );
QPainter* painter = (QPainter*)args[0].s_voidp;
// Doing this works
//painter->begin(ptr);
// Doing this doesn't
methodid = getMethod(qt_Smoke, "QPainter", "begin#");
Smoke::StackItem args2[2];
smokeCast( qt_Smoke, methodid, args2, 1, ptr, "QPaintDevice" );
smokeCastThis( qt_Smoke, methodid, args2, painter, "QPainter" );
callMethod( qt_Smoke, painter, methodid, args2 );
painter->drawText( 200, 200, "Woot" );
painter->end();
delete painter;
}
I'm attaching my test case code. Could somebody have a look?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: painter.cpp
Type: application/octet-stream
Size: 4893 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20080914/3139345d/attachment.obj>
More information about the Kde-bindings
mailing list