<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr"><meta http-equiv="content-type" content="text/html; charset=utf-8"><div dir="ltr"></div><div dir="ltr">Hallo Mike,</div><div dir="ltr"><br></div><div dir="ltr">Ob das nachfolgende als Best Practice durchgeht, weiß ich nicht, aber so habe ich das bisher gelöst:</div><div dir="ltr"><br></div><div dir="ltr">#create action in submenu </div><div dir="ltr"><div dir="ltr">menu = QMenu()</div><div dir="ltr">action = menu.addAction(<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">QIcon(':/plugins/[…].png')</span>, 'Name des Untermenüs', self.your_function)</div><div dir="ltr">action.setObjectName('internal_name')</div><div dir="ltr"><br></div><div dir="ltr">#set an Action for the main menu</div><div dir="ltr">main_action = QAction(<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">QIcon(':/plugins/[…].png')</span>, 'Name des Hauptmenüs', self.iface.mainWindow())</div><div dir="ltr">main_action.setMenu(menu)</div><div dir="ltr"><br></div><div dir="ltr">#add Main Menu to the Plugin menu </div><div dir="ltr">self.add_action('', text=self.tr(u'Name des Hauptmenüs'), action=main_action, parent=self.iface.mainWindow(), add_to_toolbar=False)</div><div dir="ltr"><br></div><div dir="ltr">Am „lebenden Objekt“ kannst du das beispielhaft in der Funktion iniGui() ab Zeile 199 anschauen:</div><div dir="ltr"><div style="display: block;" class=""><div style="-webkit-user-select: all; -webkit-user-drag: element; display: inline-block;" class="apple-rich-link" draggable="true" role="link" data-url="https://github.com/jagodki/Offline-MapMatching/blob/master/src/offlinemapmatching/offline_map_matching.py"><a style="border-radius:10px;font-family:-apple-system, Helvetica, Arial, sans-serif;display:block;-webkit-user-select:none;width:300px;user-select:none;-webkit-user-modify:read-only;user-modify:read-only;overflow:hidden;text-decoration:none;" class="lp-rich-link" rel="nofollow" href="https://github.com/jagodki/Offline-MapMatching/blob/master/src/offlinemapmatching/offline_map_matching.py" dir="ltr" role="button" draggable="false" width="300"><table style="table-layout:fixed;border-collapse:collapse;width:300px;background-color:#E9E9EB;font-family:-apple-system, Helvetica, Arial, sans-serif;" class="lp-rich-link-emailBaseTable" cellpadding="0" cellspacing="0" border="0" width="300"><tbody><tr><td vertical-align="center" align="center"><img alt="Offline-MapMatching.png" src="cid:6F1163FE-2953-40FB-8ADD-ED26171AFAB2"></td></tr><tr><td vertical-align="center"><table bgcolor="#E9E9EB" cellpadding="0" cellspacing="0" width="300" style="font-family:-apple-system, Helvetica, Arial, sans-serif;table-layout:fixed;background-color:rgba(233, 233, 235, 1);" class="lp-rich-link-captionBar"><tbody><tr><td style="padding:8px 0px 8px 0px;" class="lp-rich-link-captionBar-textStackItem"><div style="max-width:100%;margin:0px 16px 0px 16px;overflow:hidden;" class="lp-rich-link-captionBar-textStack"><div style="word-wrap:break-word;font-weight:500;font-size:12px;overflow:hidden;text-overflow:ellipsis;text-align:left;" class="lp-rich-link-captionBar-textStack-topCaption-leading"><a rel="nofollow" href="https://github.com/jagodki/Offline-MapMatching/blob/master/src/offlinemapmatching/offline_map_matching.py" style="text-decoration: none" draggable="false"><font color="#000000" style="color: rgba(0, 0, 0, 1);">Offline-MapMatching/src/offlinemapmatching/offline_map_matching.py at master · jagodki/Offline-MapMatching</font></a></div><div style="word-wrap:break-word;font-weight:400;font-size:11px;overflow:hidden;text-overflow:ellipsis;text-align:left;" class="lp-rich-link-captionBar-textStack-bottomCaption-leading"><a rel="nofollow" href="https://github.com/jagodki/Offline-MapMatching/blob/master/src/offlinemapmatching/offline_map_matching.py" style="text-decoration: none" draggable="false"><font color="#A2A2A9" style="color: rgba(60, 60, 67, 0.6);">github.com</font></a></div></div></td></tr></tbody></table></td></tr></tbody></table></a></div></div><br></div><div dir="ltr">Viele Grüße,</div><div dir="ltr">Christoph </div></div><div dir="ltr"><br><blockquote type="cite">Am 30.04.2024 um 19:31 schrieb mike--- via FOSSGIS-Talk-Liste <fossgis-talk-liste@fossgis.de>:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><span>Hallo zusammen,</span><br><span></span><br><span>kann jemand mit einem PyQGIS Codeschnipsel/-beispielen für Untermenüs in zwei Stufen aushelfen, also ungefähr so:</span><br><span></span><br><span>- Hauptmenü 1</span><br><span>- Hauptmenü 2 — Untermenü 2.1</span><br><span> --- Untermenü 2.2 --- Untermenü 2.2.1</span><br><span> --- Untermenü 2.2.2</span><br><span> --- Untermenü 2.3</span><br><span>- Hauptmenü 3</span><br><span>- Hauptmenü 4</span><br><span></span><br><span>Danke & BG aus HAL, mikeE.</span><br><span></span><br><span></span><br><span></span><br><span>-- </span><br><span>....................................................................</span><br><span>FOSSGIS-Konferenz 2025 mit OpenStreetMap-Event in Münster!</span><br><span>26.-29. März 2025 https://www.fossgis-konferenz.de/</span><br><span></span><br><span>FOSSGIS Vereinstermine:</span><br><span>https://fossgis.de/aktivit%C3%A4ten/termine/</span><br><span></span><br><span>FOSSGIS e.V, der Verein zur Förderung von Freier Software aus dem</span><br><span>GIS-Bereich und Freier Geodaten!</span><br><span>https://www.fossgis.de/ https://mastodon.online/@FOSSGISeV</span><br><span>____________________________________________________________________</span><br><span>FOSSGIS-Talk-Liste mailing list</span><br><span>FOSSGIS-Talk-Liste@fossgis.de</span><br><span>https://lists.fossgis.de/mailman/listinfo/fossgis-talk-liste</span><br></div></blockquote></div></body></html>