On Thursday, October 6, 2011 10:05:47 Marco Martin wrote:
> On Thursday 06 October 2011, Viranch Mehta wrote:
> > Hi all,
> > 
> > I am facing a very annoying problem in QML plasmoids with the dataengines.
> > The following does not seem to work ever for almost all dataengines:
> > 
> > PlasmaCore.DataSource {
> > 
> >     id: dataSource
> >     engine: "someEngine"
> >     onSourceAdded: print (data[source]["some_valid_key"];
> > 
> > }
> > 
> > The print statement always throws data[source] is [undefined]. This
> > happens
> > with
> > most engines, esp with those engines where sources are added/removed
> > dynamically
> > by the engine. This has been very annoying, any help will be awesome!
> 
> uhm, i could think about a structural problem there (iirci faced this
> problem) basically onSourceAdded data[source] is not ready yet, will be in
> the nexo loop
> so you should do onSourceAdded: connectSource(source) then iirc could still

well, yes.. this is exactly the problem: this is not how you use a DataEngine 
:)

a source appears. you connect to it.

when data is changed, it tells you.

there is no guarantee, nor can there be, that when a source appears that it 
has all its data in place. that's the definition of "asynchronous" and why 
dataUpdated (or in QML: onDataChanged and onNewData) exist.

no need for timers either btw :)

-- 
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

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to