About Plasma's JavaScript API
Marco Martin
notmart at gmail.com
Fri Jan 21 14:30:47 CET 2011
On Friday 21 January 2011, Samu Juvonen wrote:
> Hello.
>
> I've been trying to learn creating Plasmoids with JavaScript, but so far it
> seems to me that the API is wildly broken. I cannot even properly set a
> size for QSizeF or re-position a QRectF. The third problem is with
yup, there were problems indeed in the bindings.
there was a problem indeed for the move methods of rectangled, I've fixed them
now.
> FrameSvgs. Whereas a PlasmaSvg image is rendered fine, FrameSvg goes
> completely bonkers.
>
> I've tried rendering SVGs using different Plasma themes but it fails even
> with Oxygen and Air, so probably not due to broken theme.
the paint parameters works like ones of painter.drawPixmap
so you have:
void paintFrame(QPainter *painter, const QRectF &target,
const QRectF &source = QRectF());
this is what you were using and is useful only if you want to draw only a
portion of the frame (that's what is happening)
now, I've fixed the behviour to behave -exactly- like qpainter::drawPixmap in
the case there is a single qrect paramenter (the second is facultative), that
should give the intended results now.
void paintFrame(QPainter *painter, const QPointF &pos = QPointF(0, 0));
this in the one you need 99% of the times, it just paints the whole frame in
the position you want
> My KDE version is 4.6 RC2 (on Arch Linux). I dunno if it works any better
> with the stable 4.5 release, since I don't have any machines I could test
> it with atm.
>
> I created a simple example Plasmoid you can download here:
> http://sj87.hopto.org/buggy.tar.gz
the plasmoid now has a proper output and paints correctly.
both in trunk and 4.6 branch
Cheers,
Marco Martin
More information about the Plasma-devel
mailing list