[SOLVED] QML Map Element - center coordinate (loop detection issue)
-
SOLUTION:
use toCoordinate instead of map.center:@
Text {
id: latitude
text: map.toCoordinate(Qt.point(180,320)).latitude
}@Hi all, I have experimented around with Map element and tried to render via simlpe Text element to the screen the coordinates of the map center.
Since Map.center property holds exactly the position I need to render I used:
@
Text {
id: latitude
text: map.center
}@The example works fine but the console repeatedly states that there is "binding loop detected for property text".
How can I make a proper reference to the center property to avoid that loop issue??
-
-
I have partially sorted out the issue by using map.toCoordinate method to render the Coordinate after user moves the map around. Problem is the documentation states:
Map::toCoordinate ( QPointF screenPosition )
Returns the coordinate which corresponds to the screen position screenPositionSo I am able to get a coordinate onMovementEnded, but what is the Syntax for screenPosition??
where to read about it? I tried:map.toCoordinate(180,320)
map.toCoordinate(Qt.point(180,320))But all seems to be giving me same coordinate back like if I was using: map.toCoordinate without any indication oin the screen position...
Please help!
-
Hi,
I searched for this error and found your post now. Opposite to you I know what is this error but I am searching for some workaround to debug it and solve in a simple way than what I am using..
The binding loop error occours when you assign some property circularly to one or more values. This is not always simple do focus because you should "think" like QML interpreter; loading a document it tries updating all the properties following a process where a property can be bound to another when it has alredy a value else there is an undefined assignent. Then a vcalue can't be assigned to another that bind itself with the first. A problem that occours with bindings is the time needed to some properties to be set.
Is you assign a property to the resulting value of a js function it is possible that when the QML is loading the document there are some properties that are not yet "filled" with the correct value but in the meantime this property is bound to another. The resulting error maybe a binding loop. Then I am applying in these cases the Component.onCompleted. This means that some bound property values are assigned only when I am sure that all the component has been loaded.
This works not in all cases so another workaround is to manage a signal fired when the component is loaded.
Hope this can help you.