How do I display a legend symbol as a regular Qt Quick image (outside of a view/model/delegate)?

1079
1
03-17-2017 08:17 AM
JonathonGrivas
New Contributor III

I'm using version 100.0, and basing my code off of Show legend—ArcGIS Runtime SDK for Qt | ArcGIS for Developers 

I get that the file for each legendInfo's image is being created by the LegendInfoListModel, but is there any way I can get that image data and turn it into an image myself without relying on this system?  I can see the data in the responses from the server, but I don't know how to access it through your SDK. 

Currently, I have to generate a view/model/delegate for every layer, and keep them in existence while capturing the symbolUrl from the delegate itself and exposing that to the rest of my application. This means in order to render a simple icon I have to have all that overhead instead of just a simple Image {} object, which is probably not a good idea on mobile. 

One possibility I can already think of is to manually send a request to the legend endpoint, retrieve the imageData strings, and render a qt quick image from that. Is that what I'm going to have to do?

0 Kudos
1 Reply
LukeSmallwood
Esri Contributor

Hi Jonathon,

You ought to be able to access the LegendInfoListModel directly without needing to wire it up to a ListView. Then, in javascript, you could iterate over the rows in the model and access the data for the 

symbolUrl directly.

I believe that the first time you access this role for a row in the model, it will trigger an operation to retrieve the image so you will need to check for the url to be updated once this has been completed.

0 Kudos