Web lists-archives.com

Re: plasma data engine / property loop




On Sunday 15 January 2017 12:18:24 Kevin Krammer wrote:
> Hi Martin,
> 
> On Sunday, 2017-01-15, 11:59:08, Martin Koller wrote:
> > On Sunday 15 January 2017 11:16:22 Kevin Krammer wrote:
> > > Hi Martin,
> > 
> > Hi Kevin,
> > 
> > > On Sunday, 2017-01-15, 00:04:23, Martin Koller wrote:
> > > > Hi,
> > > > 
> > > > trying to fix the systemload applet (and new to QML), how can one solve
> > > > the
> > > > problem: - a data engine delivers the number of CPU cores
> > > > - depending on this number, I need to separately "connect" to additional
> > > > sources in this data engine
> > > > 
> > > > This creates a property loop.
> > > > dataSources array depends on cores, but cores is set from dataSources
> > > 
> > > How is cores set from dataSources?
> > 
> > As shown below via onNewData
> 
> Hmm, ok, so setting connectedSources is triggering the newData signal?
> 
> > > Does the source() function below write to cores?
> > 
> > no, it reads from it: for (var i = 0; i < cores; i++) ...
> > 
> > I'll just attach the real qml file
> > The message I see is
> > SystemLoadViewer.qml:123:5: QML : Binding loop detected for property
> > "connectedSources"
> 
> Does it create any problems during operation?
> That "loop" should end after the first roundtrip as maxCpuIndex won't change 
> anymore.
> 
> If there is a problem or you want to tyr getting rid of the warning, you could 
> try this
> 
> connectedSources: [ cores ]
> onMaxCpuIndexChanged: connectedSources = sources();
> 
> I.e. initially connectedSources is bound to just "system/cores".
> Once the value is retrieved, by onNewData, the change of maxCpuIndex will 
> trigger a one-time setting if connectedSources to the result of sources().
> connectedSource then has a fixed value, not a binding.

yep, thanks. Did it similar to this.
I don't like warnings ...


-- 
Best regards/Schöne Grüße

Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

()  ascii ribbon campaign - against html e-mail 
/\                        - against proprietary attachments

Geschenkideen, Accessoires, Kulinarisches: www.lillehus.at

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