Hi,
I am using arcgis 100.6 and qt 5.12.1 for application development.
I want to display some text information alongside my symbol(S1) . I have tried 2 methods to do the same and facing issues in both.
1. Using TextSymbol class
2. Using labelDefinitions() function of LabelDefinitionListModel class
1. Using TextSymbol class: When using TextSymbol to display the data, I first assigned same coordinates as the symbol(S1) to the textSymbol (TS) . Both the symbols overlap as expected
To avoid the overlap I set the geometry of the TextSymbol with some offset as follows:
TS<SPAN class="operator token">-></SPAN><SPAN class="token function">setGeometry</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">Point</SPAN><SPAN class="punctuation token">(</SPAN>S1<SPAN class="punctuation token">.</SPAN>y <SPAN class="operator token">+</SPAN> <SPAN class="number token">0.01</SPAN><SPAN class="punctuation token">,</SPAN> S1<SPAN class="punctuation token">.</SPAN>x <SPAN class="operator token">+</SPAN> <SPAN class="number token">0.01</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">4326</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
However I am observing that the distance between both symbols changes when zoomed in or out. Below are images for S1 and TS with same offset (0.01) but different zoom in scales. The distance between S1 and TS increases as I zoom in more. Is there a way to avoid this??

===========================================================================================
2. Using labelDefinitions() function of LabelDefinitionListModel class: The second way I used was using labelDefinitions(). Here the distance between the symbol (S1) and label (L1) remains constant on zoom in zoom out but the placement of L1 is far from the S1. I tried different labelPlacement options available in labelDefinitions() but all seem to display approximately the same distance.

The labeldefinitions() uses the following json string:
QString mapcode<SPAN class="punctuation token">:</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="token function">createLabelJsonName</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">const</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">return</SPAN> <SPAN class="token function">QString</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">QStringLiteral</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"{\"labelExpressionInfo\":{\"expression\":\"'I - ' + $feature.NAME\"},"</SPAN>
<SPAN class="string token">"\"labelPlacement\":\"esriServerPointBelowCenter\","</SPAN>
<SPAN class="string token">"\"where\":\"NAME <> ' '\","</SPAN>
<SPAN class="string token">"\"allowOverlapOflabel\":\"avoid\","</SPAN>
<SPAN class="string token">"\"allowOverlapOfFeatureBoundary\":\"avoid\","</SPAN>
<SPAN class="string token">"\"maxScale\":\"0\",\"minScale\":\"0\","</SPAN>
<SPAN class="string token">"\"symbol\": {\"angle\":0,\"backgroundColor\":[0,0,0,0],"</SPAN>
<SPAN class="string token">"\"borderLineColor\":[0,0,0,0],"</SPAN>
<SPAN class="string token">"\"borderLineSize\":0,\"color\":[0,0,255,255],"</SPAN>
<SPAN class="string token">"\"font\": {\"decoration\":\"none\",\"size\":10,"</SPAN>
<SPAN class="string token">"\"style\":\"normal\",\"weight\":\"normal\"},"</SPAN>
<SPAN class="string token">"\"haloColor\":[255,255,0,255],\"haloSize\":1.5,"</SPAN>
<SPAN class="string token">"\"horizontalAlignment\":\"center\",\"kerning\":false,"</SPAN>
<SPAN class="string token">"\"type\":\"esriTS\",\"verticalAlignment\":\"middle\",\"xoffset\":0,\"yoffset\":0}}"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>I want L1 to be placed directly above or below S1. Is there a way to acheive this using labels??