Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] QML Map Element - center coordinate (loop detection issue)
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QML Map Element - center coordinate (loop detection issue)

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 2 Posters 4.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cmer4
    wrote on last edited by
    #1

    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??

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cmer4
      wrote on last edited by
      #2

      Problem solved...
      Just had to add Coordinate element which refered to map.center first. and then the text value points now to Coordinate instead of Map element's center...

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cmer4
        wrote on last edited by
        #3

        UPDATE#2 - hm it seems like its not solved as the console messages are still being fired off...
        Could someone tell me if I can just ignore these messages?

        I don't know what this really means (loop detected) but as long as it is working I am fine..

        1 Reply Last reply
        0
        • C Offline
          C Offline
          cmer4
          wrote on last edited by
          #4

          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 screenPosition

          So 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!

          1 Reply Last reply
          0
          • AlicemirrorA Offline
            AlicemirrorA Offline
            Alicemirror
            wrote on last edited by
            #5

            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.

            Enrico Miglino (aka Alicemirror)
            Balearic Dynamics
            Islas Baleares, Ibiza (Spain)
            www.balearicdynamics.com

            1 Reply Last reply
            0
            • C Offline
              C Offline
              cmer4
              wrote on last edited by
              #6

              Hey! This is indeed a good explanation;) thank you.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved