How to find a binding loop?
-
Hi, I am getting this message from Qt
file:///D:/dev/tools/Qt/5.7/mingw53_32/qml/QtQuick/Controls/Private/BasicTableView.qml:551:13: QML FocusScope: Binding loop detected for property "itemSelected"
I work on quite complex project and I use
TableViewColumn { id: column width: tv1.width }
with
TreeView
The error comes up when I useSelecionModel
selectionModel.setCurrentIndex(styleData.index, ItemSelectionModel.SelectCurrent)
... selection: ItemSelectionModel { id: selectionModel model: tv1.model }
How to find source of such error?
How to debug so I can find the origin? -
Try referencing the selection model by retrieving it from the TreeView instead of by id... And try giving the SelectionFlag as an int. See if either of those suggestions work. I have code that does something almost identical to what you are doing and am not receiving a binding loop.
TreeView { id: tree ... selection: ItemSelectionModel { model: tv1.model } ... }
//Somewhere else I call the following. tree.selection.setCurrentIndex( styleData.index, 3 );
Where 3 is Equivalent to QItemSelectionModel::ClearAndSelect
Works fine for me. More detail may be necessary as it is very possible that you are calling "setCurrentIndex" in the wrong place.
-
@NotJo4Ever it does not change anything
-
where exactly are you calling setCurrentIndex?
-
onClicked: { selectionModel.setCurrentIndex(styleData.index, ItemSelectionModel.SelectCurrent)////tv1.selection.setCurrentIndex(styleData.index, ItemSelectionModel.SelectCurrent)// //selectionModel.select(styleData.index, ItemSelectionModel.SelectCurrent) mainW.contentX = tv1.itemIndention * (styleData.depth + 0.9) //0.9 is alignment coefficient }
handler of delegate's
signal clicked(var mouse)
which is generated on click over current delegate -
So I was right from our chat?! Score!