Skip to content

fix: keep QGIS plugin actions out of native macOS menus#103

Merged
giswqs merged 1 commit into
mainfrom
fix/qgis-action-menu-role
May 25, 2026
Merged

fix: keep QGIS plugin actions out of native macOS menus#103
giswqs merged 1 commit into
mainfrom
fix/qgis-action-menu-role

Conversation

@giswqs

@giswqs giswqs commented May 25, 2026

Copy link
Copy Markdown
Member

Summary

  • Add _set_no_native_menu_role helper 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.
  • Works under both PyQt5 (flat QAction.NoRole) and PyQt6 (QAction.MenuRole.NoRole) without importing either binding directly.

Test plan

  • pre-commit run --all-files
  • pytest qgis_geoagent/tests/test_startup_performance.py
  • Load the plugin in QGIS on macOS and confirm the OpenGeoAgent entries appear in the plugin menu and toolbar.

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.
Copilot AI review requested due to automatic review settings May 25, 2026 16:45
@github-actions

Copy link
Copy Markdown

@github-actions github-actions Bot temporarily deployed to pull request May 25, 2026 16:46 Inactive

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@giswqs giswqs merged commit c831e26 into main May 25, 2026
10 checks passed
@giswqs giswqs deleted the fix/qgis-action-menu-role branch May 25, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants