mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.35k stars 1.33k forks source link

[Qt5] How to add event for symbol click? #16607

Closed Higuy8000 closed 2 years ago

Higuy8000 commented 3 years ago

I've seen some other code around here in the issues about being able to click on symbols with a "OnMapClicked" event, and additionally a SymbolManager for Andriod, but I can't seem to find anything similar for the Qt framework. I believe there is also another function, VisibleFeatures, that could be helping me here but it does not seem like it is available in the Qt SDK either...

Specifically, it'd be nice to connect a slot to an event when a feature is clicked and get that feature so I can do things with it (like display some information about said feature or show a pop up).

Is this currently possible in some way? The example Qt5 application does not show any of this sort of functionality, just rendering things through a keyPressEvent.

zxj5470 commented 3 years ago

We can add queryRenderFeatures function several times in several files...

Higuy8000 commented 2 years ago

We can add queryRenderFeatures function several times in several files...

Yes... fixed this a while ago. I had to manually go in and expose the functions myself in the mapbox headers.

It also required adding functionality to convert back from internal mapbox types to Qt types - only the other direction seems to be supported currently in the library.