<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Hannes,</p>
<p>in C++ you could override<br>
void QgsMapCanvas::showContextMenu( QgsMapMouseEvent *event )</p>
<p>which creates and shows the context menu.</p>
<p>in Python showContextMenu is not available. There you could
re-implement <br>
void QgsMapCanvas::mousePressEvent( QMouseEvent *e ) to avoid any
calls of showContextMenu()</p>
<p>If you just like to modify the context menu, you might add a slot
for the <br>
void contextMenuAboutToShow( QMenu *menu, QgsMapMouseEvent *event
) signal that manipulates the menu.<br>
</p>
<p>Greetings, <br>
</p>
<p>Benjamin<br>
</p>
<br>
<p>So you might either override it or <br>
</p>
<p>to disable the context menu you can override
QgsMapCanvas::mousePressEvent</p>
<p><br>
</p>
<p>Am 03/09/2021 um 09:14 schrieb Johannes Kröger (WhereGroup):<br>
</p>
<blockquote type="cite"
cite="mid:ad85c1b5-eb80-8c16-2672-276bd90799f5@wheregroup.com">Hi
list!
<br>
<br>
In QGIS 3.16 a right-click context menu was added to the map
canvas:
<a class="moz-txt-link-freetext" href="https://www.qgis.org/en/site/forusers/visualchangelog316/index.html#add-context-menu-to-map-canvas">https://www.qgis.org/en/site/forusers/visualchangelog316/index.html#add-context-menu-to-map-canvas</a><br>
<br>
How can we disable that via PyQGIS?
<br>
<br>
<a class="moz-txt-link-freetext" href="https://qgis.org/pyqgis/master/gui/QgsMapCanvas.html">https://qgis.org/pyqgis/master/gui/QgsMapCanvas.html</a> lists a
"contextMenuEvent" method but does not provide any documentation
at all.
<br>
<br>
The environment is a QGIS based standalone application.
<br>
<br>
Cheers, Hannes
<br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
QGIS-Developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Benjamin Jakimow, Doctoral Researcher
Earth Observation Lab | Geography Department | Humboldt-Universität zu Berlin
e-mail: <a class="moz-txt-link-abbreviated" href="mailto:benjamin.jakimow@geo.hu-berlin.de">benjamin.jakimow@geo.hu-berlin.de</a>
phone: +49 (0) 30 2093 6846
mobile: +49 (0) 157 5656 8477
fax: +49 (0) 30 2093 6848
mail: Unter den Linden 6 | 10099 Berlin | Germany
room: 2'211
web: <a class="moz-txt-link-freetext" href="https://hu-berlin.de/eo-lab">https://hu-berlin.de/eo-lab</a></pre>
</body>
</html>