Re: plasma data engine / property loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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


[Index of Archives]     [Trinity (TDE) Desktop Users]     [Fedora KDE]     [Fedora Desktop]     [Linux Kernel]     [Gimp]     [GIMP for Windows]     [Gnome]     [Yosemite Hiking]
  Powered by Linux