Is there any way to use C++ or QML to override the default behaviors of the MapView such as double click to zoom in?
My idea was to extend the MapQuickView class and give it custom features
One option would be to subclass MapView. In the API, we have MapView subclassed as MapQuickView (for Qt Quick) and MapGraphicsView (for Qt Widgets), so you could subclass MapView on your own and add whatever default behaviors you want to your own CustomMapQuickView.
A simpler but less elegant option would be to add a MouseArea over your MapView in QML. This automatically accepts all mouse/wheel events that go through, so you would need to listen to the various signal handlers and then have those call functions that do whatever you want.
MapView <SPAN class="punctuation token">{</SPAN> anchors<SPAN class="punctuation token">.</SPAN>fill<SPAN class="punctuation token">:</SPAN> parent objectName<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"mapView"</SPAN> MouseArea <SPAN class="punctuation token">{</SPAN> anchors<SPAN class="punctuation token">.</SPAN>fill<SPAN class="punctuation token">:</SPAN> parent onDoubleClicked<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"double click"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="token function">customCppFunctionToHandleDoubleClicks</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> onClicked<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"single click"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="token function">customCppFunctionToHandleSingleClicks</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</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>
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.