QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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"
28 
30 class QLineEdit;
31 class QCheckBox;
32 
40 class GUI_EXPORT QgsProcessingAbstractParameterDefinitionWidget : public QWidget
41 {
42  Q_OBJECT
43 
44  public:
45 
61  const QgsProcessingParameterWidgetContext &widgetContext,
62  const QgsProcessingParameterDefinition *definition = nullptr,
63  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
64 
72  virtual QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const = 0 SIP_FACTORY;
73 };
74 
75 
82 class GUI_EXPORT QgsProcessingParameterDefinitionWidget: public QWidget
83 {
84  Q_OBJECT
85  public:
86 
103  QgsProcessingParameterDefinitionWidget( const QString &type,
104  QgsProcessingContext &context,
105  const QgsProcessingParameterWidgetContext &widgetContext,
106  const QgsProcessingParameterDefinition *definition = nullptr,
107  const QgsProcessingAlgorithm *algorithm = nullptr,
108  QWidget *parent SIP_TRANSFERTHIS = nullptr );
109 
115  QgsProcessingParameterDefinition *createParameter( const QString &name = QString() ) const SIP_FACTORY;
116 
117  private:
118 
119  QString mType;
120  QgsProcessingAbstractParameterDefinitionWidget *mDefinitionWidget = nullptr;
121  QLineEdit *mDescriptionLineEdit = nullptr;
122  QCheckBox *mRequiredCheckBox = nullptr;
123  QCheckBox *mAdvancedCheckBox = nullptr;
124 
126 
127 };
128 
135 class GUI_EXPORT QgsProcessingParameterDefinitionDialog: public QDialog
136 {
137  Q_OBJECT
138  public:
139 
156  QgsProcessingParameterDefinitionDialog( const QString &type,
157  QgsProcessingContext &context,
158  const QgsProcessingParameterWidgetContext &widgetContext,
159  const QgsProcessingParameterDefinition *definition = nullptr,
160  const QgsProcessingAlgorithm *algorithm = nullptr,
161  QWidget *parent SIP_TRANSFERTHIS = nullptr );
162 
168  QgsProcessingParameterDefinition *createParameter( const QString &name = QString() ) const SIP_FACTORY;
169 
170  public slots:
171  void accept() override;
172 
173  private:
174 
175  QgsProcessingParameterDefinitionWidget *mWidget = nullptr;
176 
177 };
178 
179 
180 #endif // QGSPROCESSINGPARAMETERDEFINITIONWIDGET_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
Abstract base class for widgets which allow users to specify the properties of a Processing parameter...
Abstract base class for processing algorithms.
A dialog which allow users to specify the properties of a Processing parameter.
#define SIP_FACTORY
Definition: qgis_sip.h:76
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
A widget which allow users to specify the properties of a Processing parameter.
Contains settings which reflect the context in which a Processing parameter widget is shown...
Base class for the definition of processing parameters.
Contains information about the context in which a processing algorithm is executed.