Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-65498

[QML] GeocodeModel gets stuck in Loading status

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.9.5
    • 5.9.3
    • Location: Places
    • None
    • * Windows 10 64 bit
       * Qt 5.9.3 MSVC 2015 32 bit

    Description

      The GeocodeModel always gets stuck in Loading state if try to call the update() method quickly. E.g. this happens at trying to request a 'to coordinate' after the 'from coordinate' was requested:

       

      Window {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      
          Plugin {
              id: thePlugin
              name: "osm"
          }
      
          GeocodeModel {
              id: geocodeModel
              plugin: thePlugin
              limit: 1
      
              property int success: -1
              property string fromAddress: "Moscow"
              property string toAddress: "Oslo"
              property variant fromCoordinate;
              property variant toCoordinate;
      
              onSuccessChanged: {
                  console.info("Success: "  + success)
                  if (success === 0) {
                      console.info("Request from: "  + fromAddress)
                      query = fromAddress;
                      update();
                  } else if (success === 1) {
                      fromCoordinate = get(0).coordinate;
                      console.info("Result from: "  + fromCoordinate)
                      console.info("Request to: "  + toAddress)
                      query = toAddress;
                      update();
                  } else if (success === 2) {
                      toCoordinate = get(0).coordinate;
                      console.info("Result to: "  + toCoordinate)
                      //
                  } else if (success === -1) {
                      console.info("NOT FOUND")
                  }
              }
      
              onStatusChanged: {
                  console.info("Status: "  + status + ", count:" + count)
      
                  if (status === GeocodeModel.Ready) {
                      if (count > 0)
                          ++success;
                      else
                          success = -1;
                  }
              }
          }
      
          Button {
              text: "Go"
              onClicked: {
                  geocodeModel.success = 0;
              }
          }
      }
      

      This code output following:

       

      qml: Success: 0
      qml: Request from: Moscow
      qml: Status: 2, count:0
      qml: Status: 1, count:1
      qml: Success: 1
      qml: Result from: 55° 45' 2.6" N, 37° 37' 3.6" E
      qml: Request to: Oslo
      qml: Status: 2, count:1

      So, the second request for 'Oslo' gets stuck forewer, please see a source project in an attachment.

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            paangele Paolo Angelelli
            kuzulis Denis Shienkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes