Solved Binding loop detected
-
@kgregory said in Binding loop detected:
value: modelData.size
onValueChanged: modelData.size=sizeSet.valuethere you have the obvious loop
-
@kgregory said in Binding loop detected:
value: modelData.size
onValueChanged: modelData.size=sizeSet.valueThis has a loop effect, slider value is dependent on modelData.size and modelData.size is dependent on slider value. Try to get rid of it.
-
@Yashpal
and thats exactly the problem.
The loop is already in your definition. The values can't be mutual dependent from each other.@Yashpal said in Binding loop detected:
slider value is dependent on modelData.size and modelData.size is dependent on slider value
Think about it it, this never can be (logically) correct.
What are you actually trying to achieve?
-
@kgregory You can try
Component.onCompleted: { sizeSet.value = modelData.size modelData.size = Qt.binding(function() { return sizeSet.value }) }
(Not tested.) See http://doc.qt.io/qt-5/qtqml-syntax-propertybinding.html for further info about Qt.binding.
-
@Eeli-K
writing the same (problematic) definition just in another way results in the same issue ;)
Again, this mutual dependency will never be solved, no matter what different code you are trying. -
@raven-worx @kgregory My code may be wrong, instead of "modelData.size =..." "onValueChanged: modelData.size = value" could be enough. Raven-worx, why do you say that? Of course "x: y; y: x" is circular, but setting one once in Component.onCompleted and leaving off the binding should solve it. Well, now I see I wasn't explicit about leaving off the two bindings and replacing them with the code, if that was the problem. Of course there should be only one binding at most.
-
@Eeli-K said in Binding loop detected:
Raven-worx, why do you say that?
because those 2 are still property bindings...
sizeSet.value = modelData.size
modelData.size = Qt.binding(function() { return sizeSet.value }) -
@raven-worx No, only the latter is. The first line isn't a binding, it's just setting the value. The one and only binding is made after that and there is no circularity.
-
@Eeli-K
yep you are right. Stupid me, should have read it more precisely.
Sorry. -
Thanks, Eeli. I think that will work.