QGIS API Documentation 4.3.0-Master (4a47d6a9bb1)
Loading...
Searching...
No Matches
qgsprocessingwidgetcontext.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingwidgetcontext.h
3 ---------------------
4 begin : August 2026
5 copyright : (C) 2026 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSPROCESSINGWIDGETCONTEXT_H
19#define QGSPROCESSINGWIDGETCONTEXT_H
20
21#include <memory>
22
23#include "qgis_gui.h"
24#include "qgis_sip.h"
25
26#include <QPointer>
27
28class QgsMapCanvas;
29class QgsMessageBar;
31class QgsProject;
32class QgsProcessingModelAlgorithm;
33class QgsMapLayer;
35class QgsModelDesignerDialog;
36
37// TODO QGIS 5: rename to QgsProcessingWidgetContext
38
50{
51 public:
53
59 void setMapCanvas( QgsMapCanvas *canvas );
60
65 QgsMapCanvas *mapCanvas() const;
66
73 void setMessageBar( QgsMessageBar *bar );
74
82
89
96
104
109 QgsProject *project() const;
110
117 QgsProcessingModelAlgorithm *model() const;
118
125 void setModel( QgsProcessingModelAlgorithm *model );
126
133 QString modelChildAlgorithmId() const;
134
141 void setModelChildAlgorithmId( const QString &id );
142
149 QgsMapLayer *activeLayer() const;
150
157 void setActiveLayer( QgsMapLayer *layer );
158
170
179
188 QgsModelDesignerDialog *modelDesignerDialog() const;
189
198 void setModelDesignerDialog( QgsModelDesignerDialog *dialog );
199
200 private:
201 QgsProcessingModelAlgorithm *mModel = nullptr;
202
203 QString mModelChildAlgorithmId;
204
205 QPointer< QgsMapCanvas > mMapCanvas;
206
207 QPointer< QgsMessageBar > mMessageBar;
208
209 QPointer< QgsProject > mProject;
210
211 QPointer< QgsBrowserGuiModel > mBrowserModel;
212
213 QPointer< QgsMapLayer > mActiveLayer;
214
215 QgsProcessingContextGenerator *mProcessingContextGenerator = nullptr;
216
217 QPointer< QgsModelDesignerDialog > mModelDialog;
218};
219
238
239
240#endif // QGSPROCESSINGWIDGETCONTEXT_H
A model for showing available data sources and other items in a structured tree.
Map canvas is a class for displaying all GIS data types on a canvas.
Base class for all map layer types.
Definition qgsmaplayer.h:83
A bar for displaying non-blocking messages to the user.
An interface for objects which can create Processing contexts.
Contains settings which reflect the context in which a Processing parameter widget is shown.
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
QgsProject * project() const
Returns the project associated with the widget.
QgsBrowserGuiModel * browserModel() const
Returns the browser model associated with the widget.
void setActiveLayer(QgsMapLayer *layer)
Sets the current active layer.
QgsModelDesignerDialog * modelDesignerDialog() const
Returns the associated model designer dialog, if applicable.
void setModelChildAlgorithmId(const QString &id)
Sets the child algorithm id within the model which the parameter widget is associated with.
void setProject(QgsProject *project)
Sets the project associated with the widget.
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
void setBrowserModel(QgsBrowserGuiModel *model)
Sets the browser model associated with the widget.
QgsProcessingModelAlgorithm * model() const
Returns the model which the parameter widget is associated with.
void setMessageBar(QgsMessageBar *bar)
Sets the message bar associated with the widget.
QgsMapLayer * activeLayer() const
Returns the current active layer.
void setModelDesignerDialog(QgsModelDesignerDialog *dialog)
Sets the associated model designer dialog, if applicable.
void setModel(QgsProcessingModelAlgorithm *model)
Sets the model which the parameter widget is associated with.
QgsProcessingContextGenerator * processingContextGenerator()
Returns the Processing context generator class that will be used to retrieve a Processing context for...
void registerProcessingContextGenerator(QgsProcessingContextGenerator *generator)
Registers a Processing context generator class that will be used to retrieve a Processing context for...
QString modelChildAlgorithmId() const
Returns the child algorithm ID within the model which the parameter widget is associated with.
An interface for objects which can create Processing widget contexts.
virtual QgsProcessingParameterWidgetContext createWidgetContext()=0
This method needs to be reimplemented in all classes which implement this interface and return a Proc...
virtual ~QgsProcessingWidgetContextGenerator()=default
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:114