QML and Plasma -> progress()

Aaron J. Seigo aseigo at kde.org
Thu Sep 16 21:17:11 CEST 2010


On Thursday, September 16, 2010, Marco Martin wrote:
> On Thursday 16 September 2010, Aaron J. Seigo wrote:
> > > it is not possible to override plasmoid functions in javascript with
> > > things like plasmoid.dataUpdated = function() as far i know, but i
> > > could be wrong, i don't thik we really need this tough.
> > 
> > it's probably avoidable now that we have event listeners and the ability
> > to connect random functions and objects to signals and what not.
> > overriding functions in plasmoid is indeed probably avoidable now, but
> > it will be desirable with other objects.
> 
> i found that the following structure looks nice:
> in the root element implement a javascript function with the proper name,
> like
> 
> Item {
>  function configChangd()
>  {
>      do stuff
>  }
> }
> 
> and then call it from the appletscript c++ when it's necessary

does the event listener model work? right now in the JS API you can do things 
like:

function configChangd() { whatever }
plasmoid.addEventListener("configChanged", configChanged);

then there is some internal bookkeeping around that which keeps hold of the 
function passed in and all event listeners are called when that event happens. 
prevents the need for any hardcoded "when this C++ method is called, call a 
method called X in the JS". in fact, if i could go back to the start, i'd use 
_only_ event listeners and get rid of the whole "plasmoid.functionName = 
function ... " approach.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Development Frameworks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20100916/06afad95/attachment-0001.sig 


More information about the Plasma-devel mailing list