signalplotter widget in javascript

Mark markg85 at gmail.com
Tue Jul 24 22:53:04 UTC 2012


On Tue, Jul 24, 2012 at 10:39 AM, Kevin Krammer <krammer at kde.org> wrote:
> Hi,
>
> On Friday, 2012-07-20, Kai MX wrote:
>>  Hello,
>>
>>  how can one use the SignalPlotter widget in JavaScript?
>>
>>  In the KDE Techbase
>> (http://techbase.kde.org/Development/Tutorials/Plasma/JavaScript/API-UIEle
>> ments#SignalPlotter) there are only a few properties listed for JavaScript.
>> The important methods like setVerticalRange and addSamples are not listed.
>> (compared to
>> http://api.kde.org/4.x-api/kdelibs-apidocs/plasma/html/classPlasma_1_1Sign
>> alPlotter.html) I do not know how to use this widget without these methods.
>> Which possibilities do I have?
>
> All functions marked with Q_INVOKABLE should also be callable the JavaScript.
> Seems you should be good for addSamples() but you're out of luck for
> setVerticalRange().
>
> Cheers,
> Kevin
> --
> Kevin Krammer, KDE developer, xdg-utils developer
> KDE user support, developer mentoring
>
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
>

Perhaps this is of any help.
The SignalPlotter (amongst a bunch of other plasma elements) are
exposed to QML:
http://gitweb.kde.org/index.php?p=kde-runtime.git&a=blob&h=6cc3011319d750cb70c4cb98eb5290bf042c4d78&hb=43ea929fb91f56c1775bbe24d47fd3ce556a25e0&f=plasma%2Fdeclarativeimports%2Fgraphicswidgets%2Fgraphicswidgetsbindingsplugin.cpp

You can use it by importing org.kde.plasma.graphicswidgets

-- just out of my head, not tested --
import org.kde.plasma.graphicswidgets as GraphicsWidgets

GraphicsWidgets.SignalPlotter
{
    ...
}

The properties that you can actually use are a bunch. Take a look
here: http://api.kde.org/4.x-api/kdelibs-apidocs/plasma/html/signalplotter_8h_source.html
Everything that starts with Q_PROPERTY can be called in QML.

Important note, if you can wait till Qt 5 you get the power of HTML 5
canvas in QML which is probably very suited for plotting stuff. But
i'm guessing you can't wait for that and want to have something for
now. hehehe

Good luck,
Mark


More information about the Plasma-devel mailing list