JaWeilBaum / pyqtlet2

pyqtlet2 extends pyqtlet which initially brought Leaflet maps to PyQt5 and PySide6.
Other
37 stars 19 forks source link

event on marker click #18

Closed pmakowski closed 2 years ago

pmakowski commented 2 years ago

Hi, thanks for your work. Is is possible to get information about a marker when user click on it ? map.clicked.connect is quiet when you click on a marker.

Thanks

JaWeilBaum commented 2 years ago

Hi @pmakowski you can connect to the click event of a marker. You can find the event inside the marker class. Have a look here.

If I understand you correctly, you try to connect to map.clicked which would fire when the map is clicked, right?

There is a known limitation, that you will not get updates from a marker when you add them after the application/map was initialized. The limitaion is made by QWebChannel::registerObject.

My workaround in a project where I have multiple hundred markers is, to add a set of markers in the beginning and managing thier visibility during the application lifecyle.