QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsprocessingconfigurationwidgets.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprocessingconfigurationwidgets.h
3  ---------------------
4  begin : April 2018
5  copyright : (C) 2018 by Matthias Kuhn
6  email : [email protected]
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 QGSPROCESSINGCONFIGURATIONWIDGETS_H
20 #define QGSPROCESSINGCONFIGURATIONWIDGETS_H
21 
22 #define SIP_NO_FILE
23 
25 #include "qgis_gui.h"
26 
27 class QTableWidget;
28 
30 
31 class QgsFilterAlgorithmConfigurationWidget : public QgsProcessingAlgorithmConfigurationWidget
32 {
33  Q_OBJECT
34 
35  public:
36  QgsFilterAlgorithmConfigurationWidget( QWidget *parent = nullptr );
37 
38  QVariantMap configuration() const override;
39 
40  void setConfiguration( const QVariantMap &configuration ) override;
41 
42  private slots:
43  void removeSelectedOutputs();
44  void addOutput();
45 
46  private:
47  QTableWidget *mOutputExpressionWidget;
48 };
49 
50 class QgsFilterAlgorithmConfigurationWidgetFactory : public QgsProcessingAlgorithmConfigurationWidgetFactory
51 {
52  public:
54  bool canCreateFor( const QgsProcessingAlgorithm *algorithm ) const override;
55 };
56 
57 
58 
59 class QgsConditionalBranchAlgorithmConfigurationWidget : public QgsProcessingAlgorithmConfigurationWidget
60 {
61  Q_OBJECT
62 
63  public:
64  QgsConditionalBranchAlgorithmConfigurationWidget( QWidget *parent = nullptr );
65 
66  QVariantMap configuration() const override;
67 
68  void setConfiguration( const QVariantMap &configuration ) override;
69 
70  private slots:
71  void removeSelectedConditions();
72  void addCondition();
73 
74  private:
75  QTableWidget *mConditionExpressionWidget;
76 };
77 
78 class QgsConditionalBranchAlgorithmConfigurationWidgetFactory : public QgsProcessingAlgorithmConfigurationWidgetFactory
79 {
80  public:
81  QgsConditionalBranchAlgorithmConfigurationWidget *create( const QgsProcessingAlgorithm *algorithm ) const override;
82  bool canCreateFor( const QgsProcessingAlgorithm *algorithm ) const override;
83 };
84 
86 
87 #endif // QGSPROCESSINGCONFIGURATIONWIDGETS_H
QgsProcessingAlgorithmConfigurationWidgetFactory::create
virtual QgsProcessingAlgorithmConfigurationWidget * create(const QgsProcessingAlgorithm *algorithm) const =0
Create a new configuration widget for algorithm.
algorithm
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
QgsProcessingAlgorithmConfigurationWidget::configuration
virtual QVariantMap configuration() const =0
Read the current configuration from this widget.
QgsProcessingAlgorithmConfigurationWidgetFactory
Interface base class for factories for algorithm configuration widgets.
Definition: qgsprocessingalgorithmconfigurationwidget.h:125
QgsProcessingAlgorithmConfigurationWidgetFactory::canCreateFor
virtual bool canCreateFor(const QgsProcessingAlgorithm *algorithm) const =0
Check if this factory can create widgets for algorithm.
qgsprocessingalgorithmconfigurationwidget.h
QgsProcessingAlgorithm
Abstract base class for processing algorithms.
Definition: qgsprocessingalgorithm.h:52
QgsProcessingAlgorithmConfigurationWidget::setConfiguration
virtual void setConfiguration(const QVariantMap &configuration)=0
Set the configuration which this widget should represent.
QgsProcessingAlgorithmConfigurationWidget
A configuration widget for processing algorithms allows providing additional configuration options di...
Definition: qgsprocessingalgorithmconfigurationwidget.h:41