Graphic Tooltip

813
2
07-31-2018 09:45 PM
PaulrajJ
New Contributor II

Hi,

I have to display n number of graphic(PictureMarkerSymbol) in the mapview. I can able to display the graphic in mapview, I need one more additional option like while hovering the mouse over the graphic it should display the unique name of each graphic. 

Below is the code for adding the graphics(PictureMarkerSymbol)  in mapview. In that how to add a tool-tip to each graphic?

PictureMarkerSymbol *picSymbol = new PictureMarkerSymbol("icon.png",this);

foreach(const Point &pnt, pntList) {

   Graphic *graphic = new Graphic(pnt, picSymbol);

   m_graphicsoverlay->graphics()->append(graphic);

}

m_mapview->graphicsoverlays()->append(m_graphicsoverlay);

Thanks

Paulraj

0 Kudos
2 Replies
JamesBallard1
Esri Contributor

Hello Paulraj J,

There's a sample that demonstrates how to do the graphics identify. 

arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/DisplayInformation/IdentifyGraphics at maste...  

Instead of identifying on a mouse click, you could identify on the mouseMove event to get the mouse hovering functionality you want.

MapQuickView Class | ArcGIS for Developers 

You could also add names to each Graphic via the graphics' attributes. Here's a constructor for Graphic that will let you do that in one step:

Graphic Class | ArcGIS for Developers  

When you identify any graphics, you could get the graphic's name attribute that you added previously.

As for displaying the tooltip, you could look into the Callout object and customize what's displayed (the name, for example). Here's a sample that shows how to use the Callout:

arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/DisplayInformation/ShowCallout at master · E...  

I hope that helps.

PaulrajJ
New Contributor II

Thanks Mr.James Ballard, I can able to make it out based on your input.

One more useful sample I found here

arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/Search/FindAddress at master · Esri/arcgis-r... 

0 Kudos