QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgsprocessingmodelerparameterwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingmodelerparameterwidget.h
3 -------------------------------------
4 begin : August 2018
5 copyright : (C) 2018 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 QGSPROCESSINGMODELERPARAMETERWIDGET_H
20#define QGSPROCESSINGMODELERPARAMETERWIDGET_H
21
22#include <QWidget>
23#include "qgis_gui.h"
24#include "qgis_sip.h"
25#include <QPointer>
28
32class QgsProcessingModelAlgorithm;
36
37class QLabel;
38class QToolButton;
39class QMenu;
40class QStackedWidget;
41class QComboBox;
42
62{
63 Q_OBJECT
64
65 public:
66
80 QgsProcessingModelerParameterWidget( QgsProcessingModelAlgorithm *model,
81 const QString &childId,
82 const QgsProcessingParameterDefinition *parameter,
83 QgsProcessingContext &context,
84 QWidget *parent SIP_TRANSFERTHIS = nullptr );
85
87
93 void setWidgetContext( const QgsProcessingParameterWidgetContext &context );
94
99 void registerProcessingContextGenerator( QgsProcessingContextGenerator *generator );
100
115 void populateSources( const QStringList &compatibleParameterTypes,
116 const QStringList &compatibleOutputTypes,
117 const QList< int > &compatibleDataTypes );
118
124 void setExpressionHelpText( const QString &text );
125
129 const QgsProcessingParameterDefinition *parameterDefinition() const;
130
136 QLabel *createLabel() SIP_FACTORY;
137
143 virtual void setWidgetValue( const QgsProcessingModelChildParameterSource &value );
144
151 void setWidgetValue( const QList< QgsProcessingModelChildParameterSource > &values );
152
160 void setToModelOutput( const QString &value );
161
169 bool isModelOutput() const;
170
178 QString modelOutputName() const;
179
185 virtual QVariant value() const;
186
192 void setDialog( QDialog *dialog );
193
194 QgsExpressionContext createExpressionContext() const override;
195
201 void setSourceType( Qgis::ProcessingModelChildParameterSource type );
202
203 private slots:
204
205 void sourceMenuAboutToShow();
206 void sourceMenuActionTriggered( QAction *action );
207
208 private:
209
210 // IMPORTANT - must match order of widgets in the stacked widget!
211 enum SourceType
212 {
213 StaticValue = 0,
214 Expression = 1,
215 ModelParameter = 2,
216 ChildOutput = 3,
217 ModelOutput = 4,
218 };
219
220 SourceType currentSourceType() const;
221
222 void updateUi();
223
224 QgsProcessingModelAlgorithm *mModel = nullptr;
225 const QString mChildId;
226 const QgsProcessingParameterDefinition *mParameterDefinition = nullptr;
227 QgsProcessingContext &mContext;
228
229 QVariant mStaticValue;
230 QString mModelInputParameterName;
231 QString mOutputChildId;
232 QString mOutputName;
233 QString mExpression;
234
235 QToolButton *mSourceButton = nullptr;
236 QMenu *mSourceMenu = nullptr;
237 QStackedWidget *mStackedWidget = nullptr;
238
239 bool mHasStaticWrapper = false;
240 std::unique_ptr< QgsAbstractProcessingParameterWidgetWrapper > mStaticWidgetWrapper;
241 QgsExpressionLineEdit *mExpressionWidget = nullptr;
242 QComboBox *mModelInputCombo = nullptr;
243 QComboBox *mChildOutputCombo = nullptr;
244 QgsFilterLineEdit *mModelOutputName = nullptr;
245
246 QList< Qgis::ProcessingModelChildParameterSource > mLimitedSources;
247
248 friend class TestProcessingGui;
249};
250
251
252#endif // QGSPROCESSINGMODELERPARAMETERWIDGET_H
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
A widget wrapper for Processing parameter value widgets.
Abstract interface for generating an expression context.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
The QgsExpressionLineEdit widget includes a line edit for entering expressions together with a button...
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
An interface for objects which can create Processing contexts.
Contains information about the context in which a processing algorithm is executed.
A widget for customising the value of Processing algorithm parameter inside a Processing model.
Base class for the definition of processing parameters.
Contains settings which reflect the context in which a Processing parameter widget is shown,...
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_FACTORY
Definition qgis_sip.h:76