Use particular property of one qml file in another

1533
4
Jump to solution
07-13-2021 12:19 AM
SupratimChatterjee
New Contributor II

I have an application in which I am displaying the wgs84 coordinates on mouse click. There is a button which if clicked allows me to draw transects on the map(via mouse click). I would like to display the wgs84 coordinates in my transect application as well on mouse click. The transect qml file and the display coordinate qml file are different. Is there any way to use the display coordinate qml within my transect qml file? 

 

0 Kudos
1 Solution

Accepted Solutions
JamesBallard1
Esri Regular Contributor

Hi @SupratimChatterjee ,

I think the only piece you may be missing is the type registration.

https://github.com/Esri/arcgis-runtime-samples-qt/blob/main/ArcGISRuntimeSDKQt_CppSamples/DisplayInf...

If you need to expose data from C++ to QML, you can use Q_PROPERTY for that.

https://github.com/Esri/arcgis-runtime-samples-qt/blob/main/ArcGISRuntimeSDKQt_CppSamples/Routing/Na...

Let me know if that works for you.

View solution in original post

4 Replies
JamesBallard1
Esri Regular Contributor

Hi @SupratimChatterjee ,

Yes this is possible, but the specifics may differ based on your approach or specific app architecture.

We have a sample now, the HillShadeRenderer sample that has three qml files in the same app. They are able to share info and cross-call between them as needed.

https://github.com/Esri/arcgis-runtime-samples-qt/tree/main/ArcGISRuntimeSDKQt_QMLSamples/Layers/Hil...

You can see that https://github.com/Esri/arcgis-runtime-samples-qt/blob/main/ArcGISRuntimeSDKQt_QMLSamples/Layers/Hil... is calling a applyHillshadeRenderer function defined over in a different qml file: https://github.com/Esri/arcgis-runtime-samples-qt/blob/main/ArcGISRuntimeSDKQt_QMLSamples/Layers/Hil...

Using a similar pattern you should be able to share info between your qml files in your application.

0 Kudos
SupratimChatterjee
New Contributor II

Hi @JamesBallard1  

Actually, I have a C++ backend with the frontend in qml.  I would like to know if there is a way of combining these 2 projects .  

arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/DisplayInformation/ShowCallout at main · Esr... 

(ShowCallout example) 

arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/Geometry/GeodesicOperations at main · Esri/a...

(Geodesic operations example) 

I have tried to use the showCallout.qml within the geodesicoperations.qml but I get the error of unknown type.

0 Kudos
JamesBallard1
Esri Regular Contributor

Hi @SupratimChatterjee ,

I think the only piece you may be missing is the type registration.

https://github.com/Esri/arcgis-runtime-samples-qt/blob/main/ArcGISRuntimeSDKQt_CppSamples/DisplayInf...

If you need to expose data from C++ to QML, you can use Q_PROPERTY for that.

https://github.com/Esri/arcgis-runtime-samples-qt/blob/main/ArcGISRuntimeSDKQt_CppSamples/Routing/Na...

Let me know if that works for you.

SupratimChatterjee
New Contributor II

Hi @JamesBallard1  

I did the type registration. Turns out that I just had to implement a part of my code in the geodesicoperations file and import the arcgis toolkit in the qml file.

0 Kudos