Select to view content in your preferred language

retryLoad is no work

972
4
01-19-2021 10:24 PM
Tkm_Knj
Emerging Contributor

I try to do retryLoad(), but It's no work. 

import QtQuick 2.6
import QtQuick.Controls 2.2
import Esri.ArcGISRuntime 100.9

ApplicationWindow {
    id: appWindow
    width: 800
    height: 600
    title: "TestMap"

    // add a mapView component
    MapView {
        id: viewtest
        anchors.fill: parent
        // set focus to enable keyboard navigation
        focus: true

        // add a map to the mapview
        Map {
            id: mapType
            // add the BasemapTopographic basemap to the map
            BasemapTopographic {}
        }
    }

    Shortcut{
        sequence: "F5"
        onActivated: {
           mapType.retryLoad()
        }
    }
}

 It shoulde be work retryLoad, if  "F5" key is clicked. 

But mapType.loadStatus remain Enums.LoadStatusFailedToLoad.

 

My environment 

:Qt 1.15.0 MSVC2019

:ArcGIS 100.9

 

It something missing or My environment is worse?

0 Kudos
4 Replies
LucasDanzinger
Esri Frequent Contributor

Can you connect to the loadStatusChanged and get the error.message and error.additionalMessage when it fails? What does it say?

 

onLoadStatusChanged: {
    if (loadStatus === Enums.LoadStatusFailedToLoad) {
        console.log("Error:", error.message, error.additionalMessage);
    }
}
0 Kudos
Tkm_Knj
Emerging Contributor

It say  [ qml: Error: Invalid response The service is not tiled].

I get this error when application startup (offline) or click "F5".

 

By the way, I changed the code as follows, and the [loadStatus] remains [Loading].

 

    MapView {
        anchors.fill: parent
        // set focus to enable keyboard navigation
        focus: true

        // add a map to the mapview
        Map {
            id: mapType
            // add the BasemapTopographic basemap to the map
//            BasemapTopographic {
//                id: bMap
//            }
            Basemap{
                ArcGISTiledLayer{
                    url: "https://www.arcgis.com/home/item.html?id=30e5fe3149c34df1ba922e6f5bbf808f"
                }
            }


            onLoadStatusChanged: {
                if (loadStatus === Enums.LoadStatusFailedToLoad) {
                    console.log("Error:", error.message, error.additionalMessage);
                }
            }
        }
    }

    Shortcut{
        sequence: "F5"
        onActivated: {
            mapType.cancelLoad()
            mapType.retryLoad()
        }
    }

 

This code isn't  triggered [onLoadStatusChanged]. (except cancelLoad is called) .

And the map doesn't finish loading and doesn't show up.

I don't need to stick with [retryLoad()] because I want to be able to start it offline and reload it when it comes online after startup...

Do you have any ideas?

0 Kudos
LucasDanzinger
Esri Frequent Contributor

I took this code an ran it successfully on my machine - the map loads and displays. Do you have network connection? What platform are you testing on?

0 Kudos
Tkm_Knj
Emerging Contributor

yes, I made sure the network was connected when I did the [retryLoad()].

My platform is QtCreator 4.14.0-rc1(4.13.84).

0 Kudos