JS API questions
Aaron J. Seigo
aseigo at kde.org
Thu Mar 11 00:22:40 CET 2010
On March 9, 2010, Aaron J. Seigo wrote:
> On March 9, 2010, J Janz wrote:
> > 2010/3/9 Aaron J. Seigo <aseigo at kde.org>
> >
> > > however, there are a number of QScript/C++
> > > issues that block this from actually happening. i have a couple of
> > > ideas on how to address this, and will investigate and do one of them
> > > tomorrow.
> >
> > If I got that right, will it then be possible to have a dataUpdated for
> > widgets else than Label, TextEdit, Meter?
ok, this is done. you can now do things like:
function myUpdateFunction(source, data) { print("in myUpdate") }
function myClass()
{
this.count = 1·
}
myClass.prototype.dataUpdated = function(source, data) { print(this.count++);}
var myObj = new myClass
myObj.oddUpdate = function(source, data) { print("no access to this") }
dataEngine("time").connectSource("UTC", myUpdateFunction)
dataEngine("time").connectSource("UTC", myObj)
dataEngine("time").connectSource("UTC", myObj.oddUpdate)
and it all "just works", as does disconnectSource.
you can pass in variables derived from QObject which are set up for data
updates internally, such as Plasma::Label, and it "just works". you can also
overred the dataUpdated method on a QObject derived script value that doesn't
have dataengine support already and it too will "just work"
pretty freaking cool.
> > That would certainly be very
> > handful! If this is right, could it be backported?
>
> tbh, doubtful. but maybe. we'll see :)
and yes, this turned out to be much larger a change than i feel comfortable
with backporting.
--
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
More information about the Plasma-devel
mailing list