QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgsprocessingparameterdefinitionwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingparameterdefinitionwidget.h
3 ----------------------------------------
4 begin : July 2019
5 copyright : (C) 2019 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
19#ifndef QGSPROCESSINGPARAMETERDEFINITIONWIDGET_H
20#define QGSPROCESSINGPARAMETERDEFINITIONWIDGET_H
21
22#include <QWidget>
23#include <QDialog>
24
25#include "qgis_gui.h"
26#include "qgis_sip.h"
30
32
33class QLineEdit;
34class QCheckBox;
35class QTabWidget;
36class QTextEdit;
37class QgsColorButton;
38
47{
48 Q_OBJECT
49
50 public:
66
74 virtual QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const = 0 SIP_FACTORY;
75
86 virtual void setWidgetContext( const QgsProcessingParameterWidgetContext &context );
87
96 const QgsProcessingParameterWidgetContext &widgetContext() const;
97
104 void registerProcessingContextGenerator( QgsProcessingContextGenerator *generator );
105
107
108 private:
109 QgsProcessingContextGenerator *mContextGenerator = nullptr;
111};
112
113
120class GUI_EXPORT QgsProcessingParameterDefinitionWidget : public QWidget
121{
122 Q_OBJECT
123 public:
140 QgsProcessingParameterDefinitionWidget( const QString &type, QgsProcessingContext &context, const QgsProcessingParameterWidgetContext &widgetContext, const QgsProcessingParameterDefinition *definition = nullptr, const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
141
147 QgsProcessingParameterDefinition *createParameter( const QString &name = QString() ) const SIP_FACTORY;
148
155 void registerProcessingContextGenerator( QgsProcessingContextGenerator *generator );
156
157 private:
158 QString mType;
159 QgsProcessingAbstractParameterDefinitionWidget *mDefinitionWidget = nullptr;
160 QLineEdit *mDescriptionLineEdit = nullptr;
161 QCheckBox *mRequiredCheckBox = nullptr;
162 QCheckBox *mAdvancedCheckBox = nullptr;
163
165};
166
173class GUI_EXPORT QgsProcessingParameterDefinitionDialog : public QDialog
174{
175 Q_OBJECT
176 public:
193 QgsProcessingParameterDefinitionDialog( const QString &type, QgsProcessingContext &context, const QgsProcessingParameterWidgetContext &widgetContext, const QgsProcessingParameterDefinition *definition = nullptr, const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
194
200 QgsProcessingParameterDefinition *createParameter( const QString &name = QString() ) const SIP_FACTORY;
201
207 void setComments( const QString &comments );
208
214 QString comments() const;
215
221 void setCommentColor( const QColor &color );
222
228 QColor commentColor() const;
229
233 void switchToCommentTab();
234
241 void registerProcessingContextGenerator( QgsProcessingContextGenerator *generator );
242
243 public slots:
244 void accept() override;
245
246 private:
247 QTabWidget *mTabWidget = nullptr;
248 QTextEdit *mCommentEdit = nullptr;
249 QgsColorButton *mCommentColorButton = nullptr;
251};
252
253
254#endif // QGSPROCESSINGPARAMETERDEFINITIONWIDGET_H
QFlags< ProcessingParameterFlag > ProcessingParameterFlags
Flags which dictate the behavior of Processing parameters.
Definition qgis.h:3562
A cross platform button subclass for selecting colors.
Abstract interface for generating an expression context.
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Abstract base class for widgets which allow users to specify the properties of a Processing parameter...
virtual QgsProcessingParameterDefinition * createParameter(const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags) const =0
Returns a new instance of a parameter definition, using the current settings defined in the dialog.
Abstract base class for processing algorithms.
An interface for objects which can create Processing contexts.
Contains information about the context in which a processing algorithm is executed.
A dialog which allow users to specify the properties of a Processing parameter.
A widget which allow users to specify the properties of a Processing parameter.
Base class for the definition of processing parameters.
Contains settings which reflect the context in which a Processing parameter widget is shown,...
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_FACTORY
Definition qgis_sip.h:76