Solved! Go to Solution.
That error is a known issue. It won't hurt anything and we are looking into a way to suppress it.
I wonder if you could do something like this:
FeatureLayer {
id: sprayingFeatureLayer
featureTable: localGDB.geodatabaseFeatureTablesByTableName["SprayingLog"]
visible: loadStatus === Enums.LoadStatusLoaded && activeMode === "Spraying"
}
I have a few thoughts. First is that the FeatureLayer is Loadable, just like how Geodatabase is Loadable. So you can connect to the loadStatusChanged signal and wait for the loadStatus to be completed. My other thought is that you should be able to set the visibility of a layer before or after it loaded, and it should persist. Is that not what you are seeing?
Side note - you can see in the detailed description that it implements the Loadable interface - FeatureLayer QML Type | ArcGIS for Developers
Also, the Loadable documentation has a list of all classes that implement it (and therefore have the loadStatusChanged signal) - http://developersdev.arcgis.com/qt/latest/qml/api-reference/qml-esri-arcgisruntime-loadable.html
//
You can connect to it any time after is instantiated, but before it becomes the load process. It will load either if you explicitly call load(), or if you add it to a map, which will implicitly start the load cycle.
I'll try to test out the visibility issue.
Can you by chance do this declaratively instead of in JavaScript code? Our sample gives an example of how you can declaratively add a local feature table from a Geodatabase by table name. You can also do it by index if that is easier - Feature layer (geodatabase)—ArcGIS Runtime SDK for Qt | ArcGIS for Developers
The issue with the above code is that a bunch of variables are getting created in the scope of that function, and as soon as the function returns, they all go out of scope. Doing it declaratively would eliminate that issue. If you end up needing to create it in JS code like what you have, then you need to add these layers to some top level global object that will persist even when the the function returns.
//
That error is a known issue. It won't hurt anything and we are looking into a way to suppress it.
I wonder if you could do something like this:
FeatureLayer {
id: sprayingFeatureLayer
featureTable: localGDB.geodatabaseFeatureTablesByTableName["SprayingLog"]
visible: loadStatus === Enums.LoadStatusLoaded && activeMode === "Spraying"
}
//
No problem. QML works best when you try and think about how you can do it declaratively versus in JS code. Your code will look nicer, performance will be better, and chances for bugs will probably be less.