plasma data engine / property loop

Kevin Krammer krammer at kde.org
Sun Jan 15 11:18:24 GMT 2017


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.

Cheers,
Kevin
-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde/attachments/20170115/9e8eb93e/attachment.sig>


More information about the kde mailing list