fix: keep QGIS plugin actions out of native macOS menus#103
Merged
Conversation
Without an explicit NoRole hint, PyQt routes plugin QActions into the macOS application menu, leaving them missing from the OpenGeoAgent toolbar and menu. This sets MenuRole.NoRole on every plugin action in a way that works for both PyQt5 and PyQt6, with tests covering both enum shapes.
|
🚀 Deployed on https://6a147ceba26fdf53b8bbcb13--opengeos.netlify.app |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a small helper to set QAction.MenuRole.NoRole (with PyQt5 fallback) on all OpenGeoAgent plugin actions so macOS doesn't relocate them into the native application menu.
Changes:
- New
_set_no_native_menu_role()helper supporting both PyQt5 and PyQt6 enum shapes. add_action()applies the helper to every QAction it creates.- Added two unit tests covering both PyQt enum shapes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| qgis_geoagent/open_geoagent/open_geoagent.py | Adds helper and invokes it during QAction construction. |
| qgis_geoagent/tests/test_startup_performance.py | Adds tests verifying the helper sets the correct menu role under both PyQt6 and PyQt5 enum shapes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_set_no_native_menu_rolehelper and apply it when building plugin QActions so they stay in the OpenGeoAgent toolbar/menu instead of being absorbed into the native macOS application menu.QAction.NoRole) and PyQt6 (QAction.MenuRole.NoRole) without importing either binding directly.Test plan
pre-commit run --all-filespytest qgis_geoagent/tests/test_startup_performance.py