QGIS API Documentation 3.41.0-Master (af5edcb665c)
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:
79 QgsProcessingModelerParameterWidget( QgsProcessingModelAlgorithm *model, const QString &childId, const QgsProcessingParameterDefinition *parameter, QgsProcessingContext &context, QWidget *parent SIP_TRANSFERTHIS = nullptr );
80
82
88 void setWidgetContext( const QgsProcessingParameterWidgetContext &context );
89
94 void registerProcessingContextGenerator( QgsProcessingContextGenerator *generator );
95
110 void populateSources( const QStringList &compatibleParameterTypes, const QStringList &compatibleOutputTypes, const QList<int> &compatibleDataTypes );
111
117 void setExpressionHelpText( const QString &text );
118
122 const QgsProcessingParameterDefinition *parameterDefinition() const;
123
129 QLabel *createLabel() SIP_FACTORY;
130
136 virtual void setWidgetValue( const QgsProcessingModelChildParameterSource &value );
137
144 void setWidgetValue( const QList<QgsProcessingModelChildParameterSource> &values );
145
153 void setToModelOutput( const QString &value );
154
162 bool isModelOutput() const;
163
171 QString modelOutputName() const;
172
178 virtual QVariant value() const;
179
185 void setDialog( QDialog *dialog );
186
187 QgsExpressionContext createExpressionContext() const override;
188
194 void setSourceType( Qgis::ProcessingModelChildParameterSource type );
195
196 private slots:
197
198 void sourceMenuAboutToShow();
199 void sourceMenuActionTriggered( QAction *action );
200
201 private:
202 // IMPORTANT - must match order of widgets in the stacked widget!
203 enum SourceType
204 {
205 StaticValue = 0,
206 Expression = 1,
207 ModelParameter = 2,
208 ChildOutput = 3,
209 ModelOutput = 4,
210 };
211
212 SourceType currentSourceType() const;
213
214 void updateUi();
215
216 QgsProcessingModelAlgorithm *mModel = nullptr;
217 const QString mChildId;
218 const QgsProcessingParameterDefinition *mParameterDefinition = nullptr;
219 QgsProcessingContext &mContext;
220
221 QVariant mStaticValue;
222 QString mModelInputParameterName;
223 QString mOutputChildId;
224 QString mOutputName;
225 QString mExpression;
226
227 QToolButton *mSourceButton = nullptr;
228 QMenu *mSourceMenu = nullptr;
229 QStackedWidget *mStackedWidget = nullptr;
230
231 bool mHasStaticWrapper = false;
232 std::unique_ptr<QgsAbstractProcessingParameterWidgetWrapper> mStaticWidgetWrapper;
233 QgsExpressionLineEdit *mExpressionWidget = nullptr;
234 QComboBox *mModelInputCombo = nullptr;
235 QComboBox *mChildOutputCombo = nullptr;
236 QgsFilterLineEdit *mModelOutputName = nullptr;
237
238 QList<Qgis::ProcessingModelChildParameterSource> mLimitedSources;
239
240 friend class TestProcessingGui;
241};
242
243
244#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