Skip to content

[Customization] Add processing in user defined menu or toolbar#64913

Open
troopa81 wants to merge 5 commits intoqgis:masterfrom
troopa81:feat_custom_menu_toolbar_processing
Open

[Customization] Add processing in user defined menu or toolbar#64913
troopa81 wants to merge 5 commits intoqgis:masterfrom
troopa81:feat_custom_menu_toolbar_processing

Conversation

@troopa81
Copy link
Contributor

Implement the possibility to add processing algorithm action in user
defined menu or toolbar. When triggered, those actions would open a
dialog to parametrize and execute the associated processing.

processing

AlgorithmDialog is a Python implementation from the processing module,
so we use QgsPythonRunner to trigger the opening of the dialog.

include #64912 and #64900

Funded by Stadt Frankfurt am Main and Oslandia

@troopa81 troopa81 added Feature Frozen Feature freeze - Do not merge! labels Feb 12, 2026
@github-actions github-actions bot added this to the 4.0.0 milestone Feb 12, 2026
@troopa81 troopa81 modified the milestones: 4.0.0, 4.2.0 Feb 12, 2026
@troopa81 troopa81 force-pushed the feat_custom_menu_toolbar_processing branch from efc18c1 to 285a066 Compare February 12, 2026 11:31
@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 285a066)

🍎 MacOS Qt6 builds

Download MacOS Qt6 builds of this PR for testing.
This app is not notarized, run sudo xattr -d com.apple.quarantine /Applications/QGIS*.app to avoid the warning
(Built from commit 285a066)

Implement the possibility to add processing algorithm action in user
defined menu or toolbar. When triggered, those actions would open a
dialog to parametrize and execute the associated processing.

AlgorithmDialog is a Python implementation from the processing module,
so we use QgsPythonRunner to trigger the opening of the dialog.
@alexbruy
Copy link
Contributor

Should we remove existing Processing functionality to add algorithms to menus/toolbars to avoid duplication?

@troopa81
Copy link
Contributor Author

Should we remove existing Processing functionality to add algorithms to menus/toolbars to avoid duplication?

In the long term, I'd like too! But the logic is a bit different a would require more work to assure compatibilty

Comment on lines +71 to +75
const QString command( "import processing; from qgis.utils import iface;"
"dialog = processing.createAlgorithmDialog('%1');\n"
"if dialog: dialog.show()\n"
"else: iface.messageBar().pushMessage( 'Invalid algorithm id : %1', Qgis.MessageLevel.Warning )" );
QgsPythonRunner::run( command.arg( mProcessingAlgorithmId ) );
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's similar (rather fragile) logic in QgsProcessingHistoryProvider. I think we could improve this by adding a setExecAlgorithmDialogFunction method to QgsProcessingGuiRegistry, which allows us to set (from python) the function to exec the algorithm dialog. We could then call that from c++ code without having to duplicate this logic.

(Incidentally, this should be processing.execAlgorithmDialog, not createAlgorithmDialog/show)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I'll do it when bug fix is over

const QIcon lIcon = icon();
if ( !lIcon.isNull() )
{
// We have no idea what would be the best size to store, it depends on the widget that would
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why aren't we just getting the icon from the algorithm itself in readXmlItem ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why aren't we just getting the icon from the algorithm itself in readXmlItem ?

I was thinking that maybe later, we would propose the user to modify icon for processing action, especially the one for native algorithm where the icon is really often the same icon

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd leave that off till there's a concrete need for it. Right now it's just bloating the file size, and will result in a poorer quality (non-vector) icon.

@nyalldawson
Copy link
Collaborator

@troopa81

theoretical question: do you think this customisation support could allow us to add optional actions which aren't exposed by default? I am wondering if it would give us a way of integrating the functionality of the "plugin reloader" plugin, which is a must-have for plugin developers but shouldn't be exposed by default for "normal" users. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Frozen Feature freeze - Do not merge!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants