-
Bug
-
Resolution: Done
-
P2: Important
-
5.9.3
-
None
-
* Windows 10 64 bit
* Qt 5.9.3 MSVC 2015 32 bit
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.