33 #include <QHBoxLayout> 37 #include <QPlainTextEdit> 51 QWidget *QgsProcessingBooleanWidgetWrapper::createWidget()
57 QString description = parameterDefinition()->description();
59 description = QObject::tr(
"%1 [optional]" ).arg( description );
61 mCheckBox =
new QCheckBox( description );
62 mCheckBox->setToolTip( parameterDefinition()->toolTip() );
64 connect( mCheckBox, &QCheckBox::toggled,
this, [ = ]
66 emit widgetValueHasChanged(
this );
74 mComboBox =
new QComboBox();
75 mComboBox->addItem( tr(
"Yes" ),
true );
76 mComboBox->addItem( tr(
"No" ),
false );
77 mComboBox->setToolTip( parameterDefinition()->toolTip() );
79 connect( mComboBox, qgis::overload< int>::of( &QComboBox::currentIndexChanged ),
this, [ = ]
81 emit widgetValueHasChanged(
this );
90 QLabel *QgsProcessingBooleanWidgetWrapper::createLabel()
99 void QgsProcessingBooleanWidgetWrapper::setWidgetValue(
const QVariant &value,
QgsProcessingContext &context )
106 mCheckBox->setChecked( v );
114 mComboBox->setCurrentIndex( mComboBox->findData( v ) );
120 QVariant QgsProcessingBooleanWidgetWrapper::widgetValue()
const 125 return mCheckBox->isChecked();
129 return mComboBox->currentData();
134 QStringList QgsProcessingBooleanWidgetWrapper::compatibleParameterTypes()
const 151 QStringList QgsProcessingBooleanWidgetWrapper::compatibleOutputTypes()
const 161 QList<int> QgsProcessingBooleanWidgetWrapper::compatibleDataTypes()
const 163 return QList< int >();
166 QString QgsProcessingBooleanWidgetWrapper::parameterType()
const 173 return new QgsProcessingBooleanWidgetWrapper( parameter, type );
187 QWidget *QgsProcessingCrsWidgetWrapper::createWidget()
190 mProjectionSelectionWidget->setToolTip( parameterDefinition()->toolTip() );
199 emit widgetValueHasChanged(
this );
207 return mProjectionSelectionWidget;
212 QWidget *w =
new QWidget();
213 w->setToolTip( parameterDefinition()->toolTip() );
215 QVBoxLayout *vl =
new QVBoxLayout();
217 vl->setContentsMargins( 0, 0, 0, 0 );
220 mUseProjectCrsCheckBox =
new QCheckBox( tr(
"Use project CRS" ) );
221 mUseProjectCrsCheckBox->setToolTip( tr(
"Always use the current project CRS when running the model" ) );
222 vl->addWidget( mUseProjectCrsCheckBox );
223 connect( mUseProjectCrsCheckBox, &QCheckBox::toggled, mProjectionSelectionWidget, &QgsProjectionSelectionWidget::setDisabled );
224 connect( mUseProjectCrsCheckBox, &QCheckBox::toggled,
this, [ = ]
226 emit widgetValueHasChanged(
this );
229 vl->addWidget( mProjectionSelectionWidget );
237 void QgsProcessingCrsWidgetWrapper::setWidgetValue(
const QVariant &value,
QgsProcessingContext &context )
239 if ( mUseProjectCrsCheckBox )
241 if ( value.toString().compare( QLatin1String(
"ProjectCrs" ), Qt::CaseInsensitive ) == 0 )
243 mUseProjectCrsCheckBox->setChecked(
true );
248 mUseProjectCrsCheckBox->setChecked(
false );
253 if ( mProjectionSelectionWidget )
254 mProjectionSelectionWidget->setCrs( v );
257 QVariant QgsProcessingCrsWidgetWrapper::widgetValue()
const 259 if ( mUseProjectCrsCheckBox && mUseProjectCrsCheckBox->isChecked() )
260 return QStringLiteral(
"ProjectCrs" );
261 else if ( mProjectionSelectionWidget )
262 return mProjectionSelectionWidget->crs().isValid() ? mProjectionSelectionWidget->crs() : QVariant();
267 QStringList QgsProcessingCrsWidgetWrapper::compatibleParameterTypes()
const 279 QStringList QgsProcessingCrsWidgetWrapper::compatibleOutputTypes()
const 287 QList<int> QgsProcessingCrsWidgetWrapper::compatibleDataTypes()
const 289 return QList< int >();
292 QString QgsProcessingCrsWidgetWrapper::modelerExpressionFormatString()
const 294 return tr(
"string as EPSG code, WKT or PROJ format, or a string identifying a map layer" );
297 QString QgsProcessingCrsWidgetWrapper::parameterType()
const 304 return new QgsProcessingCrsWidgetWrapper( parameter, type );
319 QWidget *QgsProcessingStringWidgetWrapper::createWidget()
326 if ( static_cast< const QgsProcessingParameterString * >( parameterDefinition() )->multiLine() )
328 mPlainTextEdit =
new QPlainTextEdit();
329 mPlainTextEdit->setToolTip( parameterDefinition()->toolTip() );
331 connect( mPlainTextEdit, &QPlainTextEdit::textChanged,
this, [ = ]
333 emit widgetValueHasChanged(
this );
335 return mPlainTextEdit;
339 mLineEdit =
new QLineEdit();
340 mLineEdit->setToolTip( parameterDefinition()->toolTip() );
342 connect( mLineEdit, &QLineEdit::textChanged,
this, [ = ]
344 emit widgetValueHasChanged(
this );
352 mLineEdit =
new QLineEdit();
353 mLineEdit->setToolTip( parameterDefinition()->toolTip() );
355 connect( mLineEdit, &QLineEdit::textChanged,
this, [ = ]
357 emit widgetValueHasChanged(
this );
365 void QgsProcessingStringWidgetWrapper::setWidgetValue(
const QVariant &value,
QgsProcessingContext &context )
369 mLineEdit->setText( v );
370 if ( mPlainTextEdit )
371 mPlainTextEdit->setPlainText( v );
374 QVariant QgsProcessingStringWidgetWrapper::widgetValue()
const 377 return mLineEdit->text();
378 else if ( mPlainTextEdit )
379 return mPlainTextEdit->toPlainText();
384 QStringList QgsProcessingStringWidgetWrapper::compatibleParameterTypes()
const 396 QStringList QgsProcessingStringWidgetWrapper::compatibleOutputTypes()
const 403 QList<int> QgsProcessingStringWidgetWrapper::compatibleDataTypes()
const 405 return QList< int >();
408 QString QgsProcessingStringWidgetWrapper::parameterType()
const 415 return new QgsProcessingStringWidgetWrapper( parameter, type );
430 QWidget *QgsProcessingAuthConfigWidgetWrapper::createWidget()
439 mAuthConfigSelect->setToolTip( parameterDefinition()->toolTip() );
443 emit widgetValueHasChanged(
this );
445 return mAuthConfigSelect;
451 void QgsProcessingAuthConfigWidgetWrapper::setWidgetValue(
const QVariant &value,
QgsProcessingContext &context )
454 if ( mAuthConfigSelect )
455 mAuthConfigSelect->setConfigId( v );
458 QVariant QgsProcessingAuthConfigWidgetWrapper::widgetValue()
const 460 if ( mAuthConfigSelect )
461 return mAuthConfigSelect->configId();
466 QStringList QgsProcessingAuthConfigWidgetWrapper::compatibleParameterTypes()
const 474 QStringList QgsProcessingAuthConfigWidgetWrapper::compatibleOutputTypes()
const 479 QList<int> QgsProcessingAuthConfigWidgetWrapper::compatibleDataTypes()
const 481 return QList< int >();
484 QString QgsProcessingAuthConfigWidgetWrapper::parameterType()
const 491 return new QgsProcessingAuthConfigWidgetWrapper( parameter, type );
504 QWidget *QgsProcessingNumericWidgetWrapper::createWidget()
507 const QVariantMap metadata = numberDef->
metadata();
508 const int decimals = metadata.value( QStringLiteral(
"widget_wrapper" ) ).toMap().value( QStringLiteral(
"decimals" ), 6 ).toInt();
516 QAbstractSpinBox *spinBox =
nullptr;
521 mDoubleSpinBox->setExpressionsEnabled(
true );
522 mDoubleSpinBox->setDecimals( decimals );
528 double singleStep = calculateStep( numberDef->
minimum(), numberDef->
maximum() );
529 singleStep = std::max( singleStep, std::pow( 10, -decimals ) );
530 mDoubleSpinBox->setSingleStep( singleStep );
533 spinBox = mDoubleSpinBox;
538 mSpinBox->setExpressionsEnabled(
true );
542 spinBox->setToolTip( parameterDefinition()->toolTip() );
544 double max = 999999999;
549 double min = -999999999;
554 if ( mDoubleSpinBox )
556 mDoubleSpinBox->setMinimum( min );
557 mDoubleSpinBox->setMaximum( max );
561 mSpinBox->setMinimum( static_cast< int >( min ) );
562 mSpinBox->setMaximum( static_cast< int >( max ) );
567 mAllowingNull =
true;
568 if ( mDoubleSpinBox )
570 mDoubleSpinBox->setShowClearButton(
true );
571 const double min = mDoubleSpinBox->minimum() - 1;
572 mDoubleSpinBox->setMinimum( min );
573 mDoubleSpinBox->setValue( min );
577 mSpinBox->setShowClearButton(
true );
578 const int min = mSpinBox->minimum() - 1;
579 mSpinBox->setMinimum( min );
580 mSpinBox->setValue( min );
582 spinBox->setSpecialValueText( tr(
"Not set" ) );
590 if ( mDoubleSpinBox )
592 double defaultVal = numberDef->
defaultValue().toDouble( &ok );
594 mDoubleSpinBox->setClearValue( defaultVal );
600 mSpinBox->setClearValue( intVal );
606 if ( mDoubleSpinBox )
607 mDoubleSpinBox->setClearValue( numberDef->
minimum() );
609 mSpinBox->setClearValue( static_cast< int >( numberDef->
minimum() ) );
614 if ( mDoubleSpinBox )
616 mDoubleSpinBox->setValue( 0 );
617 mDoubleSpinBox->setClearValue( 0 );
621 mSpinBox->setValue( 0 );
622 mSpinBox->setClearValue( 0 );
627 if ( mDoubleSpinBox )
628 connect( mDoubleSpinBox, qgis::overload<double>::of( &QgsDoubleSpinBox::valueChanged ),
this, [ = ] { emit widgetValueHasChanged(
this ); } );
630 connect( mSpinBox, qgis::overload<int>::of( &QgsSpinBox::valueChanged ),
this, [ = ] { emit widgetValueHasChanged(
this ); } );
638 void QgsProcessingNumericWidgetWrapper::setWidgetValue(
const QVariant &value,
QgsProcessingContext &context )
640 if ( mDoubleSpinBox )
642 if ( mAllowingNull && !value.isValid() )
643 mDoubleSpinBox->clear();
647 mDoubleSpinBox->setValue( v );
652 if ( mAllowingNull && !value.isValid() )
657 mSpinBox->setValue( v );
662 QVariant QgsProcessingNumericWidgetWrapper::widgetValue()
const 664 if ( mDoubleSpinBox )
666 if ( mAllowingNull &&
qgsDoubleNear( mDoubleSpinBox->value(), mDoubleSpinBox->minimum() ) )
669 return mDoubleSpinBox->value();
673 if ( mAllowingNull && mSpinBox->value() == mSpinBox->minimum() )
676 return mSpinBox->value();
682 QStringList QgsProcessingNumericWidgetWrapper::compatibleParameterTypes()
const 690 QStringList QgsProcessingNumericWidgetWrapper::compatibleOutputTypes()
const 696 QList<int> QgsProcessingNumericWidgetWrapper::compatibleDataTypes()
const 698 return QList< int >();
701 double QgsProcessingNumericWidgetWrapper::calculateStep(
const double minimum,
const double maximum )
703 const double valueRange = maximum - minimum;
704 if ( valueRange <= 1.0 )
706 const double step = valueRange / 10.0;
708 return qgsRound( step, -std::floor( std::log( step ) ) );
716 QString QgsProcessingNumericWidgetWrapper::parameterType()
const 723 return new QgsProcessingNumericWidgetWrapper( parameter, type );
731 : QgsProcessingNumericWidgetWrapper( parameter, type, parent )
736 QString QgsProcessingDistanceWidgetWrapper::parameterType()
const 743 return new QgsProcessingDistanceWidgetWrapper( parameter, type );
746 QWidget *QgsProcessingDistanceWidgetWrapper::createWidget()
750 QWidget *spin = QgsProcessingNumericWidgetWrapper::createWidget();
755 mLabel =
new QLabel();
756 mUnitsCombo =
new QComboBox();
764 const int labelMargin =
static_cast< int >( std::round( mUnitsCombo->fontMetrics().width(
'X' ) ) );
765 QHBoxLayout *layout =
new QHBoxLayout();
766 layout->addWidget( spin, 1 );
767 layout->insertSpacing( 1, labelMargin / 2 );
768 layout->insertWidget( 2, mLabel );
769 layout->insertWidget( 3, mUnitsCombo );
774 mWarningLabel =
new QWidget();
775 QHBoxLayout *warningLayout =
new QHBoxLayout();
776 warningLayout->setMargin( 0 );
777 warningLayout->setContentsMargins( 0, 0, 0, 0 );
778 QLabel *warning =
new QLabel();
780 const int size =
static_cast< int >( std::max( 24.0, spin->minimumSize().height() * 0.5 ) );
781 warning->setPixmap( icon.pixmap( icon.actualSize( QSize( size, size ) ) ) );
782 warning->setToolTip( tr(
"Distance is in geographic degrees. Consider reprojecting to a projected local coordinate system for accurate results." ) );
783 warningLayout->insertSpacing( 0, labelMargin / 2 );
784 warningLayout->insertWidget( 1, warning );
785 mWarningLabel->setLayout( warningLayout );
786 layout->insertWidget( 4, mWarningLabel );
790 QWidget *w =
new QWidget();
791 layout->setMargin( 0 );
792 layout->setContentsMargins( 0, 0, 0, 0 );
793 w->setLayout( layout );
805 void QgsProcessingDistanceWidgetWrapper::postInitialize(
const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
807 QgsProcessingNumericWidgetWrapper::postInitialize( wrappers );
814 if ( wrapper->parameterDefinition()->name() ==
static_cast< const QgsProcessingParameterDistance *
>( parameterDefinition() )->parentParameterName() )
816 setUnitParameterValue( wrapper->parameterValue() );
819 setUnitParameterValue( wrapper->parameterValue() );
833 void QgsProcessingDistanceWidgetWrapper::setUnitParameterValue(
const QVariant &value )
839 std::unique_ptr< QgsProcessingContext > tmpContext;
840 if ( mProcessingContextGenerator )
841 context = mProcessingContextGenerator->processingContext();
845 tmpContext = qgis::make_unique< QgsProcessingContext >();
846 context = tmpContext.get();
868 mUnitsCombo->setCurrentIndex( mUnitsCombo->findData( units ) );
876 QVariant QgsProcessingDistanceWidgetWrapper::widgetValue()
const 878 const QVariant val = QgsProcessingNumericWidgetWrapper::widgetValue();
879 if ( val.type() == QVariant::Double && mUnitsCombo && mUnitsCombo->isVisible() )
901 QWidget *QgsProcessingRangeWidgetWrapper::createWidget()
910 QHBoxLayout *layout =
new QHBoxLayout();
915 mMinSpinBox->setExpressionsEnabled(
true );
916 mMinSpinBox->setShowClearButton(
false );
917 mMaxSpinBox->setExpressionsEnabled(
true );
918 mMaxSpinBox->setShowClearButton(
false );
920 QLabel *minLabel =
new QLabel( tr(
"Min" ) );
921 layout->addWidget( minLabel );
922 layout->addWidget( mMinSpinBox, 1 );
924 QLabel *maxLabel =
new QLabel( tr(
"Max" ) );
925 layout->addWidget( maxLabel );
926 layout->addWidget( mMaxSpinBox, 1 );
928 QWidget *w =
new QWidget();
929 layout->setMargin( 0 );
930 layout->setContentsMargins( 0, 0, 0, 0 );
931 w->setLayout( layout );
935 mMinSpinBox->setDecimals( 6 );
936 mMaxSpinBox->setDecimals( 6 );
940 mMinSpinBox->setDecimals( 0 );
941 mMaxSpinBox->setDecimals( 0 );
944 mMinSpinBox->setMinimum( -99999999.999999 );
945 mMaxSpinBox->setMinimum( -99999999.999999 );
946 mMinSpinBox->setMaximum( 99999999.999999 );
947 mMaxSpinBox->setMaximum( 99999999.999999 );
949 w->setToolTip( parameterDefinition()->toolTip() );
951 connect( mMinSpinBox, qgis::overload<double>::of( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
const double v )
953 mBlockChangedSignal++;
954 if ( v > mMaxSpinBox->value() )
955 mMaxSpinBox->setValue( v );
956 mBlockChangedSignal--;
958 if ( !mBlockChangedSignal )
959 emit widgetValueHasChanged(
this );
961 connect( mMaxSpinBox, qgis::overload<double>::of( &QgsDoubleSpinBox::valueChanged ),
this, [ = ](
const double v )
963 mBlockChangedSignal++;
964 if ( v < mMinSpinBox->value() )
965 mMinSpinBox->setValue( v );
966 mBlockChangedSignal--;
968 if ( !mBlockChangedSignal )
969 emit widgetValueHasChanged(
this );
978 void QgsProcessingRangeWidgetWrapper::setWidgetValue(
const QVariant &value,
QgsProcessingContext &context )
984 mBlockChangedSignal++;
985 mMinSpinBox->setValue( v.at( 0 ) );
986 if ( v.count() >= 2 )
987 mMaxSpinBox->setValue( v.at( 1 ) );
988 mBlockChangedSignal--;
990 if ( !mBlockChangedSignal )
991 emit widgetValueHasChanged(
this );
994 QVariant QgsProcessingRangeWidgetWrapper::widgetValue()
const 996 return QStringLiteral(
"%1,%2" ).arg( mMinSpinBox->value() ).arg( mMaxSpinBox->value() );
999 QStringList QgsProcessingRangeWidgetWrapper::compatibleParameterTypes()
const 1001 return QStringList()
1006 QStringList QgsProcessingRangeWidgetWrapper::compatibleOutputTypes()
const 1011 QList<int> QgsProcessingRangeWidgetWrapper::compatibleDataTypes()
const 1013 return QList< int >();
1016 QString QgsProcessingRangeWidgetWrapper::modelerExpressionFormatString()
const 1018 return tr(
"string as two comma delimited floats, e.g. '1,10'" );
1021 QString QgsProcessingRangeWidgetWrapper::parameterType()
const 1028 return new QgsProcessingRangeWidgetWrapper( parameter, type );
1043 QWidget *QgsProcessingMatrixWidgetWrapper::createWidget()
1045 mMatrixWidget =
new QgsProcessingMatrixParameterPanel(
nullptr, dynamic_cast< const QgsProcessingParameterMatrix *>( parameterDefinition() ) );
1046 mMatrixWidget->setToolTip( parameterDefinition()->toolTip() );
1048 connect( mMatrixWidget, &QgsProcessingMatrixParameterPanel::changed,
this, [ = ]
1050 emit widgetValueHasChanged(
this );
1059 return mMatrixWidget;
1065 void QgsProcessingMatrixWidgetWrapper::setWidgetValue(
const QVariant &value,
QgsProcessingContext &context )
1068 if ( mMatrixWidget )
1069 mMatrixWidget->setValue( v );
1072 QVariant QgsProcessingMatrixWidgetWrapper::widgetValue()
const 1074 if ( mMatrixWidget )
1075 return mMatrixWidget->value().isEmpty() ? QVariant() : mMatrixWidget->value();
1080 QStringList QgsProcessingMatrixWidgetWrapper::compatibleParameterTypes()
const 1082 return QStringList()
1086 QStringList QgsProcessingMatrixWidgetWrapper::compatibleOutputTypes()
const 1088 return QStringList();
1091 QList<int> QgsProcessingMatrixWidgetWrapper::compatibleDataTypes()
const 1093 return QList< int >();
1096 QString QgsProcessingMatrixWidgetWrapper::modelerExpressionFormatString()
const 1098 return tr(
"comma delimited string of values, or an array of values" );
1101 QString QgsProcessingMatrixWidgetWrapper::parameterType()
const 1108 return new QgsProcessingMatrixWidgetWrapper( parameter, type );
1124 QWidget *QgsProcessingFileWidgetWrapper::createWidget()
1134 mFileWidget->setToolTip( parameterDefinition()->toolTip() );
1135 mFileWidget->setDialogTitle( parameterDefinition()->description() );
1137 mFileWidget->setDefaultRoot(
QgsSettings().value( QStringLiteral(
"/Processing/LastInputPath" ), QDir::homePath() ).toString() );
1143 if ( !fileParam->
extension().isEmpty() )
1144 mFileWidget->setFilter( tr(
"%1 files" ).arg( fileParam->
extension().toUpper() ) + QStringLiteral(
" (*." ) + fileParam->
extension().toLower() +
')' );
1154 QgsSettings().
setValue( QStringLiteral(
"/Processing/LastInputPath" ), QFileInfo( path ).canonicalPath() );
1155 emit widgetValueHasChanged(
this );
1163 void QgsProcessingFileWidgetWrapper::setWidgetValue(
const QVariant &value,
QgsProcessingContext &context )
1167 mFileWidget->setFilePath( v );
1170 QVariant QgsProcessingFileWidgetWrapper::widgetValue()
const 1173 return mFileWidget->filePath();
1178 QStringList QgsProcessingFileWidgetWrapper::compatibleParameterTypes()
const 1180 return QStringList()
1185 QStringList QgsProcessingFileWidgetWrapper::compatibleOutputTypes()
const 1194 QList<int> QgsProcessingFileWidgetWrapper::compatibleDataTypes()
const 1196 return QList< int >();
1199 QString QgsProcessingFileWidgetWrapper::modelerExpressionFormatString()
const 1201 return tr(
"string representing a path to a file or folder" );
1204 QString QgsProcessingFileWidgetWrapper::parameterType()
const 1211 return new QgsProcessingFileWidgetWrapper( parameter, type );
1227 QWidget *QgsProcessingExpressionWidgetWrapper::createWidget()
1239 mExpLineEdit->setToolTip( parameterDefinition()->toolTip() );
1240 mExpLineEdit->setExpressionDialogTitle( parameterDefinition()->description() );
1241 mExpLineEdit->registerExpressionContextGenerator(
this );
1244 emit widgetValueHasChanged(
this );
1246 return mExpLineEdit;
1251 mFieldExpWidget->setToolTip( parameterDefinition()->toolTip() );
1252 mFieldExpWidget->setExpressionDialogTitle( parameterDefinition()->description() );
1253 mFieldExpWidget->registerExpressionContextGenerator(
this );
1256 emit widgetValueHasChanged(
this );
1258 return mFieldExpWidget;
1265 void QgsProcessingExpressionWidgetWrapper::postInitialize(
const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
1275 if ( wrapper->parameterDefinition()->name() ==
static_cast< const QgsProcessingParameterExpression *
>( parameterDefinition() )->parentLayerParameterName() )
1277 setParentLayerWrapperValue( wrapper );
1280 setParentLayerWrapperValue( wrapper );
1297 std::unique_ptr< QgsProcessingContext > tmpContext;
1298 if ( mProcessingContextGenerator )
1299 context = mProcessingContextGenerator->processingContext();
1303 tmpContext = qgis::make_unique< QgsProcessingContext >();
1304 context = tmpContext.get();
1310 if ( mFieldExpWidget )
1311 mFieldExpWidget->setLayer(
nullptr );
1312 else if ( mExpLineEdit )
1313 mExpLineEdit->setLayer(
nullptr );
1319 std::unique_ptr< QgsMapLayer > ownedLayer( context->takeResultLayer( layer->
id() ) );
1322 mParentLayer.reset( qobject_cast< QgsVectorLayer * >( ownedLayer.release() ) );
1323 layer = mParentLayer.get();
1330 if ( mFieldExpWidget )
1331 mFieldExpWidget->setLayer( layer );
1332 else if ( mExpLineEdit )
1333 mExpLineEdit->setLayer( layer );
1336 void QgsProcessingExpressionWidgetWrapper::setWidgetValue(
const QVariant &value,
QgsProcessingContext &context )
1339 if ( mFieldExpWidget )
1340 mFieldExpWidget->setExpression( v );
1341 else if ( mExpLineEdit )
1342 mExpLineEdit->setExpression( v );
1345 QVariant QgsProcessingExpressionWidgetWrapper::widgetValue()
const 1347 if ( mFieldExpWidget )
1348 return mFieldExpWidget->expression();
1349 else if ( mExpLineEdit )
1350 return mExpLineEdit->expression();
1355 QStringList QgsProcessingExpressionWidgetWrapper::compatibleParameterTypes()
const 1357 return QStringList()
1364 QStringList QgsProcessingExpressionWidgetWrapper::compatibleOutputTypes()
const 1366 return QStringList()
1371 QList<int> QgsProcessingExpressionWidgetWrapper::compatibleDataTypes()
const 1373 return QList< int >();
1376 QString QgsProcessingExpressionWidgetWrapper::modelerExpressionFormatString()
const 1378 return tr(
"string representation of an expression" );
1381 const QgsVectorLayer *QgsProcessingExpressionWidgetWrapper::linkedVectorLayer()
const 1383 if ( mFieldExpWidget && mFieldExpWidget->layer() )
1384 return mFieldExpWidget->layer();
1389 QString QgsProcessingExpressionWidgetWrapper::parameterType()
const 1396 return new QgsProcessingExpressionWidgetWrapper( parameter, type );
static QgsCoordinateReferenceSystem parameterAsCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a coordinate reference system.
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value...
static QString typeName()
Returns the type name for the parameter class.
An input file or folder parameter for processing algorithms.
static QString parameterAsString(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static string value.
static QString typeName()
Returns the type name for the parameter class.
static QVariantList parameterAsMatrix(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a matrix/table of values.
static Q_INVOKABLE QString toString(QgsUnitTypes::DistanceUnit unit)
Returns a translated string representing a distance unit.
static QString typeName()
Returns the type name for the output class.
This class is a composition of two QSettings instances:
static QString typeName()
Returns the type name for the parameter class.
QVariantMap metadata() const
Returns the parameter's freeform metadata.
static QString typeName()
Returns the type name for the parameter class.
WidgetType
Types of dialogs which Processing widgets can be created for.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
An expression parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value...
static QString typeName()
Returns the type name for the parameter class.
double minimum() const
Returns the minimum value acceptable by the parameter.
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
QgsUnitTypes::DistanceUnit mapUnits
QgsUnitTypes::DistanceUnit defaultUnit() const
Returns the default distance unit for the parameter.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
const QgsCoordinateReferenceSystem & crs
static QString typeName()
Returns the type name for the parameter class.
static QgsVectorLayer * parameterAsVectorLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a vector layer.
static QString typeName()
Returns the type name for the parameter class.
A numeric range parameter for processing algorithms.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set...
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
Flags flags() const
Returns any flags associated with the parameter.
static QString typeName()
Returns the type name for the parameter class.
QVariant defaultValue() const
Returns the default value for the parameter.
A double numeric parameter for distance values.
static QString typeName()
Returns the type name for the output class.
Parameter is a single file.
static QList< double > parameterAsRange(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a range of values.
Degrees, for planar geographic CRS distance measurements.
static QString typeName()
Returns the type name for the output class.
static QString typeName()
Returns the type name for the output class.
A numeric parameter for processing algorithms.
void expressionChanged(const QString &expression)
Emitted when the expression is changed.
Behavior behavior() const
Returns the parameter behavior (e.g.
DistanceUnit
Units of distance.
static Q_INVOKABLE DistanceUnitType unitType(QgsUnitTypes::DistanceUnit unit)
Returns the type for a distance unit.
QString extension() const
Returns any specified file extension for the parameter.
void selectedConfigIdChanged(const QString &authcfg)
Emitted when authentication config is changed or missing.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
The QgsExpressionLineEdit widget includes a line edit for entering expressions together with a button...
double qgsRound(double number, int places)
Returns a double number, rounded (as close as possible) to the specified number of places...
static QString typeName()
Returns the type name for the output class.
static QString typeName()
Returns the type name for the parameter class.
This class represents a coordinate reference system (CRS).
Base class for the definition of processing parameters.
static double parameterAsDouble(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static double value.
static int parameterAsInt(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static integer value.
static bool parameterAsBool(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static boolean value.
Type dataType() const
Returns the acceptable data type for the parameter.
static Q_INVOKABLE double fromUnitToUnitFactor(QgsUnitTypes::DistanceUnit fromUnit, QgsUnitTypes::DistanceUnit toUnit)
Returns the conversion factor between the specified distance units.
Represents a vector layer which manages a vector based data sets.
Contains information about the context in which a processing algorithm is executed.
static QString typeName()
Returns the type name for the output class.
QgsProcessingParameterNumber::Type dataType() const
Returns the acceptable data type for the range.
Unit is a standard measurement unit.
double maximum() const
Returns the maximum value acceptable by the parameter.
Selector widget for authentication configs.
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
Standard algorithm dialog.