19#include "moc_qgsprocessingwidgetwrapperimpl.cpp" 
   81#include <QPlainTextEdit> 
   82#include <QRadioButton> 
   83#include <QButtonGroup> 
   97  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
   98  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
  100  mDefaultCheckBox = 
new QCheckBox( tr( 
"Checked" ) );
 
  104    mDefaultCheckBox->setChecked( 
false );
 
  105  vlayout->addWidget( mDefaultCheckBox );
 
  106  setLayout( vlayout );
 
  111  auto param = std::make_unique<QgsProcessingParameterBoolean>( name, description, mDefaultCheckBox->isChecked() );
 
  112  param->setFlags( flags );
 
  113  return param.release();
 
  122QWidget *QgsProcessingBooleanWidgetWrapper::createWidget()
 
  128      QString description = parameterDefinition()->description();
 
  130        description = QObject::tr( 
"%1 [optional]" ).arg( description );
 
  132      mCheckBox = 
new QCheckBox( description );
 
  133      mCheckBox->setToolTip( parameterDefinition()->toolTip() );
 
  135      connect( mCheckBox, &QCheckBox::toggled, 
this, [
this] {
 
  136        emit widgetValueHasChanged( 
this );
 
  144      mComboBox = 
new QComboBox();
 
  145      mComboBox->addItem( tr( 
"Yes" ), 
true );
 
  146      mComboBox->addItem( tr( 
"No" ), 
false );
 
  147      mComboBox->setToolTip( parameterDefinition()->toolTip() );
 
  149      connect( mComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), 
this, [
this] {
 
  150        emit widgetValueHasChanged( 
this );
 
  159QLabel *QgsProcessingBooleanWidgetWrapper::createLabel()
 
  168void QgsProcessingBooleanWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
  175      mCheckBox->setChecked( v );
 
  183      mComboBox->setCurrentIndex( mComboBox->findData( v ) );
 
  189QVariant QgsProcessingBooleanWidgetWrapper::widgetValue()
 const 
  194      return mCheckBox->isChecked();
 
  198      return mComboBox->currentData();
 
  203QString QgsProcessingBooleanWidgetWrapper::parameterType()
 const 
  210  return new QgsProcessingBooleanWidgetWrapper( parameter, type );
 
  215  return new QgsProcessingBooleanParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
  226  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
  227  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
  229  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
  234  mCrsSelector->setShowAccuracyWarnings( 
true );
 
  241  vlayout->addWidget( mCrsSelector );
 
  242  setLayout( vlayout );
 
  247  auto param = std::make_unique<QgsProcessingParameterCrs>( name, description, mCrsSelector->crs().authid() );
 
  248  param->setFlags( flags );
 
  249  return param.release();
 
  257QWidget *QgsProcessingCrsWidgetWrapper::createWidget()
 
  259  Q_ASSERT( mProjectionSelectionWidget == 
nullptr );
 
  261  mProjectionSelectionWidget->setToolTip( parameterDefinition()->toolTip() );
 
  269    emit widgetValueHasChanged( 
this );
 
  277      return mProjectionSelectionWidget;
 
  282      QWidget *w = 
new QWidget();
 
  283      w->setToolTip( parameterDefinition()->toolTip() );
 
  285      QVBoxLayout *vl = 
new QVBoxLayout();
 
  286      vl->setContentsMargins( 0, 0, 0, 0 );
 
  289      mUseProjectCrsCheckBox = 
new QCheckBox( tr( 
"Use project CRS" ) );
 
  290      mUseProjectCrsCheckBox->setToolTip( tr( 
"Always use the current project CRS when running the model" ) );
 
  291      vl->addWidget( mUseProjectCrsCheckBox );
 
  292      connect( mUseProjectCrsCheckBox, &QCheckBox::toggled, mProjectionSelectionWidget, &QgsProjectionSelectionWidget::setDisabled );
 
  293      connect( mUseProjectCrsCheckBox, &QCheckBox::toggled, 
this, [
this] {
 
  294        emit widgetValueHasChanged( 
this );
 
  297      vl->addWidget( mProjectionSelectionWidget );
 
  305void QgsProcessingCrsWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
  307  if ( mUseProjectCrsCheckBox )
 
  309    if ( value.toString().compare( QLatin1String( 
"ProjectCrs" ), Qt::CaseInsensitive ) == 0 )
 
  311      mUseProjectCrsCheckBox->setChecked( 
true );
 
  316      mUseProjectCrsCheckBox->setChecked( 
false );
 
  321  if ( mProjectionSelectionWidget )
 
  322    mProjectionSelectionWidget->setCrs( v );
 
  325QVariant QgsProcessingCrsWidgetWrapper::widgetValue()
 const 
  327  if ( mUseProjectCrsCheckBox && mUseProjectCrsCheckBox->isChecked() )
 
  328    return QStringLiteral( 
"ProjectCrs" );
 
  329  else if ( mProjectionSelectionWidget )
 
  330    return mProjectionSelectionWidget->crs().isValid() ? mProjectionSelectionWidget->crs() : QVariant();
 
  335QString QgsProcessingCrsWidgetWrapper::modelerExpressionFormatString()
 const 
  337  return tr( 
"string as EPSG code, WKT or PROJ format, or a string identifying a map layer" );
 
  340QString QgsProcessingCrsWidgetWrapper::parameterType()
 const 
  347  return new QgsProcessingCrsWidgetWrapper( parameter, type );
 
  352  return new QgsProcessingCrsParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
  364  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
  365  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
  367  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
  369  mDefaultLineEdit = 
new QLineEdit();
 
  372  vlayout->addWidget( mDefaultLineEdit );
 
  374  mMultiLineCheckBox = 
new QCheckBox( tr( 
"Multiline input" ) );
 
  376    mMultiLineCheckBox->setChecked( stringParam->multiLine() );
 
  377  vlayout->addWidget( mMultiLineCheckBox );
 
  379  setLayout( vlayout );
 
  384  auto param = std::make_unique<QgsProcessingParameterString>( name, description, mDefaultLineEdit->text(), mMultiLineCheckBox->isChecked() );
 
  385  param->setFlags( flags );
 
  386  return param.release();
 
  395QWidget *QgsProcessingStringWidgetWrapper::createWidget()
 
  397  const QVariantMap metadata = parameterDefinition()->metadata();
 
  398  const QVariant valueHintsVariant = metadata.value( QStringLiteral( 
"widget_wrapper" ) ).toMap().value( QStringLiteral( 
"value_hints" ) );
 
  400  if ( valueHintsVariant.isValid() )
 
  402    const QVariantList valueList = valueHintsVariant.toList();
 
  403    mComboBox = 
new QComboBox();
 
  404    mComboBox->setToolTip( parameterDefinition()->toolTip() );
 
  408      mComboBox->addItem( QString() );
 
  410    for ( 
const QVariant &entry : valueList )
 
  412      mComboBox->addItem( entry.toString(), entry.toString() );
 
  414    mComboBox->setCurrentIndex( 0 );
 
  416    connect( mComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), 
this, [
this]( 
int ) {
 
  417      emit widgetValueHasChanged( 
this );
 
  430          mPlainTextEdit = 
new QPlainTextEdit();
 
  431          mPlainTextEdit->setToolTip( parameterDefinition()->toolTip() );
 
  433          connect( mPlainTextEdit, &QPlainTextEdit::textChanged, 
this, [
this] {
 
  434            emit widgetValueHasChanged( 
this );
 
  436          return mPlainTextEdit;
 
  440          mLineEdit = 
new QLineEdit();
 
  441          mLineEdit->setToolTip( parameterDefinition()->toolTip() );
 
  443          connect( mLineEdit, &QLineEdit::textChanged, 
this, [
this] {
 
  444            emit widgetValueHasChanged( 
this );
 
  452        mLineEdit = 
new QLineEdit();
 
  453        mLineEdit->setToolTip( parameterDefinition()->toolTip() );
 
  455        connect( mLineEdit, &QLineEdit::textChanged, 
this, [
this] {
 
  456          emit widgetValueHasChanged( 
this );
 
  466void QgsProcessingStringWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
  470    mLineEdit->setText( v );
 
  471  if ( mPlainTextEdit )
 
  472    mPlainTextEdit->setPlainText( v );
 
  476    if ( !value.isValid() )
 
  477      index = mComboBox->findData( QVariant() );
 
  479      index = mComboBox->findData( v );
 
  482      mComboBox->setCurrentIndex( index );
 
  484      mComboBox->setCurrentIndex( 0 );
 
  488QVariant QgsProcessingStringWidgetWrapper::widgetValue()
 const 
  491    return mLineEdit->text();
 
  492  else if ( mPlainTextEdit )
 
  493    return mPlainTextEdit->toPlainText();
 
  494  else if ( mComboBox )
 
  495    return mComboBox->currentData();
 
  500QString QgsProcessingStringWidgetWrapper::parameterType()
 const 
  507  return new QgsProcessingStringWidgetWrapper( parameter, type );
 
  512  return new QgsProcessingStringParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
  525QWidget *QgsProcessingAuthConfigWidgetWrapper::createWidget()
 
  534      mAuthConfigSelect->setToolTip( parameterDefinition()->toolTip() );
 
  537        emit widgetValueHasChanged( 
this );
 
  539      return mAuthConfigSelect;
 
  545void QgsProcessingAuthConfigWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
  548  if ( mAuthConfigSelect )
 
  549    mAuthConfigSelect->setConfigId( v );
 
  552QVariant QgsProcessingAuthConfigWidgetWrapper::widgetValue()
 const 
  554  if ( mAuthConfigSelect )
 
  555    return mAuthConfigSelect->configId();
 
  560QString QgsProcessingAuthConfigWidgetWrapper::parameterType()
 const 
  567  return new QgsProcessingAuthConfigWidgetWrapper( parameter, type );
 
  577  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
  578  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
  580  vlayout->addWidget( 
new QLabel( tr( 
"Number type" ) ) );
 
  582  mTypeComboBox = 
new QComboBox();
 
  585  vlayout->addWidget( mTypeComboBox );
 
  587  vlayout->addWidget( 
new QLabel( tr( 
"Minimum value" ) ) );
 
  588  mMinLineEdit = 
new QLineEdit();
 
  589  vlayout->addWidget( mMinLineEdit );
 
  591  vlayout->addWidget( 
new QLabel( tr( 
"Maximum value" ) ) );
 
  592  mMaxLineEdit = 
new QLineEdit();
 
  593  vlayout->addWidget( mMaxLineEdit );
 
  595  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
  596  mDefaultLineEdit = 
new QLineEdit();
 
  597  vlayout->addWidget( mDefaultLineEdit );
 
  601    mTypeComboBox->setCurrentIndex( mTypeComboBox->findData( 
static_cast<int>( numberParam->dataType() ) ) );
 
  603    if ( !
qgsDoubleNear( numberParam->maximum(), std::numeric_limits<double>::max() ) )
 
  605      mMaxLineEdit->setText( QLocale().toString( numberParam->maximum() ) );
 
  609      mMaxLineEdit->clear();
 
  612    if ( !
qgsDoubleNear( numberParam->minimum(), std::numeric_limits<double>::lowest() ) )
 
  614      mMinLineEdit->setText( QLocale().toString( numberParam->minimum() ) );
 
  618      mMinLineEdit->clear();
 
  621    mDefaultLineEdit->setText( numberParam->defaultValueForGui().toString() );
 
  624  setLayout( vlayout );
 
  633  auto param = std::make_unique<QgsProcessingParameterNumber>( name, description, dataType, ok ? val : QVariant() );
 
  635  if ( !mMinLineEdit->text().trimmed().isEmpty() )
 
  640      param->setMinimum( val );
 
  644  if ( !mMaxLineEdit->text().trimmed().isEmpty() )
 
  649      param->setMaximum( val );
 
  653  param->setFlags( flags );
 
  654  return param.release();
 
  662QWidget *QgsProcessingNumericWidgetWrapper::createWidget()
 
  665  const QVariantMap metadata = numberDef->
metadata();
 
  666  const int decimals = metadata.value( QStringLiteral( 
"widget_wrapper" ) ).toMap().value( QStringLiteral( 
"decimals" ), 6 ).toInt();
 
  674      QAbstractSpinBox *spinBox = 
nullptr;
 
  679          mDoubleSpinBox->setExpressionsEnabled( 
true );
 
  680          mDoubleSpinBox->setDecimals( decimals );
 
  685            double singleStep = calculateStep( numberDef->
minimum(), numberDef->
maximum() );
 
  686            singleStep = std::max( singleStep, std::pow( 10, -decimals ) );
 
  687            mDoubleSpinBox->setSingleStep( singleStep );
 
  690          spinBox = mDoubleSpinBox;
 
  695          mSpinBox->setExpressionsEnabled( 
true );
 
  699      spinBox->setToolTip( parameterDefinition()->toolTip() );
 
  701      double max = 999999999;
 
  706      double min = -999999999;
 
  711      if ( mDoubleSpinBox )
 
  713        mDoubleSpinBox->setMinimum( min );
 
  714        mDoubleSpinBox->setMaximum( max );
 
  718        mSpinBox->setMinimum( 
static_cast<int>( min ) );
 
  719        mSpinBox->setMaximum( 
static_cast<int>( max ) );
 
  724        mAllowingNull = 
true;
 
  725        if ( mDoubleSpinBox )
 
  727          mDoubleSpinBox->setShowClearButton( 
true );
 
  728          const double min = mDoubleSpinBox->minimum() - mDoubleSpinBox->singleStep();
 
  729          mDoubleSpinBox->setMinimum( min );
 
  730          mDoubleSpinBox->setValue( min );
 
  734          mSpinBox->setShowClearButton( 
true );
 
  735          const int min = mSpinBox->minimum() - 1;
 
  736          mSpinBox->setMinimum( min );
 
  737          mSpinBox->setValue( min );
 
  739        spinBox->setSpecialValueText( tr( 
"Not set" ) );
 
  747          if ( mDoubleSpinBox )
 
  751              mDoubleSpinBox->setClearValue( defaultVal );
 
  757              mSpinBox->setClearValue( intVal );
 
  763          if ( mDoubleSpinBox )
 
  764            mDoubleSpinBox->setClearValue( numberDef->
minimum() );
 
  766            mSpinBox->setClearValue( 
static_cast<int>( numberDef->
minimum() ) );
 
  771          if ( mDoubleSpinBox )
 
  773            mDoubleSpinBox->setValue( 0 );
 
  774            mDoubleSpinBox->setClearValue( 0 );
 
  778            mSpinBox->setValue( 0 );
 
  779            mSpinBox->setClearValue( 0 );
 
  784      if ( mDoubleSpinBox )
 
  785        connect( mDoubleSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ), 
this, [
this] { emit widgetValueHasChanged( 
this ); } );
 
  787        connect( mSpinBox, qOverload<int>( &QgsSpinBox::valueChanged ), 
this, [
this] { emit widgetValueHasChanged( 
this ); } );
 
  795void QgsProcessingNumericWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
  797  if ( mDoubleSpinBox )
 
  799    if ( mAllowingNull && !value.isValid() )
 
  800      mDoubleSpinBox->clear();
 
  804      mDoubleSpinBox->setValue( v );
 
  809    if ( mAllowingNull && !value.isValid() )
 
  814      mSpinBox->setValue( v );
 
  819QVariant QgsProcessingNumericWidgetWrapper::widgetValue()
 const 
  821  if ( mDoubleSpinBox )
 
  823    if ( mAllowingNull && 
qgsDoubleNear( mDoubleSpinBox->value(), mDoubleSpinBox->minimum() ) )
 
  826      return mDoubleSpinBox->value();
 
  830    if ( mAllowingNull && mSpinBox->value() == mSpinBox->minimum() )
 
  833      return mSpinBox->value();
 
  839double QgsProcessingNumericWidgetWrapper::calculateStep( 
const double minimum, 
const double maximum )
 
  841  const double valueRange = maximum - minimum;
 
  842  if ( valueRange <= 1.0 )
 
  844    const double step = valueRange / 10.0;
 
  846    return qgsRound( step, -std::floor( std::log( step ) ) );
 
  854QString QgsProcessingNumericWidgetWrapper::parameterType()
 const 
  861  return new QgsProcessingNumericWidgetWrapper( parameter, type );
 
  866  return new QgsProcessingNumberParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
  876  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
  877  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
  879  vlayout->addWidget( 
new QLabel( tr( 
"Linked input" ) ) );
 
  881  mParentLayerComboBox = 
new QComboBox();
 
  883  QString initialParent;
 
  885    initialParent = distParam->parentParameterName();
 
  887  if ( 
auto *lModel = widgetContext.
model() )
 
  890    const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
 
  891    for ( 
auto it = components.constBegin(); it != components.constEnd(); ++it )
 
  895        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
  896        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
  898          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
  903        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
  904        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
  906          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
  911        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
  912        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
  914          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
  919        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
  920        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
  922          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
  928  if ( mParentLayerComboBox->count() == 0 && !initialParent.isEmpty() )
 
  931    mParentLayerComboBox->addItem( initialParent, initialParent );
 
  932    mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
  935  vlayout->addWidget( mParentLayerComboBox );
 
  937  vlayout->addWidget( 
new QLabel( tr( 
"Minimum value" ) ) );
 
  938  mMinLineEdit = 
new QLineEdit();
 
  939  vlayout->addWidget( mMinLineEdit );
 
  941  vlayout->addWidget( 
new QLabel( tr( 
"Maximum value" ) ) );
 
  942  mMaxLineEdit = 
new QLineEdit();
 
  943  vlayout->addWidget( mMaxLineEdit );
 
  945  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
  946  mDefaultLineEdit = 
new QLineEdit();
 
  947  vlayout->addWidget( mDefaultLineEdit );
 
  951    mMinLineEdit->setText( QLocale().toString( distParam->minimum() ) );
 
  952    mMaxLineEdit->setText( QLocale().toString( distParam->maximum() ) );
 
  953    mDefaultLineEdit->setText( distParam->defaultValueForGui().toString() );
 
  956  setLayout( vlayout );
 
  964  auto param = std::make_unique<QgsProcessingParameterDistance>( name, description, ok ? val : QVariant(), mParentLayerComboBox->currentData().toString() );
 
  969    param->setMinimum( val );
 
  975    param->setMaximum( val );
 
  978  param->setFlags( flags );
 
  979  return param.release();
 
  983  : QgsProcessingNumericWidgetWrapper( parameter, type, parent )
 
  987QString QgsProcessingDistanceWidgetWrapper::parameterType()
 const 
  994  return new QgsProcessingDistanceWidgetWrapper( parameter, type );
 
  997QWidget *QgsProcessingDistanceWidgetWrapper::createWidget()
 
 1001  QWidget *spin = QgsProcessingNumericWidgetWrapper::createWidget();
 
 1006      mLabel = 
new QLabel();
 
 1007      mUnitsCombo = 
new QComboBox();
 
 1019      const int labelMargin = 
static_cast<int>( std::round( mUnitsCombo->fontMetrics().horizontalAdvance( 
'X' ) ) );
 
 1020      QHBoxLayout *layout = 
new QHBoxLayout();
 
 1021      layout->addWidget( spin, 1 );
 
 1022      layout->insertSpacing( 1, labelMargin / 2 );
 
 1023      layout->insertWidget( 2, mLabel );
 
 1024      layout->insertWidget( 3, mUnitsCombo );
 
 1029      mWarningLabel = 
new QWidget();
 
 1030      QHBoxLayout *warningLayout = 
new QHBoxLayout();
 
 1031      warningLayout->setContentsMargins( 0, 0, 0, 0 );
 
 1032      QLabel *warning = 
new QLabel();
 
 1034      const int size = 
static_cast<int>( std::max( 24.0, spin->minimumSize().height() * 0.5 ) );
 
 1035      warning->setPixmap( icon.pixmap( icon.actualSize( QSize( size, size ) ) ) );
 
 1036      warning->setToolTip( tr( 
"Distance is in geographic degrees. Consider reprojecting to a projected local coordinate system for accurate results." ) );
 
 1037      warningLayout->insertSpacing( 0, labelMargin / 2 );
 
 1038      warningLayout->insertWidget( 1, warning );
 
 1039      mWarningLabel->setLayout( warningLayout );
 
 1040      layout->insertWidget( 4, mWarningLabel );
 
 1042      QWidget *w = 
new QWidget();
 
 1043      layout->setContentsMargins( 0, 0, 0, 0 );
 
 1044      w->setLayout( layout );
 
 1058void QgsProcessingDistanceWidgetWrapper::postInitialize( 
const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
 
 1060  QgsProcessingNumericWidgetWrapper::postInitialize( wrappers );
 
 1067        if ( wrapper->parameterDefinition()->name() == 
static_cast<const QgsProcessingParameterDistance *
>( parameterDefinition() )->parentParameterName() )
 
 1069          setUnitParameterValue( wrapper->parameterValue(), wrapper );
 
 1071            setUnitParameterValue( wrapper->parameterValue(), wrapper );
 
 1091  std::unique_ptr<QgsProcessingContext> tmpContext;
 
 1092  if ( mProcessingContextGenerator )
 
 1093    context = mProcessingContextGenerator->processingContext();
 
 1097    tmpContext = std::make_unique<QgsProcessingContext>();
 
 1098    context = tmpContext.get();
 
 1117    mUnitsCombo->hide();
 
 1125    if ( mBaseUnit != units )
 
 1127      mUnitsCombo->setCurrentIndex( mUnitsCombo->findData( 
static_cast<int>( units ) ) );
 
 1130    mUnitsCombo->show();
 
 1137QVariant QgsProcessingDistanceWidgetWrapper::widgetValue()
 const 
 1139  const QVariant val = QgsProcessingNumericWidgetWrapper::widgetValue();
 
 1140  if ( val.userType() == QMetaType::Type::Double && mUnitsCombo && mUnitsCombo->isVisible() )
 
 1153  return new QgsProcessingDistanceParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 1164  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 1165  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 1167  vlayout->addWidget( 
new QLabel( tr( 
"Linked input" ) ) );
 
 1169  mParentLayerComboBox = 
new QComboBox();
 
 1171  QString initialParent;
 
 1173    initialParent = areaParam->parentParameterName();
 
 1175  if ( 
auto *lModel = widgetContext.
model() )
 
 1178    const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
 
 1179    for ( 
auto it = components.constBegin(); it != components.constEnd(); ++it )
 
 1183        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 1184        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 1186          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 1191        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 1192        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 1194          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 1199        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 1200        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 1202          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 1207        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 1208        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 1210          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 1216  if ( mParentLayerComboBox->count() == 0 && !initialParent.isEmpty() )
 
 1219    mParentLayerComboBox->addItem( initialParent, initialParent );
 
 1220    mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 1223  vlayout->addWidget( mParentLayerComboBox );
 
 1225  vlayout->addWidget( 
new QLabel( tr( 
"Minimum value" ) ) );
 
 1226  mMinLineEdit = 
new QLineEdit();
 
 1227  vlayout->addWidget( mMinLineEdit );
 
 1229  vlayout->addWidget( 
new QLabel( tr( 
"Maximum value" ) ) );
 
 1230  mMaxLineEdit = 
new QLineEdit();
 
 1231  vlayout->addWidget( mMaxLineEdit );
 
 1233  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 1234  mDefaultLineEdit = 
new QLineEdit();
 
 1235  vlayout->addWidget( mDefaultLineEdit );
 
 1239    mMinLineEdit->setText( QLocale().toString( areaParam->minimum() ) );
 
 1240    mMaxLineEdit->setText( QLocale().toString( areaParam->maximum() ) );
 
 1241    mDefaultLineEdit->setText( areaParam->defaultValueForGui().toString() );
 
 1244  setLayout( vlayout );
 
 1252  auto param = std::make_unique<QgsProcessingParameterArea>( name, description, ok ? val : QVariant(), mParentLayerComboBox->currentData().toString() );
 
 1257    param->setMinimum( val );
 
 1263    param->setMaximum( val );
 
 1266  param->setFlags( flags );
 
 1267  return param.release();
 
 1276  : QgsProcessingNumericWidgetWrapper( parameter, type, parent )
 
 1280QString QgsProcessingAreaWidgetWrapper::parameterType()
 const 
 1287  return new QgsProcessingAreaWidgetWrapper( parameter, type );
 
 1290QWidget *QgsProcessingAreaWidgetWrapper::createWidget()
 
 1294  QWidget *spin = QgsProcessingNumericWidgetWrapper::createWidget();
 
 1299      mLabel = 
new QLabel();
 
 1300      mUnitsCombo = 
new QComboBox();
 
 1315      const int labelMargin = 
static_cast<int>( std::round( mUnitsCombo->fontMetrics().horizontalAdvance( 
'X' ) ) );
 
 1316      QHBoxLayout *layout = 
new QHBoxLayout();
 
 1317      layout->addWidget( spin, 1 );
 
 1318      layout->insertSpacing( 1, labelMargin / 2 );
 
 1319      layout->insertWidget( 2, mLabel );
 
 1320      layout->insertWidget( 3, mUnitsCombo );
 
 1325      mWarningLabel = 
new QWidget();
 
 1326      QHBoxLayout *warningLayout = 
new QHBoxLayout();
 
 1327      warningLayout->setContentsMargins( 0, 0, 0, 0 );
 
 1328      QLabel *warning = 
new QLabel();
 
 1330      const int size = 
static_cast<int>( std::max( 24.0, spin->minimumSize().height() * 0.5 ) );
 
 1331      warning->setPixmap( icon.pixmap( icon.actualSize( QSize( size, size ) ) ) );
 
 1332      warning->setToolTip( tr( 
"Area is in geographic degrees. Consider reprojecting to a projected local coordinate system for accurate results." ) );
 
 1333      warningLayout->insertSpacing( 0, labelMargin / 2 );
 
 1334      warningLayout->insertWidget( 1, warning );
 
 1335      mWarningLabel->setLayout( warningLayout );
 
 1336      layout->insertWidget( 4, mWarningLabel );
 
 1338      QWidget *w = 
new QWidget();
 
 1339      layout->setContentsMargins( 0, 0, 0, 0 );
 
 1340      w->setLayout( layout );
 
 1354void QgsProcessingAreaWidgetWrapper::postInitialize( 
const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
 
 1356  QgsProcessingNumericWidgetWrapper::postInitialize( wrappers );
 
 1387  std::unique_ptr<QgsProcessingContext> tmpContext;
 
 1388  if ( mProcessingContextGenerator )
 
 1389    context = mProcessingContextGenerator->processingContext();
 
 1393    tmpContext = std::make_unique<QgsProcessingContext>();
 
 1394    context = tmpContext.get();
 
 1408void QgsProcessingAreaWidgetWrapper::setUnits( 
Qgis::AreaUnit units )
 
 1413    mUnitsCombo->hide();
 
 1418    mUnitsCombo->setCurrentIndex( mUnitsCombo->findData( QVariant::fromValue( units ) ) );
 
 1419    mUnitsCombo->show();
 
 1426QVariant QgsProcessingAreaWidgetWrapper::widgetValue()
 const 
 1428  const QVariant val = QgsProcessingNumericWidgetWrapper::widgetValue();
 
 1429  if ( val.userType() == QMetaType::Type::Double && mUnitsCombo && mUnitsCombo->isVisible() )
 
 1442  return new QgsProcessingAreaParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 1453  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 1454  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 1456  vlayout->addWidget( 
new QLabel( tr( 
"Linked input" ) ) );
 
 1458  mParentLayerComboBox = 
new QComboBox();
 
 1460  QString initialParent;
 
 1462    initialParent = volumeParam->parentParameterName();
 
 1464  if ( 
auto *lModel = widgetContext.
model() )
 
 1467    const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
 
 1468    for ( 
auto it = components.constBegin(); it != components.constEnd(); ++it )
 
 1472        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 1473        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 1475          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 1480        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 1481        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 1483          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 1488        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 1489        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 1491          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 1496        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 1497        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 1499          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 1505  if ( mParentLayerComboBox->count() == 0 && !initialParent.isEmpty() )
 
 1508    mParentLayerComboBox->addItem( initialParent, initialParent );
 
 1509    mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 1512  vlayout->addWidget( mParentLayerComboBox );
 
 1514  vlayout->addWidget( 
new QLabel( tr( 
"Minimum value" ) ) );
 
 1515  mMinLineEdit = 
new QLineEdit();
 
 1516  vlayout->addWidget( mMinLineEdit );
 
 1518  vlayout->addWidget( 
new QLabel( tr( 
"Maximum value" ) ) );
 
 1519  mMaxLineEdit = 
new QLineEdit();
 
 1520  vlayout->addWidget( mMaxLineEdit );
 
 1522  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 1523  mDefaultLineEdit = 
new QLineEdit();
 
 1524  vlayout->addWidget( mDefaultLineEdit );
 
 1528    mMinLineEdit->setText( QLocale().toString( volumeParam->minimum() ) );
 
 1529    mMaxLineEdit->setText( QLocale().toString( volumeParam->maximum() ) );
 
 1530    mDefaultLineEdit->setText( volumeParam->defaultValueForGui().toString() );
 
 1533  setLayout( vlayout );
 
 1541  auto param = std::make_unique<QgsProcessingParameterVolume>( name, description, ok ? val : QVariant(), mParentLayerComboBox->currentData().toString() );
 
 1546    param->setMinimum( val );
 
 1552    param->setMaximum( val );
 
 1555  param->setFlags( flags );
 
 1556  return param.release();
 
 1565  : QgsProcessingNumericWidgetWrapper( parameter, type, parent )
 
 1569QString QgsProcessingVolumeWidgetWrapper::parameterType()
 const 
 1576  return new QgsProcessingVolumeWidgetWrapper( parameter, type );
 
 1579QWidget *QgsProcessingVolumeWidgetWrapper::createWidget()
 
 1583  QWidget *spin = QgsProcessingNumericWidgetWrapper::createWidget();
 
 1588      mLabel = 
new QLabel();
 
 1589      mUnitsCombo = 
new QComboBox();
 
 1602      const int labelMargin = 
static_cast<int>( std::round( mUnitsCombo->fontMetrics().horizontalAdvance( 
'X' ) ) );
 
 1603      QHBoxLayout *layout = 
new QHBoxLayout();
 
 1604      layout->addWidget( spin, 1 );
 
 1605      layout->insertSpacing( 1, labelMargin / 2 );
 
 1606      layout->insertWidget( 2, mLabel );
 
 1607      layout->insertWidget( 3, mUnitsCombo );
 
 1612      mWarningLabel = 
new QWidget();
 
 1613      QHBoxLayout *warningLayout = 
new QHBoxLayout();
 
 1614      warningLayout->setContentsMargins( 0, 0, 0, 0 );
 
 1615      QLabel *warning = 
new QLabel();
 
 1617      const int size = 
static_cast<int>( std::max( 24.0, spin->minimumSize().height() * 0.5 ) );
 
 1618      warning->setPixmap( icon.pixmap( icon.actualSize( QSize( size, size ) ) ) );
 
 1619      warning->setToolTip( tr( 
"Volume is in geographic degrees. Consider reprojecting to a projected local coordinate system for accurate results." ) );
 
 1620      warningLayout->insertSpacing( 0, labelMargin / 2 );
 
 1621      warningLayout->insertWidget( 1, warning );
 
 1622      mWarningLabel->setLayout( warningLayout );
 
 1623      layout->insertWidget( 4, mWarningLabel );
 
 1625      QWidget *w = 
new QWidget();
 
 1626      layout->setContentsMargins( 0, 0, 0, 0 );
 
 1627      w->setLayout( layout );
 
 1641void QgsProcessingVolumeWidgetWrapper::postInitialize( 
const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
 
 1643  QgsProcessingNumericWidgetWrapper::postInitialize( wrappers );
 
 1674  std::unique_ptr<QgsProcessingContext> tmpContext;
 
 1675  if ( mProcessingContextGenerator )
 
 1676    context = mProcessingContextGenerator->processingContext();
 
 1680    tmpContext = std::make_unique<QgsProcessingContext>();
 
 1681    context = tmpContext.get();
 
 1700    mUnitsCombo->hide();
 
 1705    mUnitsCombo->setCurrentIndex( mUnitsCombo->findData( QVariant::fromValue( units ) ) );
 
 1706    mUnitsCombo->show();
 
 1713QVariant QgsProcessingVolumeWidgetWrapper::widgetValue()
 const 
 1715  const QVariant val = QgsProcessingNumericWidgetWrapper::widgetValue();
 
 1716  if ( val.userType() == QMetaType::Type::Double && mUnitsCombo && mUnitsCombo->isVisible() )
 
 1729  return new QgsProcessingVolumeParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 1740  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 1741  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 1743  vlayout->addWidget( 
new QLabel( tr( 
"Minimum value" ) ) );
 
 1744  mMinLineEdit = 
new QLineEdit();
 
 1745  vlayout->addWidget( mMinLineEdit );
 
 1747  vlayout->addWidget( 
new QLabel( tr( 
"Maximum value" ) ) );
 
 1748  mMaxLineEdit = 
new QLineEdit();
 
 1749  vlayout->addWidget( mMaxLineEdit );
 
 1751  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 1752  mDefaultLineEdit = 
new QLineEdit();
 
 1753  vlayout->addWidget( mDefaultLineEdit );
 
 1755  vlayout->addWidget( 
new QLabel( tr( 
"Default unit type" ) ) );
 
 1757  mUnitsCombo = 
new QComboBox();
 
 1767  vlayout->addWidget( mUnitsCombo );
 
 1771    mMinLineEdit->setText( QLocale().toString( durationParam->minimum() ) );
 
 1772    mMaxLineEdit->setText( QLocale().toString( durationParam->maximum() ) );
 
 1773    mDefaultLineEdit->setText( durationParam->defaultValueForGui().toString() );
 
 1774    mUnitsCombo->setCurrentIndex( mUnitsCombo->findData( 
static_cast<int>( durationParam->defaultUnit() ) ) );
 
 1777  setLayout( vlayout );
 
 1785  auto param = std::make_unique<QgsProcessingParameterDuration>( name, description, ok ? val : QVariant() );
 
 1790    param->setMinimum( val );
 
 1796    param->setMaximum( val );
 
 1799  param->setDefaultUnit( 
static_cast<Qgis::TemporalUnit>( mUnitsCombo->currentData().toInt() ) );
 
 1801  param->setFlags( flags );
 
 1802  return param.release();
 
 1806  : QgsProcessingNumericWidgetWrapper( parameter, type, parent )
 
 1810QString QgsProcessingDurationWidgetWrapper::parameterType()
 const 
 1817  return new QgsProcessingDurationWidgetWrapper( parameter, type );
 
 1820QWidget *QgsProcessingDurationWidgetWrapper::createWidget()
 
 1824  QWidget *spin = QgsProcessingNumericWidgetWrapper::createWidget();
 
 1829      mUnitsCombo = 
new QComboBox();
 
 1841      QHBoxLayout *layout = 
new QHBoxLayout();
 
 1842      layout->addWidget( spin, 1 );
 
 1843      layout->insertWidget( 1, mUnitsCombo );
 
 1845      QWidget *w = 
new QWidget();
 
 1846      layout->setContentsMargins( 0, 0, 0, 0 );
 
 1847      w->setLayout( layout );
 
 1849      mUnitsCombo->setCurrentIndex( mUnitsCombo->findData( 
static_cast<int>( durationDef->
defaultUnit() ) ) );
 
 1850      mUnitsCombo->show();
 
 1862QLabel *QgsProcessingDurationWidgetWrapper::createLabel()
 
 1874QVariant QgsProcessingDurationWidgetWrapper::widgetValue()
 const 
 1876  const QVariant val = QgsProcessingNumericWidgetWrapper::widgetValue();
 
 1877  if ( val.userType() == QMetaType::Type::Double && mUnitsCombo )
 
 1888void QgsProcessingDurationWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 1894    QgsProcessingNumericWidgetWrapper::setWidgetValue( val, context );
 
 1898    QgsProcessingNumericWidgetWrapper::setWidgetValue( value, context );
 
 1904  return new QgsProcessingDurationParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 1914  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 1915  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 1917  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 1919  mDefaultLineEdit = 
new QLineEdit();
 
 1923    mDefaultLineEdit->setText( scaleParam->defaultValueForGui().toString() );
 
 1926  vlayout->addWidget( mDefaultLineEdit );
 
 1928  setLayout( vlayout );
 
 1934  double val = mDefaultLineEdit->text().toDouble( &ok );
 
 1935  auto param = std::make_unique<QgsProcessingParameterScale>( name, description, ok ? val : QVariant() );
 
 1937  return param.release();
 
 1941  : QgsProcessingNumericWidgetWrapper( parameter, type, parent )
 
 1945QString QgsProcessingScaleWidgetWrapper::parameterType()
 const 
 1952  return new QgsProcessingScaleWidgetWrapper( parameter, type );
 
 1955QWidget *QgsProcessingScaleWidgetWrapper::createWidget()
 
 1967        mScaleWidget->setAllowNull( 
true );
 
 1969      mScaleWidget->setMapCanvas( widgetContext().mapCanvas() );
 
 1970      mScaleWidget->setShowCurrentScaleButton( 
true );
 
 1972      mScaleWidget->setToolTip( parameterDefinition()->toolTip() );
 
 1974        emit widgetValueHasChanged( 
this );
 
 1976      return mScaleWidget;
 
 1985    mScaleWidget->setMapCanvas( context.
mapCanvas() );
 
 1990QVariant QgsProcessingScaleWidgetWrapper::widgetValue()
 const 
 1992  return mScaleWidget && !mScaleWidget->isNull() ? QVariant( mScaleWidget->scale() ) : QVariant();
 
 1995void QgsProcessingScaleWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 1999    if ( mScaleWidget->allowNull() && !value.isValid() )
 
 2000      mScaleWidget->setNull();
 
 2004      mScaleWidget->setScale( v );
 
 2011  return new QgsProcessingScaleParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 2022  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 2023  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 2025  vlayout->addWidget( 
new QLabel( tr( 
"Number type" ) ) );
 
 2027  mTypeComboBox = 
new QComboBox();
 
 2030  vlayout->addWidget( mTypeComboBox );
 
 2032  vlayout->addWidget( 
new QLabel( tr( 
"Minimum value" ) ) );
 
 2033  mMinLineEdit = 
new QLineEdit();
 
 2034  vlayout->addWidget( mMinLineEdit );
 
 2036  vlayout->addWidget( 
new QLabel( tr( 
"Maximum value" ) ) );
 
 2037  mMaxLineEdit = 
new QLineEdit();
 
 2038  vlayout->addWidget( mMaxLineEdit );
 
 2042    mTypeComboBox->setCurrentIndex( mTypeComboBox->findData( 
static_cast<int>( rangeParam->dataType() ) ) );
 
 2044    mMinLineEdit->setText( QLocale().toString( range.at( 0 ) ) );
 
 2045    mMaxLineEdit->setText( QLocale().toString( range.at( 1 ) ) );
 
 2048  setLayout( vlayout );
 
 2053  QString defaultValue;
 
 2054  if ( mMinLineEdit->text().isEmpty() )
 
 2056    defaultValue = QStringLiteral( 
"None" );
 
 2064      defaultValue = QStringLiteral( 
"None" );
 
 2068  if ( mMaxLineEdit->text().isEmpty() )
 
 2070    defaultValue += QLatin1String( 
",None" );
 
 2076    defaultValue += QStringLiteral( 
",%1" ).arg( ok ? QString::number( val ) : QLatin1String( 
"None" ) );
 
 2080  auto param = std::make_unique<QgsProcessingParameterRange>( name, description, dataType, defaultValue );
 
 2081  param->setFlags( flags );
 
 2082  return param.release();
 
 2091QWidget *QgsProcessingRangeWidgetWrapper::createWidget()
 
 2100      QHBoxLayout *layout = 
new QHBoxLayout();
 
 2105      mMinSpinBox->setExpressionsEnabled( 
true );
 
 2106      mMinSpinBox->setShowClearButton( 
false );
 
 2107      mMaxSpinBox->setExpressionsEnabled( 
true );
 
 2108      mMaxSpinBox->setShowClearButton( 
false );
 
 2110      QLabel *minLabel = 
new QLabel( tr( 
"Min" ) );
 
 2111      layout->addWidget( minLabel );
 
 2112      layout->addWidget( mMinSpinBox, 1 );
 
 2114      QLabel *maxLabel = 
new QLabel( tr( 
"Max" ) );
 
 2115      layout->addWidget( maxLabel );
 
 2116      layout->addWidget( mMaxSpinBox, 1 );
 
 2118      QWidget *w = 
new QWidget();
 
 2119      layout->setContentsMargins( 0, 0, 0, 0 );
 
 2120      w->setLayout( layout );
 
 2124        mMinSpinBox->setDecimals( 6 );
 
 2125        mMaxSpinBox->setDecimals( 6 );
 
 2129        mMinSpinBox->setDecimals( 0 );
 
 2130        mMaxSpinBox->setDecimals( 0 );
 
 2133      mMinSpinBox->setMinimum( -99999999.999999 );
 
 2134      mMaxSpinBox->setMinimum( -99999999.999999 );
 
 2135      mMinSpinBox->setMaximum( 99999999.999999 );
 
 2136      mMaxSpinBox->setMaximum( 99999999.999999 );
 
 2140        mAllowingNull = 
true;
 
 2142        const double min = mMinSpinBox->minimum() - 1;
 
 2143        mMinSpinBox->setMinimum( min );
 
 2144        mMaxSpinBox->setMinimum( min );
 
 2145        mMinSpinBox->setValue( min );
 
 2146        mMaxSpinBox->setValue( min );
 
 2148        mMinSpinBox->setShowClearButton( 
true );
 
 2149        mMaxSpinBox->setShowClearButton( 
true );
 
 2150        mMinSpinBox->setSpecialValueText( tr( 
"Not set" ) );
 
 2151        mMaxSpinBox->setSpecialValueText( tr( 
"Not set" ) );
 
 2154      w->setToolTip( parameterDefinition()->toolTip() );
 
 2156      connect( mMinSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ), 
this, [
this]( 
const double v ) {
 
 2157        mBlockChangedSignal++;
 
 2158        if ( !mAllowingNull && v > mMaxSpinBox->value() )
 
 2159          mMaxSpinBox->setValue( v );
 
 2160        mBlockChangedSignal--;
 
 2162        if ( !mBlockChangedSignal )
 
 2163          emit widgetValueHasChanged( 
this );
 
 2165      connect( mMaxSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ), 
this, [
this]( 
const double v ) {
 
 2166        mBlockChangedSignal++;
 
 2167        if ( !mAllowingNull && v < mMinSpinBox->value() )
 
 2168          mMinSpinBox->setValue( v );
 
 2169        mBlockChangedSignal--;
 
 2171        if ( !mBlockChangedSignal )
 
 2172          emit widgetValueHasChanged( 
this );
 
 2181void QgsProcessingRangeWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 2184  if ( mAllowingNull && v.empty() )
 
 2186    mMinSpinBox->clear();
 
 2187    mMaxSpinBox->clear();
 
 2194    if ( mAllowingNull )
 
 2196      mBlockChangedSignal++;
 
 2197      if ( std::isnan( v.at( 0 ) ) )
 
 2198        mMinSpinBox->clear();
 
 2200        mMinSpinBox->setValue( v.at( 0 ) );
 
 2202      if ( v.count() >= 2 )
 
 2204        if ( std::isnan( v.at( 1 ) ) )
 
 2205          mMaxSpinBox->clear();
 
 2207          mMaxSpinBox->setValue( v.at( 1 ) );
 
 2209      mBlockChangedSignal--;
 
 2213      mBlockChangedSignal++;
 
 2214      mMinSpinBox->setValue( v.at( 0 ) );
 
 2215      if ( v.count() >= 2 )
 
 2216        mMaxSpinBox->setValue( v.at( 1 ) );
 
 2217      mBlockChangedSignal--;
 
 2221  if ( !mBlockChangedSignal )
 
 2222    emit widgetValueHasChanged( 
this );
 
 2225QVariant QgsProcessingRangeWidgetWrapper::widgetValue()
 const 
 2227  if ( mAllowingNull )
 
 2230    if ( 
qgsDoubleNear( mMinSpinBox->value(), mMinSpinBox->minimum() ) )
 
 2231      value = QStringLiteral( 
"None" );
 
 2233      value = QString::number( mMinSpinBox->value() );
 
 2235    if ( 
qgsDoubleNear( mMaxSpinBox->value(), mMaxSpinBox->minimum() ) )
 
 2236      value += QLatin1String( 
",None" );
 
 2238      value += QStringLiteral( 
",%1" ).arg( mMaxSpinBox->value() );
 
 2243    return QStringLiteral( 
"%1,%2" ).arg( mMinSpinBox->value() ).arg( mMaxSpinBox->value() );
 
 2246QString QgsProcessingRangeWidgetWrapper::modelerExpressionFormatString()
 const 
 2248  return tr( 
"string as two comma delimited floats, e.g. '1,10'" );
 
 2251QString QgsProcessingRangeWidgetWrapper::parameterType()
 const 
 2258  return new QgsProcessingRangeWidgetWrapper( parameter, type );
 
 2263  return new QgsProcessingRangeParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 2274  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 2275  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 2277  mMatrixWidget = 
new QgsProcessingMatrixModelerWidget();
 
 2280    mMatrixWidget->setValue( matrixParam->headers(), matrixParam->defaultValueForGui() );
 
 2281    mMatrixWidget->setFixedRows( matrixParam->hasFixedNumberRows() );
 
 2283  vlayout->addWidget( mMatrixWidget );
 
 2284  setLayout( vlayout );
 
 2289  auto param = std::make_unique<QgsProcessingParameterMatrix>( name, description, 1, mMatrixWidget->fixedRows(), mMatrixWidget->headers(), mMatrixWidget->value() );
 
 2290  param->setFlags( flags );
 
 2291  return param.release();
 
 2300QWidget *QgsProcessingMatrixWidgetWrapper::createWidget()
 
 2302  mMatrixWidget = 
new QgsProcessingMatrixParameterPanel( 
nullptr, 
dynamic_cast<const QgsProcessingParameterMatrix *
>( parameterDefinition() ) );
 
 2303  mMatrixWidget->setToolTip( parameterDefinition()->toolTip() );
 
 2305  connect( mMatrixWidget, &QgsProcessingMatrixParameterPanel::changed, 
this, [
this] {
 
 2306    emit widgetValueHasChanged( 
this );
 
 2315      return mMatrixWidget;
 
 2321void QgsProcessingMatrixWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 2324  if ( mMatrixWidget )
 
 2325    mMatrixWidget->setValue( v );
 
 2328QVariant QgsProcessingMatrixWidgetWrapper::widgetValue()
 const 
 2330  if ( mMatrixWidget )
 
 2331    return mMatrixWidget->value().isEmpty() ? QVariant() : mMatrixWidget->value();
 
 2336QString QgsProcessingMatrixWidgetWrapper::modelerExpressionFormatString()
 const 
 2338  return tr( 
"comma delimited string of values, or an array of values" );
 
 2341QString QgsProcessingMatrixWidgetWrapper::parameterType()
 const 
 2348  return new QgsProcessingMatrixWidgetWrapper( parameter, type );
 
 2353  return new QgsProcessingMatrixParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 2365  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 2366  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 2368  vlayout->addWidget( 
new QLabel( tr( 
"Type" ) ) );
 
 2370  mTypeComboBox = 
new QComboBox();
 
 2374    mTypeComboBox->setCurrentIndex( mTypeComboBox->findData( 
static_cast<int>( fileParam->behavior() ) ) );
 
 2376    mTypeComboBox->setCurrentIndex( 0 );
 
 2377  vlayout->addWidget( mTypeComboBox );
 
 2379  vlayout->addWidget( 
new QLabel( tr( 
"File filter" ) ) );
 
 2381  mFilterComboBox = 
new QComboBox();
 
 2382  mFilterComboBox->setEditable( 
true );
 
 2384  mFilterComboBox->addItem( tr( 
"All Files (*.*)" ) );
 
 2385  mFilterComboBox->addItem( tr( 
"CSV Files (*.csv)" ) );
 
 2386  mFilterComboBox->addItem( tr( 
"HTML Files (*.html *.htm)" ) );
 
 2387  mFilterComboBox->addItem( tr( 
"Text Files (*.txt)" ) );
 
 2389    mFilterComboBox->setCurrentText( fileParam->fileFilter() );
 
 2391    mFilterComboBox->setCurrentIndex( 0 );
 
 2392  vlayout->addWidget( mFilterComboBox );
 
 2394  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 2397  mDefaultFileWidget->lineEdit()->setShowClearButton( 
true );
 
 2401    mDefaultFileWidget->setFilePath( fileParam->defaultValueForGui().toString() );
 
 2405  vlayout->addWidget( mDefaultFileWidget );
 
 2407  connect( mTypeComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), 
this, [
this] {
 
 2415  setLayout( vlayout );
 
 2420  auto param = std::make_unique<QgsProcessingParameterFile>( name, description );
 
 2423    param->setFileFilter( mFilterComboBox->currentText() );
 
 2424  if ( !mDefaultFileWidget->filePath().isEmpty() )
 
 2425    param->setDefaultValue( mDefaultFileWidget->filePath() );
 
 2426  param->setFlags( flags );
 
 2427  return param.release();
 
 2436QWidget *QgsProcessingFileWidgetWrapper::createWidget()
 
 2446      mFileWidget->setToolTip( parameterDefinition()->toolTip() );
 
 2447      mFileWidget->setDialogTitle( parameterDefinition()->description() );
 
 2449      mFileWidget->setDefaultRoot( 
QgsSettings().value( QStringLiteral( 
"/Processing/LastInputPath" ), QDir::homePath() ).toString() );
 
 2456            mFileWidget->setFilter( fileParam->
fileFilter() );
 
 2457          else if ( !fileParam->
extension().isEmpty() )
 
 2458            mFileWidget->setFilter( tr( 
"%1 files" ).arg( fileParam->
extension().toUpper() ) + QStringLiteral( 
" (*." ) + fileParam->
extension().toLower() + 
')' );
 
 2467        QgsSettings().
setValue( QStringLiteral( 
"/Processing/LastInputPath" ), QFileInfo( path ).canonicalPath() );
 
 2468        emit widgetValueHasChanged( 
this );
 
 2476void QgsProcessingFileWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 2480    mFileWidget->setFilePath( v );
 
 2483QVariant QgsProcessingFileWidgetWrapper::widgetValue()
 const 
 2486    return mFileWidget->filePath();
 
 2491QString QgsProcessingFileWidgetWrapper::modelerExpressionFormatString()
 const 
 2493  return tr( 
"string representing a path to a file or folder" );
 
 2496QString QgsProcessingFileWidgetWrapper::parameterType()
 const 
 2503  return new QgsProcessingFileWidgetWrapper( parameter, type );
 
 2508  return new QgsProcessingFileParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 2519  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 2520  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 2521  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 2524  mDefaultQgisLineEdit->registerExpressionContextGenerator( 
this );
 
 2526  mDefaultPointCloudLineEdit = 
new QgsProcessingPointCloudExpressionLineEdit();
 
 2527  mDefaultRasterCalculatorLineEdit = 
new QgsProcessingRasterCalculatorExpressionLineEdit();
 
 2529  QStackedWidget *stackedWidget = 
new QStackedWidget();
 
 2530  stackedWidget->addWidget( mDefaultQgisLineEdit );
 
 2531  stackedWidget->addWidget( mDefaultPointCloudLineEdit );
 
 2532  stackedWidget->addWidget( mDefaultRasterCalculatorLineEdit );
 
 2533  vlayout->addWidget( stackedWidget );
 
 2538    mDefaultQgisLineEdit->setExpression( expr );
 
 2539    mDefaultPointCloudLineEdit->setExpression( expr );
 
 2542  vlayout->addWidget( 
new QLabel( tr( 
"Parent layer" ) ) );
 
 2544  mParentLayerComboBox = 
new QComboBox();
 
 2545  vlayout->addWidget( mParentLayerComboBox );
 
 2547  vlayout->addWidget( 
new QLabel( tr( 
"Expression type" ) ) );
 
 2548  mExpressionTypeComboBox = 
new QComboBox();
 
 2553  connect( mExpressionTypeComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, [
this, stackedWidget, definition, widgetContext]( 
int ) {
 
 2554    mParentLayerComboBox->clear();
 
 2555    mParentLayerComboBox->addItem( tr( 
"None" ), QVariant() );
 
 2557    stackedWidget->setCurrentIndex( mExpressionTypeComboBox->currentIndex() > 0 ? mExpressionTypeComboBox->currentIndex() : 0 );
 
 2559    QString initialParent;
 
 2561      initialParent = expParam->parentLayerParameterName();
 
 2565    if ( QgsProcessingModelAlgorithm *model = widgetContext.
model() )
 
 2568      const QMap<QString, QgsProcessingModelParameter> components = model->parameterComponents();
 
 2569      for ( 
auto it = components.constBegin(); it != components.constEnd(); ++it )
 
 2576              mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 2577              if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 2579                mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 2584              mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 2585              if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 2587                mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 2594              mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 2595              if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 2597                mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 2608              mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 2609              if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 2611                mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 2619    if ( mParentLayerComboBox->count() == 1 && !initialParent.isEmpty() )
 
 2622      mParentLayerComboBox->addItem( initialParent, initialParent );
 
 2623      mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 2627  mExpressionTypeComboBox->setCurrentIndex( -1 );
 
 2629    mExpressionTypeComboBox->setCurrentIndex( mExpressionTypeComboBox->findData( 
static_cast<int>( expParam->expressionType() ) ) );
 
 2631    mExpressionTypeComboBox->setCurrentIndex( 0 );
 
 2633  vlayout->addWidget( mExpressionTypeComboBox );
 
 2635  setLayout( vlayout );
 
 2642  switch ( expressionType )
 
 2645      expression = mDefaultQgisLineEdit->expression();
 
 2648      expression = mDefaultPointCloudLineEdit->expression();
 
 2651      expression = mDefaultRasterCalculatorLineEdit->expression();
 
 2654  auto param = std::make_unique<QgsProcessingParameterExpression>( name, description, expression, mParentLayerComboBox->currentData().toString(), 
false, expressionType );
 
 2655  param->setFlags( flags );
 
 2656  return param.release();
 
 2664QWidget *QgsProcessingExpressionWidgetWrapper::createWidget()
 
 2676        mExpLineEdit->setToolTip( parameterDefinition()->toolTip() );
 
 2677        mExpLineEdit->setExpressionDialogTitle( parameterDefinition()->description() );
 
 2678        mExpLineEdit->registerExpressionContextGenerator( 
this );
 
 2680          emit widgetValueHasChanged( 
this );
 
 2682        return mExpLineEdit;
 
 2688          mPointCloudExpLineEdit = 
new QgsProcessingPointCloudExpressionLineEdit();
 
 2689          mPointCloudExpLineEdit->setToolTip( parameterDefinition()->toolTip() );
 
 2690          connect( mPointCloudExpLineEdit, &QgsProcessingPointCloudExpressionLineEdit::expressionChanged, 
this, [
this]( 
const QString & ) {
 
 2691            emit widgetValueHasChanged( 
this );
 
 2693          return mPointCloudExpLineEdit;
 
 2698          mRasterCalculatorExpLineEdit = 
new QgsProcessingRasterCalculatorExpressionLineEdit();
 
 2699          mRasterCalculatorExpLineEdit->setToolTip( parameterDefinition()->toolTip() );
 
 2702            mRasterCalculatorExpLineEdit->setLayers( QVariantList() << 
"A" << 
"B" << 
"C" << 
"D" << 
"E" << 
"F" << 
"G" );
 
 2704          connect( mRasterCalculatorExpLineEdit, &QgsProcessingRasterCalculatorExpressionLineEdit::expressionChanged, 
this, [
this]( 
const QString & ) {
 
 2705            emit widgetValueHasChanged( 
this );
 
 2707          return mRasterCalculatorExpLineEdit;
 
 2711        if ( expParam->
metadata().value( QStringLiteral( 
"inlineEditor" ) ).toBool() )
 
 2714          mExpBuilderWidget->setToolTip( parameterDefinition()->toolTip() );
 
 2715          mExpBuilderWidget->init( createExpressionContext() );
 
 2717            Q_UNUSED( changed );
 
 2718            emit widgetValueHasChanged( 
this );
 
 2720          return mExpBuilderWidget;
 
 2725          mFieldExpWidget->setToolTip( parameterDefinition()->toolTip() );
 
 2726          mFieldExpWidget->setExpressionDialogTitle( parameterDefinition()->description() );
 
 2727          mFieldExpWidget->registerExpressionContextGenerator( 
this );
 
 2729            mFieldExpWidget->setAllowEmptyFieldName( 
true );
 
 2732            emit widgetValueHasChanged( 
this );
 
 2734          return mFieldExpWidget;
 
 2742void QgsProcessingExpressionWidgetWrapper::postInitialize( 
const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
 
 2754          setParentLayerWrapperValue( wrapper );
 
 2756            setParentLayerWrapperValue( wrapper );
 
 2772  if ( mExpBuilderWidget )
 
 2775    mExpBuilderWidget->setExpressionContext( createExpressionContext() );
 
 2783  std::unique_ptr<QgsProcessingContext> tmpContext;
 
 2784  if ( mProcessingContextGenerator )
 
 2785    context = mProcessingContextGenerator->processingContext();
 
 2789    tmpContext = std::make_unique<QgsProcessingContext>();
 
 2790    context = tmpContext.get();
 
 2800      if ( val.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
 
 2810        if ( mFieldExpWidget )
 
 2811          mFieldExpWidget->setLayer( 
nullptr );
 
 2812        else if ( mExpBuilderWidget )
 
 2813          mExpBuilderWidget->setLayer( 
nullptr );
 
 2814        else if ( mExpLineEdit )
 
 2815          mExpLineEdit->setLayer( 
nullptr );
 
 2821      std::unique_ptr<QgsMapLayer> ownedLayer( context->
takeResultLayer( layer->
id() ) );
 
 2824        mParentLayer = std::move( ownedLayer );
 
 2832      if ( mFieldExpWidget )
 
 2833        mFieldExpWidget->setLayer( layer );
 
 2834      if ( mExpBuilderWidget )
 
 2835        mExpBuilderWidget->setLayer( layer );
 
 2836      else if ( mExpLineEdit )
 
 2837        mExpLineEdit->setLayer( layer );
 
 2846        if ( mPointCloudExpLineEdit )
 
 2847          mPointCloudExpLineEdit->setLayer( 
nullptr );
 
 2853      std::unique_ptr<QgsMapLayer> ownedLayer( context->
takeResultLayer( layer->
id() ) );
 
 2856        mParentLayer = std::move( ownedLayer );
 
 2864      if ( mPointCloudExpLineEdit )
 
 2865        mPointCloudExpLineEdit->setLayer( layer );
 
 2872      if ( layers.isEmpty() )
 
 2874        if ( mRasterCalculatorExpLineEdit )
 
 2876          mRasterCalculatorExpLineEdit->setLayers( val.userType() == QMetaType::Type::QVariantList ? val.toList() : QVariantList() << val );
 
 2881      if ( mRasterCalculatorExpLineEdit )
 
 2883        QVariantList layersList;
 
 2886          layersList << layer->
name();
 
 2888        mRasterCalculatorExpLineEdit->setLayers( layersList );
 
 2896void QgsProcessingExpressionWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 2899  if ( mFieldExpWidget )
 
 2900    mFieldExpWidget->setExpression( v );
 
 2901  else if ( mExpBuilderWidget )
 
 2902    mExpBuilderWidget->setExpressionText( v );
 
 2903  else if ( mExpLineEdit )
 
 2904    mExpLineEdit->setExpression( v );
 
 2905  else if ( mPointCloudExpLineEdit )
 
 2906    mPointCloudExpLineEdit->setExpression( v );
 
 2907  else if ( mRasterCalculatorExpLineEdit )
 
 2908    mRasterCalculatorExpLineEdit->setExpression( v );
 
 2911QVariant QgsProcessingExpressionWidgetWrapper::widgetValue()
 const 
 2913  if ( mFieldExpWidget )
 
 2914    return mFieldExpWidget->expression();
 
 2915  if ( mExpBuilderWidget )
 
 2916    return mExpBuilderWidget->expressionText();
 
 2917  else if ( mExpLineEdit )
 
 2918    return mExpLineEdit->expression();
 
 2919  else if ( mPointCloudExpLineEdit )
 
 2920    return mPointCloudExpLineEdit->expression();
 
 2921  else if ( mRasterCalculatorExpLineEdit )
 
 2922    return mRasterCalculatorExpLineEdit->expression();
 
 2927QString QgsProcessingExpressionWidgetWrapper::modelerExpressionFormatString()
 const 
 2929  return tr( 
"string representation of an expression" );
 
 2932const QgsVectorLayer *QgsProcessingExpressionWidgetWrapper::linkedVectorLayer()
 const 
 2934  if ( mFieldExpWidget && mFieldExpWidget->layer() )
 
 2935    return mFieldExpWidget->layer();
 
 2937  if ( mExpBuilderWidget && mExpBuilderWidget->layer() )
 
 2938    return mExpBuilderWidget->layer();
 
 2943QString QgsProcessingExpressionWidgetWrapper::parameterType()
 const 
 2950  return new QgsProcessingExpressionWidgetWrapper( parameter, type );
 
 2955  return new QgsProcessingExpressionParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 2967  QHBoxLayout *hl = 
new QHBoxLayout();
 
 2968  hl->setContentsMargins( 0, 0, 0, 0 );
 
 2970  mLineEdit = 
new QLineEdit();
 
 2971  mLineEdit->setEnabled( 
false );
 
 2972  hl->addWidget( mLineEdit, 1 );
 
 2974  mToolButton = 
new QToolButton();
 
 2975  mToolButton->setText( QString( QChar( 0x2026 ) ) );
 
 2976  hl->addWidget( mToolButton );
 
 2982    mLineEdit->setText( tr( 
"%1 options selected" ).arg( 0 ) );
 
 2985  connect( mToolButton, &QToolButton::clicked, 
this, &QgsProcessingEnumPanelWidget::showDialog );
 
 2988void QgsProcessingEnumPanelWidget::setValue( 
const QVariant &value )
 
 2990  if ( value.isValid() )
 
 2992    mValue = value.userType() == QMetaType::Type::QVariantList ? value.toList() : QVariantList() << value;
 
 2994    if ( mParam->usesStaticStrings() && mValue.count() == 1 && mValue.at( 0 ).toString().isEmpty() )
 
 3000  updateSummaryText();
 
 3004void QgsProcessingEnumPanelWidget::showDialog()
 
 3006  QVariantList availableOptions;
 
 3009    availableOptions.reserve( mParam->options().size() );
 
 3011    if ( mParam->usesStaticStrings() )
 
 3013      for ( QString o : mParam->options() )
 
 3015        availableOptions << o;
 
 3020      for ( 
int i = 0; i < mParam->options().count(); ++i )
 
 3021        availableOptions << i;
 
 3025  const QStringList options = mParam ? mParam->options() : QStringList();
 
 3029    QgsProcessingMultipleSelectionPanelWidget *widget = 
new QgsProcessingMultipleSelectionPanelWidget( availableOptions, mValue );
 
 3030    widget->setPanelTitle( mParam->description() );
 
 3032    if ( mParam->usesStaticStrings() )
 
 3034      widget->setValueFormatter( [options]( 
const QVariant &v ) -> QString {
 
 3035        const QString i = v.toString();
 
 3036        return options.contains( i ) ? i : QString();
 
 3041      widget->setValueFormatter( [options]( 
const QVariant &v ) -> QString {
 
 3042        const int i = v.toInt();
 
 3043        return options.size() > i ? options.at( i ) : QString();
 
 3047    connect( widget, &QgsProcessingMultipleSelectionPanelWidget::selectionChanged, 
this, [
this, widget]() {
 
 3048      setValue( widget->selectedOptions() );
 
 3055    QgsProcessingMultipleSelectionDialog dlg( availableOptions, mValue, 
this, Qt::WindowFlags() );
 
 3057    dlg.setValueFormatter( [options]( 
const QVariant &v ) -> QString {
 
 3058      const int i = v.toInt();
 
 3059      return options.size() > i ? options.at( i ) : QString();
 
 3063      setValue( dlg.selectedOptions() );
 
 3068void QgsProcessingEnumPanelWidget::updateSummaryText()
 
 3073  if ( mValue.empty() )
 
 3075    mLineEdit->setText( tr( 
"%1 options selected" ).arg( 0 ) );
 
 3080    values.reserve( mValue.size() );
 
 3081    if ( mParam->usesStaticStrings() )
 
 3083      for ( 
const QVariant &val : std::as_const( mValue ) )
 
 3085        values << val.toString();
 
 3090      const QStringList options = mParam->options();
 
 3091      for ( 
const QVariant &val : std::as_const( mValue ) )
 
 3093        const int i = val.toInt();
 
 3094        values << ( options.size() > i ? options.at( i ) : QString() );
 
 3098    const QString concatenated = values.join( tr( 
"," ) );
 
 3099    if ( concatenated.length() < 100 )
 
 3100      mLineEdit->setText( concatenated );
 
 3102      mLineEdit->setText( tr( 
"%n option(s) selected", 
nullptr, mValue.count() ) );
 
 3110QgsProcessingEnumCheckboxPanelWidget::QgsProcessingEnumCheckboxPanelWidget( QWidget *parent, 
const QgsProcessingParameterEnum *param, 
int columns )
 
 3113  , mButtonGroup( new QButtonGroup( this ) )
 
 3114  , mColumns( columns )
 
 3116  mButtonGroup->setExclusive( !mParam->allowMultiple() );
 
 3118  QGridLayout *l = 
new QGridLayout();
 
 3119  l->setContentsMargins( 0, 0, 0, 0 );
 
 3121  int rows = 
static_cast<int>( std::ceil( mParam->options().count() / 
static_cast<double>( mColumns ) ) );
 
 3122  for ( 
int i = 0; i < mParam->options().count(); ++i )
 
 3124    QAbstractButton *button = 
nullptr;
 
 3125    if ( mParam->allowMultiple() )
 
 3126      button = 
new QCheckBox( mParam->options().at( i ) );
 
 3128      button = 
new QRadioButton( mParam->options().at( i ) );
 
 3130    connect( button, &QAbstractButton::toggled, 
this, [
this] {
 
 3131      if ( !mBlockChangedSignal )
 
 3135    mButtons.insert( i, button );
 
 3137    mButtonGroup->addButton( button, i );
 
 3138    l->addWidget( button, i % rows, i / rows );
 
 3140  l->addItem( 
new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, mColumns );
 
 3143  if ( mParam->allowMultiple() )
 
 3145    setContextMenuPolicy( Qt::CustomContextMenu );
 
 3146    connect( 
this, &QWidget::customContextMenuRequested, 
this, &QgsProcessingEnumCheckboxPanelWidget::showPopupMenu );
 
 3150QVariant QgsProcessingEnumCheckboxPanelWidget::value()
 const 
 3152  if ( mParam->allowMultiple() )
 
 3155    for ( 
auto it = mButtons.constBegin(); it != mButtons.constEnd(); ++it )
 
 3157      if ( it.value()->isChecked() )
 
 3158        value.append( mParam->usesStaticStrings() ? mParam->options().at( it.key().toInt() ) : it.key() );
 
 3164    if ( mParam->usesStaticStrings() )
 
 3165      return mButtonGroup->checkedId() >= 0 ? mParam->options().at( mButtonGroup->checkedId() ) : QVariant();
 
 3167      return mButtonGroup->checkedId() >= 0 ? mButtonGroup->checkedId() : QVariant();
 
 3171void QgsProcessingEnumCheckboxPanelWidget::setValue( 
const QVariant &value )
 
 3173  mBlockChangedSignal = 
true;
 
 3174  if ( mParam->allowMultiple() )
 
 3176    QVariantList selected;
 
 3177    if ( value.isValid() )
 
 3178      selected = value.userType() == QMetaType::Type::QVariantList ? value.toList() : QVariantList() << value;
 
 3179    for ( 
auto it = mButtons.constBegin(); it != mButtons.constEnd(); ++it )
 
 3181      QVariant v = mParam->usesStaticStrings() ? mParam->options().at( it.key().toInt() ) : it.key();
 
 3182      it.value()->setChecked( selected.contains( v ) );
 
 3188    if ( v.userType() == QMetaType::Type::QVariantList )
 
 3189      v = v.toList().value( 0 );
 
 3191    v = mParam->usesStaticStrings() ? mParam->options().indexOf( v.toString() ) : v;
 
 3192    if ( mButtons.contains( v ) )
 
 3193      mButtons.value( v )->setChecked( 
true );
 
 3195  mBlockChangedSignal = 
false;
 
 3199void QgsProcessingEnumCheckboxPanelWidget::showPopupMenu()
 
 3202  QAction *selectAllAction = 
new QAction( tr( 
"Select All" ), &popupMenu );
 
 3203  connect( selectAllAction, &QAction::triggered, 
this, &QgsProcessingEnumCheckboxPanelWidget::selectAll );
 
 3204  QAction *clearAllAction = 
new QAction( tr( 
"Clear Selection" ), &popupMenu );
 
 3205  connect( clearAllAction, &QAction::triggered, 
this, &QgsProcessingEnumCheckboxPanelWidget::deselectAll );
 
 3206  popupMenu.addAction( selectAllAction );
 
 3207  popupMenu.addAction( clearAllAction );
 
 3208  popupMenu.exec( QCursor::pos() );
 
 3211void QgsProcessingEnumCheckboxPanelWidget::selectAll()
 
 3213  mBlockChangedSignal = 
true;
 
 3214  for ( 
auto it = mButtons.constBegin(); it != mButtons.constEnd(); ++it )
 
 3215    it.value()->setChecked( 
true );
 
 3216  mBlockChangedSignal = 
false;
 
 3220void QgsProcessingEnumCheckboxPanelWidget::deselectAll()
 
 3222  mBlockChangedSignal = 
true;
 
 3223  for ( 
auto it = mButtons.constBegin(); it != mButtons.constEnd(); ++it )
 
 3224    it.value()->setChecked( 
false );
 
 3225  mBlockChangedSignal = 
false;
 
 3237  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 3238  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 3240  mEnumWidget = 
new QgsProcessingEnumModelerWidget();
 
 3243    mEnumWidget->setAllowMultiple( enumParam->allowMultiple() );
 
 3244    mEnumWidget->setOptions( enumParam->options() );
 
 3245    mEnumWidget->setDefaultOptions( enumParam->defaultValueForGui() );
 
 3247  vlayout->addWidget( mEnumWidget );
 
 3248  setLayout( vlayout );
 
 3253  auto param = std::make_unique<QgsProcessingParameterEnum>( name, description, mEnumWidget->options(), mEnumWidget->allowMultiple(), mEnumWidget->defaultOptions() );
 
 3255  return param.release();
 
 3264QWidget *QgsProcessingEnumWidgetWrapper::createWidget()
 
 3272      if ( expParam->
metadata().value( QStringLiteral( 
"widget_wrapper" ) ).toMap().value( QStringLiteral( 
"useCheckBoxes" ), 
false ).toBool() )
 
 3274        const int columns = expParam->
metadata().value( QStringLiteral( 
"widget_wrapper" ) ).toMap().value( QStringLiteral( 
"columns" ), 2 ).toInt();
 
 3275        mCheckboxPanel = 
new QgsProcessingEnumCheckboxPanelWidget( 
nullptr, expParam, columns );
 
 3276        mCheckboxPanel->setToolTip( parameterDefinition()->toolTip() );
 
 3277        connect( mCheckboxPanel, &QgsProcessingEnumCheckboxPanelWidget::changed, 
this, [
this] {
 
 3278          emit widgetValueHasChanged( 
this );
 
 3280        return mCheckboxPanel;
 
 3289        mPanel = 
new QgsProcessingEnumPanelWidget( 
nullptr, expParam );
 
 3290        mPanel->setToolTip( parameterDefinition()->toolTip() );
 
 3291        connect( mPanel, &QgsProcessingEnumPanelWidget::changed, 
this, [
this] {
 
 3292          emit widgetValueHasChanged( 
this );
 
 3298        mComboBox = 
new QComboBox();
 
 3301          mComboBox->addItem( tr( 
"[Not selected]" ), QVariant() );
 
 3302        const QStringList options = expParam->
options();
 
 3303        const QVariantList iconList = expParam->
metadata().value( QStringLiteral( 
"widget_wrapper" ) ).toMap().value( QStringLiteral( 
"icons" ) ).toList();
 
 3304        for ( 
int i = 0; i < options.count(); ++i )
 
 3306          const QIcon icon = iconList.value( i ).value<QIcon>();
 
 3309            mComboBox->addItem( icon, options.at( i ), options.at( i ) );
 
 3311            mComboBox->addItem( icon, options.at( i ), i );
 
 3314        mComboBox->setToolTip( parameterDefinition()->toolTip() );
 
 3315        mComboBox->setSizeAdjustPolicy( QComboBox::AdjustToMinimumContentsLengthWithIcon );
 
 3316        connect( mComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), 
this, [
this]( 
int ) {
 
 3317          emit widgetValueHasChanged( 
this );
 
 3326void QgsProcessingEnumWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 3330    if ( !value.isValid() )
 
 3331      mComboBox->setCurrentIndex( mComboBox->findData( QVariant() ) );
 
 3338        mComboBox->setCurrentIndex( mComboBox->findData( v ) );
 
 3343        mComboBox->setCurrentIndex( mComboBox->findData( v ) );
 
 3347  else if ( mPanel || mCheckboxPanel )
 
 3350    if ( value.isValid() )
 
 3356        opts.reserve( v.size() );
 
 3357        for ( QString i : v )
 
 3363        opts.reserve( v.size() );
 
 3369      mPanel->setValue( opts );
 
 3370    else if ( mCheckboxPanel )
 
 3371      mCheckboxPanel->setValue( opts );
 
 3375QVariant QgsProcessingEnumWidgetWrapper::widgetValue()
 const 
 3378    return mComboBox->currentData();
 
 3380    return mPanel->value();
 
 3381  else if ( mCheckboxPanel )
 
 3382    return mCheckboxPanel->value();
 
 3387QString QgsProcessingEnumWidgetWrapper::modelerExpressionFormatString()
 const 
 3389  return tr( 
"selected option index (starting from 0), array of indices, or comma separated string of options (e.g. '1,3')" );
 
 3392QString QgsProcessingEnumWidgetWrapper::parameterType()
 const 
 3399  return new QgsProcessingEnumWidgetWrapper( parameter, type );
 
 3404  return new QgsProcessingEnumParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 3416QWidget *QgsProcessingLayoutWidgetWrapper::createWidget()
 
 3425      mComboBox = 
new QgsLayoutComboBox( 
nullptr, widgetContext().project() ? widgetContext().project()->layoutManager() : nullptr );
 
 3430      mComboBox->setToolTip( parameterDefinition()->toolTip() );
 
 3432        emit widgetValueHasChanged( 
this );
 
 3439      mPlainComboBox = 
new QComboBox();
 
 3440      mPlainComboBox->setEditable( 
true );
 
 3441      mPlainComboBox->setToolTip( tr( 
"Name of an existing print layout" ) );
 
 3442      if ( widgetContext().project() )
 
 3446          mPlainComboBox->addItem( layout->name() );
 
 3449      connect( mPlainComboBox, &QComboBox::currentTextChanged, 
this, [
this]( 
const QString & ) {
 
 3450        emit widgetValueHasChanged( 
this );
 
 3452      return mPlainComboBox;
 
 3458void QgsProcessingLayoutWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 3462    if ( !value.isValid() )
 
 3463      mComboBox->setCurrentLayout( 
nullptr );
 
 3467        mComboBox->setCurrentLayout( l );
 
 3469        mComboBox->setCurrentLayout( 
nullptr );
 
 3472  else if ( mPlainComboBox )
 
 3475    mPlainComboBox->setCurrentText( v );
 
 3479QVariant QgsProcessingLayoutWidgetWrapper::widgetValue()
 const 
 3484    return l ? l->
name() : QVariant();
 
 3486  else if ( mPlainComboBox )
 
 3487    return mPlainComboBox->currentText().isEmpty() ? QVariant() : mPlainComboBox->currentText();
 
 3495  if ( mPlainComboBox && context.
project() )
 
 3499      mPlainComboBox->addItem( layout->name() );
 
 3503QString QgsProcessingLayoutWidgetWrapper::modelerExpressionFormatString()
 const 
 3505  return tr( 
"string representing the name of an existing print layout" );
 
 3508QString QgsProcessingLayoutWidgetWrapper::parameterType()
 const 
 3515  return new QgsProcessingLayoutWidgetWrapper( parameter, type );
 
 3527  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 3528  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 3530  vlayout->addWidget( 
new QLabel( tr( 
"Parent layout" ) ) );
 
 3532  mParentLayoutComboBox = 
new QComboBox();
 
 3533  QString initialParent;
 
 3535    initialParent = itemParam->parentLayoutParameterName();
 
 3537  if ( 
auto *lModel = widgetContext.
model() )
 
 3540    const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
 
 3541    for ( 
auto it = components.constBegin(); it != components.constEnd(); ++it )
 
 3545        mParentLayoutComboBox->addItem( definition->
description(), definition->
name() );
 
 3546        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 3548          mParentLayoutComboBox->setCurrentIndex( mParentLayoutComboBox->count() - 1 );
 
 3554  if ( mParentLayoutComboBox->count() == 0 && !initialParent.isEmpty() )
 
 3557    mParentLayoutComboBox->addItem( initialParent, initialParent );
 
 3558    mParentLayoutComboBox->setCurrentIndex( mParentLayoutComboBox->count() - 1 );
 
 3561  vlayout->addWidget( mParentLayoutComboBox );
 
 3562  setLayout( vlayout );
 
 3566  auto param = std::make_unique<QgsProcessingParameterLayoutItem>( name, description, QVariant(), mParentLayoutComboBox->currentData().toString() );
 
 3568  return param.release();
 
 3577QWidget *QgsProcessingLayoutItemWidgetWrapper::createWidget()
 
 3588        mComboBox->setAllowEmptyItem( 
true );
 
 3589      if ( layoutParam->
itemType() >= 0 )
 
 3592      mComboBox->setToolTip( parameterDefinition()->toolTip() );
 
 3594        emit widgetValueHasChanged( 
this );
 
 3601      mLineEdit = 
new QLineEdit();
 
 3602      mLineEdit->setToolTip( tr( 
"UUID or ID of an existing print layout item" ) );
 
 3603      connect( mLineEdit, &QLineEdit::textChanged, 
this, [
this]( 
const QString & ) {
 
 3604        emit widgetValueHasChanged( 
this );
 
 3612void QgsProcessingLayoutItemWidgetWrapper::postInitialize( 
const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
 
 3639void QgsProcessingLayoutItemWidgetWrapper::setLayoutParameterValue( 
const QVariant &value )
 
 3645  std::unique_ptr<QgsProcessingContext> tmpContext;
 
 3646  if ( mProcessingContextGenerator )
 
 3647    context = mProcessingContextGenerator->processingContext();
 
 3651    tmpContext = std::make_unique<QgsProcessingContext>();
 
 3652    context = tmpContext.get();
 
 3656  setLayout( layout );
 
 3659void QgsProcessingLayoutItemWidgetWrapper::setLayout( 
QgsPrintLayout *layout )
 
 3662    mComboBox->setCurrentLayout( layout );
 
 3665void QgsProcessingLayoutItemWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 3669    if ( !value.isValid() )
 
 3670      mComboBox->setItem( 
nullptr );
 
 3674      mComboBox->setItem( item );
 
 3677  else if ( mLineEdit )
 
 3680    mLineEdit->setText( v );
 
 3684QVariant QgsProcessingLayoutItemWidgetWrapper::widgetValue()
 const 
 3689    return i ? i->
uuid() : QVariant();
 
 3691  else if ( mLineEdit )
 
 3692    return mLineEdit->text().isEmpty() ? QVariant() : mLineEdit->text();
 
 3698QString QgsProcessingLayoutItemWidgetWrapper::modelerExpressionFormatString()
 const 
 3700  return tr( 
"string representing the UUID or ID of an existing print layout item" );
 
 3703QString QgsProcessingLayoutItemWidgetWrapper::parameterType()
 const 
 3710  return new QgsProcessingLayoutItemWidgetWrapper( parameter, type );
 
 3715  return new QgsProcessingLayoutItemParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 3722QgsProcessingPointMapTool::QgsProcessingPointMapTool( 
QgsMapCanvas *canvas )
 
 3729QgsProcessingPointMapTool::~QgsProcessingPointMapTool() = 
default;
 
 3731void QgsProcessingPointMapTool::deactivate()
 
 3745  if ( e->button() == Qt::LeftButton )
 
 3748    emit clicked( point );
 
 3753void QgsProcessingPointMapTool::keyPressEvent( QKeyEvent *e )
 
 3755  if ( e->key() == Qt::Key_Escape )
 
 3768QgsProcessingPointPanel::QgsProcessingPointPanel( QWidget *parent )
 
 3771  QHBoxLayout *l = 
new QHBoxLayout();
 
 3772  l->setContentsMargins( 0, 0, 0, 0 );
 
 3774  mLineEdit->setShowClearButton( 
false );
 
 3775  l->addWidget( mLineEdit, 1 );
 
 3776  mButton = 
new QToolButton();
 
 3777  mButton->setText( QString( QChar( 0x2026 ) ) );
 
 3778  l->addWidget( mButton );
 
 3781  connect( mLineEdit, &QLineEdit::textChanged, 
this, &QgsProcessingPointPanel::changed );
 
 3782  connect( mLineEdit, &QLineEdit::textChanged, 
this, &QgsProcessingPointPanel::textChanged );
 
 3783  connect( mButton, &QToolButton::clicked, 
this, &QgsProcessingPointPanel::selectOnCanvas );
 
 3784  mButton->setVisible( 
false );
 
 3787void QgsProcessingPointPanel::setMapCanvas( 
QgsMapCanvas *canvas )
 
 3790  if ( mAllowSelectOnCanvas )
 
 3792    mButton->setVisible( 
true );
 
 3795    mTool = std::make_unique<QgsProcessingPointMapTool>( mCanvas );
 
 3796    connect( mTool.get(), &QgsProcessingPointMapTool::clicked, 
this, &QgsProcessingPointPanel::updatePoint );
 
 3797    connect( mTool.get(), &QgsProcessingPointMapTool::complete, 
this, &QgsProcessingPointPanel::pointPicked );
 
 3801void QgsProcessingPointPanel::setAllowNull( 
bool allowNull )
 
 3803  mLineEdit->setShowClearButton( allowNull );
 
 3806void QgsProcessingPointPanel::setShowPointOnCanvas( 
bool show )
 
 3808  if ( mShowPointOnCanvas == show )
 
 3811  mShowPointOnCanvas = show;
 
 3812  if ( mShowPointOnCanvas )
 
 3818    mMapPointRubberBand.reset();
 
 3822void QgsProcessingPointPanel::setAllowSelectOnCanvas( 
bool allow )
 
 3824  mAllowSelectOnCanvas = allow;
 
 3825  mButton->setVisible( mAllowSelectOnCanvas && 
static_cast<bool>( mTool ) );
 
 3828QVariant QgsProcessingPointPanel::value()
 const 
 3830  return mLineEdit->showClearButton() && mLineEdit->text().trimmed().isEmpty() ? QVariant() : QVariant( mLineEdit->text() );
 
 3833void QgsProcessingPointPanel::clear()
 
 3841  QString newText = QStringLiteral( 
"%1,%2" )
 
 3842                      .arg( QString::number( point.
x(), 
'f' ), QString::number( point.
y(), 
'f' ) );
 
 3845  if ( mCrs.isValid() )
 
 3847    newText += QStringLiteral( 
" [%1]" ).arg( mCrs.authid() );
 
 3849  mLineEdit->setText( newText );
 
 3853void QgsProcessingPointPanel::showEvent( QShowEvent * )
 
 3858    if ( QWidget *parentWindow = window() )
 
 3860      setAllowSelectOnCanvas( !parentWindow->isModal() );
 
 3866void QgsProcessingPointPanel::selectOnCanvas()
 
 3871  mPrevTool = mCanvas->mapTool();
 
 3872  mCanvas->setMapTool( mTool.get() );
 
 3874  emit toggleDialogVisibility( 
false );
 
 3877void QgsProcessingPointPanel::updatePoint( 
const QgsPointXY &point )
 
 3879  setValue( point, mCanvas->mapSettings().destinationCrs() );
 
 3882void QgsProcessingPointPanel::pointPicked()
 
 3887  mCanvas->setMapTool( mPrevTool );
 
 3889  emit toggleDialogVisibility( 
true );
 
 3892void QgsProcessingPointPanel::textChanged( 
const QString &text )
 
 3894  const thread_local QRegularExpression rx( QStringLiteral( 
"^\\s*\\(?\\s*(.*?)\\s*,\\s*(.*?)\\s*(?:\\[(.*)\\])?\\s*\\)?\\s*$" ) );
 
 3896  const QRegularExpressionMatch match = rx.match( text );
 
 3897  if ( match.hasMatch() )
 
 3900    const double x = match.captured( 1 ).toDouble( &xOk );
 
 3902    const double y = match.captured( 2 ).toDouble( &yOk );
 
 3909      if ( pointCrs.isValid() )
 
 3927void QgsProcessingPointPanel::updateRubberBand()
 
 3929  if ( !mShowPointOnCanvas || !mCanvas )
 
 3932  if ( mPoint.isEmpty() )
 
 3934    mMapPointRubberBand.reset();
 
 3938  if ( !mMapPointRubberBand )
 
 3941    mMapPointRubberBand->setZValue( 1000 );
 
 3944    const double scaleFactor = mCanvas->fontMetrics().xHeight() * .4;
 
 3945    mMapPointRubberBand->setWidth( scaleFactor );
 
 3946    mMapPointRubberBand->setIconSize( scaleFactor * 5 );
 
 3948    mMapPointRubberBand->setSecondaryStrokeColor( QColor( 255, 255, 255, 100 ) );
 
 3949    mMapPointRubberBand->setColor( QColor( 200, 0, 200 ) );
 
 3963  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 3964  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 3966  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 3968  mDefaultLineEdit = 
new QLineEdit();
 
 3969  mDefaultLineEdit->setToolTip( tr( 
"Point as 'x,y'" ) );
 
 3970  mDefaultLineEdit->setPlaceholderText( tr( 
"Point as 'x,y'" ) );
 
 3974    mDefaultLineEdit->setText( QStringLiteral( 
"%1,%2" ).arg( QString::number( point.
x(), 
'f' ), QString::number( point.
y(), 
'f' ) ) );
 
 3977  vlayout->addWidget( mDefaultLineEdit );
 
 3978  setLayout( vlayout );
 
 3983  auto param = std::make_unique<QgsProcessingParameterPoint>( name, description, mDefaultLineEdit->text() );
 
 3985  return param.release();
 
 3993QWidget *QgsProcessingPointWidgetWrapper::createWidget()
 
 4001      mPanel = 
new QgsProcessingPointPanel( 
nullptr );
 
 4002      if ( widgetContext().mapCanvas() )
 
 4003        mPanel->setMapCanvas( widgetContext().mapCanvas() );
 
 4006        mPanel->setAllowNull( 
true );
 
 4009        mPanel->setShowPointOnCanvas( 
true );
 
 4011      mPanel->setToolTip( parameterDefinition()->toolTip() );
 
 4013      connect( mPanel, &QgsProcessingPointPanel::changed, 
this, [
this] {
 
 4014        emit widgetValueHasChanged( 
this );
 
 4018        setDialog( mDialog ); 
 
 4024      mLineEdit = 
new QLineEdit();
 
 4025      mLineEdit->setToolTip( tr( 
"Point as 'x,y'" ) );
 
 4026      connect( mLineEdit, &QLineEdit::textChanged, 
this, [
this]( 
const QString & ) {
 
 4027        emit widgetValueHasChanged( 
this );
 
 4039    mPanel->setMapCanvas( context.
mapCanvas() );
 
 4042void QgsProcessingPointWidgetWrapper::setDialog( QDialog *dialog )
 
 4047    connect( mPanel, &QgsProcessingPointPanel::toggleDialogVisibility, mDialog, [
this]( 
bool visible ) {
 
 4049        mDialog->showMinimized();
 
 4052        mDialog->showNormal();
 
 4054        mDialog->activateWindow();
 
 4061void QgsProcessingPointWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 4065    if ( !value.isValid() || ( value.userType() == QMetaType::Type::QString && value.toString().isEmpty() ) )
 
 4071      mPanel->setValue( p, 
crs );
 
 4074  else if ( mLineEdit )
 
 4077    mLineEdit->setText( v );
 
 4081QVariant QgsProcessingPointWidgetWrapper::widgetValue()
 const 
 4085    return mPanel->value();
 
 4087  else if ( mLineEdit )
 
 4088    return mLineEdit->text().isEmpty() ? QVariant() : mLineEdit->text();
 
 4093QString QgsProcessingPointWidgetWrapper::modelerExpressionFormatString()
 const 
 4095  return tr( 
"string of the format 'x,y' or a geometry value (centroid is used)" );
 
 4098QString QgsProcessingPointWidgetWrapper::parameterType()
 const 
 4105  return new QgsProcessingPointWidgetWrapper( parameter, type );
 
 4110  return new QgsProcessingPointParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 4122  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 4123  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 4125  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 4137  vlayout->addWidget( mGeometryWidget );
 
 4138  setLayout( vlayout );
 
 4144  auto param = std::make_unique<QgsProcessingParameterGeometry>( name, description, geometry.
isEmpty() ? QVariant() : geometry.asWkt() );
 
 4146  return param.release();
 
 4154QWidget *QgsProcessingGeometryWidgetWrapper::createWidget()
 
 4163      mGeometryWidget->setToolTip( parameterDefinition()->toolTip() );
 
 4165        emit widgetValueHasChanged( 
this );
 
 4167      return mGeometryWidget;
 
 4173void QgsProcessingGeometryWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 4175  if ( mGeometryWidget )
 
 4184      mGeometryWidget->clearGeometry();
 
 4189QVariant QgsProcessingGeometryWidgetWrapper::widgetValue()
 const 
 4191  if ( mGeometryWidget )
 
 4194    return geometry.
isEmpty() ? QVariant() : geometry.asWkt();
 
 4202QString QgsProcessingGeometryWidgetWrapper::modelerExpressionFormatString()
 const 
 4204  return tr( 
"string in the Well-Known-Text format or a geometry value" );
 
 4207QString QgsProcessingGeometryWidgetWrapper::parameterType()
 const 
 4214  return new QgsProcessingGeometryWidgetWrapper( parameter, type );
 
 4219  return new QgsProcessingGeometryParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 4231  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 4232  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 4234  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 4237  mDefaultColorButton->setShowNull( 
true );
 
 4238  mAllowOpacity = 
new QCheckBox( tr( 
"Allow opacity control" ) );
 
 4244      mDefaultColorButton->setToNull();
 
 4246      mDefaultColorButton->setColor( 
c );
 
 4247    mAllowOpacity->setChecked( colorParam->opacityEnabled() );
 
 4251    mDefaultColorButton->setToNull();
 
 4252    mAllowOpacity->setChecked( 
true );
 
 4255  vlayout->addWidget( mDefaultColorButton );
 
 4256  vlayout->addWidget( mAllowOpacity );
 
 4257  setLayout( vlayout );
 
 4262  auto param = std::make_unique<QgsProcessingParameterColor>( name, description, mDefaultColorButton->color(), mAllowOpacity->isChecked() );
 
 4264  return param.release();
 
 4272QWidget *QgsProcessingColorWidgetWrapper::createWidget()
 
 4282      mColorButton->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
 
 4285        mColorButton->setShowNull( 
true );
 
 4288      mColorButton->setToolTip( parameterDefinition()->toolTip() );
 
 4289      mColorButton->setColorDialogTitle( parameterDefinition()->description() );
 
 4296        emit widgetValueHasChanged( 
this );
 
 4299      return mColorButton;
 
 4305void QgsProcessingColorWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 4309    if ( !value.isValid() || ( value.userType() == QMetaType::Type::QString && value.toString().isEmpty() )
 
 4310         || ( value.userType() == QMetaType::Type::QColor && !value.value<QColor>().isValid() ) )
 
 4311      mColorButton->setToNull();
 
 4315      if ( !
c.isValid() && mColorButton->showNull() )
 
 4316        mColorButton->setToNull();
 
 4318        mColorButton->setColor( 
c );
 
 4323QVariant QgsProcessingColorWidgetWrapper::widgetValue()
 const 
 4326    return mColorButton->isNull() ? QVariant() : mColorButton->color();
 
 4331QString QgsProcessingColorWidgetWrapper::modelerExpressionFormatString()
 const 
 4333  return tr( 
"color style string, e.g. #ff0000 or 255,0,0" );
 
 4336QString QgsProcessingColorWidgetWrapper::parameterType()
 const 
 4343  return new QgsProcessingColorWidgetWrapper( parameter, type );
 
 4348  return new QgsProcessingColorParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 4359  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 4360  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 4362  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 4364  mDefaultLineEdit = 
new QLineEdit();
 
 4367  vlayout->addWidget( mDefaultLineEdit );
 
 4369  mSourceParamComboBox = 
new QComboBox();
 
 4370  mDestParamComboBox = 
new QComboBox();
 
 4371  QString initialSource;
 
 4372  QString initialDest;
 
 4377    initialSource = itemParam->sourceCrsParameterName();
 
 4378    initialDest = itemParam->destinationCrsParameterName();
 
 4383  mSourceParamComboBox->addItem( QString(), QString() );
 
 4384  mDestParamComboBox->addItem( QString(), QString() );
 
 4385  if ( 
auto *lModel = widgetContext.
model() )
 
 4388    const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
 
 4389    for ( 
auto it = components.constBegin(); it != components.constEnd(); ++it )
 
 4391      if ( definition && it->parameterName() == definition->
name() )
 
 4395      mSourceParamComboBox->addItem( it->parameterName(), it->parameterName() );
 
 4396      mDestParamComboBox->addItem( it->parameterName(), it->parameterName() );
 
 4397      if ( !initialSource.isEmpty() && initialSource == it->parameterName() )
 
 4399        mSourceParamComboBox->setCurrentIndex( mSourceParamComboBox->count() - 1 );
 
 4401      if ( !initialDest.isEmpty() && initialDest == it->parameterName() )
 
 4403        mDestParamComboBox->setCurrentIndex( mDestParamComboBox->count() - 1 );
 
 4408  if ( mSourceParamComboBox->count() == 1 && !initialSource.isEmpty() )
 
 4411    mSourceParamComboBox->addItem( initialSource, initialSource );
 
 4412    mSourceParamComboBox->setCurrentIndex( mSourceParamComboBox->count() - 1 );
 
 4414  if ( mDestParamComboBox->count() == 1 && !initialDest.isEmpty() )
 
 4417    mDestParamComboBox->addItem( initialDest, initialDest );
 
 4418    mDestParamComboBox->setCurrentIndex( mDestParamComboBox->count() - 1 );
 
 4421  vlayout->addWidget( 
new QLabel( tr( 
"Source CRS parameter" ) ) );
 
 4422  vlayout->addWidget( mSourceParamComboBox );
 
 4423  vlayout->addWidget( 
new QLabel( tr( 
"Destination CRS parameter" ) ) );
 
 4424  vlayout->addWidget( mDestParamComboBox );
 
 4428  mStaticSourceWidget->setCrs( sourceCrs );
 
 4431  mStaticDestWidget->setCrs( destCrs );
 
 4433  vlayout->addWidget( 
new QLabel( tr( 
"Static source CRS" ) ) );
 
 4434  vlayout->addWidget( mStaticSourceWidget );
 
 4435  vlayout->addWidget( 
new QLabel( tr( 
"Static destination CRS" ) ) );
 
 4436  vlayout->addWidget( mStaticDestWidget );
 
 4438  setLayout( vlayout );
 
 4443  auto param = std::make_unique<QgsProcessingParameterCoordinateOperation>( name, description, mDefaultLineEdit->text(), mSourceParamComboBox->currentText(), mDestParamComboBox->currentText(), mStaticSourceWidget->crs().isValid() ? QVariant::fromValue( mStaticSourceWidget->crs() ) : QVariant(), mStaticDestWidget->
crs().isValid() ? QVariant::fromValue( mStaticDestWidget->
crs() ) : QVariant() );
 
 4445  return param.release();
 
 4453QWidget *QgsProcessingCoordinateOperationWidgetWrapper::createWidget()
 
 4464      mOperationWidget->setShowMakeDefault( 
false );
 
 4465      mOperationWidget->setShowFallbackOption( 
false );
 
 4466      mOperationWidget->setToolTip( parameterDefinition()->toolTip() );
 
 4467      mOperationWidget->setSourceCrs( mSourceCrs );
 
 4468      mOperationWidget->setDestinationCrs( mDestCrs );
 
 4469      mOperationWidget->setMapCanvas( mCanvas );
 
 4474        mOperationWidget->setSelectedOperation( deets );
 
 4478        emit widgetValueHasChanged( 
this );
 
 4481      return mOperationWidget;
 
 4487      mLineEdit = 
new QLineEdit();
 
 4488      QHBoxLayout *layout = 
new QHBoxLayout();
 
 4489      layout->addWidget( mLineEdit, 1 );
 
 4490      connect( mLineEdit, &QLineEdit::textChanged, 
this, [
this] {
 
 4491        emit widgetValueHasChanged( 
this );
 
 4494      QToolButton *button = 
new QToolButton();
 
 4495      button->setText( QString( QChar( 0x2026 ) ) );
 
 4496      connect( button, &QToolButton::clicked, 
this, [
this, button] {
 
 4497        QgsDatumTransformDialog dlg( mSourceCrs, mDestCrs, 
false, 
false, 
false, qMakePair( -1, -1 ), button, Qt::WindowFlags(), mLineEdit->text(), mCanvas );
 
 4500          mLineEdit->setText( dlg.selectedDatumTransform().proj );
 
 4501          emit widgetValueHasChanged( 
this );
 
 4504      layout->addWidget( button );
 
 4506      QWidget *w = 
new QWidget();
 
 4507      layout->setContentsMargins( 0, 0, 0, 0 );
 
 4508      w->setLayout( layout );
 
 4515void QgsProcessingCoordinateOperationWidgetWrapper::postInitialize( 
const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
 
 4551  if ( mOperationWidget )
 
 4552    mOperationWidget->setMapCanvas( context.
mapCanvas() );
 
 4555void QgsProcessingCoordinateOperationWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext & )
 
 4557  if ( mOperationWidget )
 
 4559    if ( !value.isValid() || ( value.userType() == QMetaType::Type::QString ) )
 
 4562      deets.
proj = value.toString();
 
 4563      mOperationWidget->setSelectedOperation( deets );
 
 4568    if ( !value.isValid() || ( value.userType() == QMetaType::Type::QString ) )
 
 4570      mLineEdit->setText( value.toString() );
 
 4575QVariant QgsProcessingCoordinateOperationWidgetWrapper::widgetValue()
 const 
 4577  if ( mOperationWidget )
 
 4578    return mOperationWidget->selectedOperation().proj;
 
 4579  else if ( mLineEdit )
 
 4580    return mLineEdit->text();
 
 4585QString QgsProcessingCoordinateOperationWidgetWrapper::modelerExpressionFormatString()
 const 
 4587  return tr( 
"Proj coordinate operation string, e.g. '+proj=pipeline +step +inv...'" );
 
 4590void QgsProcessingCoordinateOperationWidgetWrapper::setSourceCrsParameterValue( 
const QVariant &value )
 
 4593  std::unique_ptr<QgsProcessingContext> tmpContext;
 
 4594  if ( mProcessingContextGenerator )
 
 4595    context = mProcessingContextGenerator->processingContext();
 
 4599    tmpContext = std::make_unique<QgsProcessingContext>();
 
 4600    context = tmpContext.get();
 
 4604  if ( mOperationWidget )
 
 4606    mOperationWidget->setSourceCrs( mSourceCrs );
 
 4607    mOperationWidget->setSelectedOperationUsingContext( context->
transformContext() );
 
 4611void QgsProcessingCoordinateOperationWidgetWrapper::setDestinationCrsParameterValue( 
const QVariant &value )
 
 4614  std::unique_ptr<QgsProcessingContext> tmpContext;
 
 4615  if ( mProcessingContextGenerator )
 
 4616    context = mProcessingContextGenerator->processingContext();
 
 4620    tmpContext = std::make_unique<QgsProcessingContext>();
 
 4621    context = tmpContext.get();
 
 4625  if ( mOperationWidget )
 
 4627    mOperationWidget->setDestinationCrs( mDestCrs );
 
 4628    mOperationWidget->setSelectedOperationUsingContext( context->
transformContext() );
 
 4632QString QgsProcessingCoordinateOperationWidgetWrapper::parameterType()
 const 
 4639  return new QgsProcessingCoordinateOperationWidgetWrapper( parameter, type );
 
 4644  return new QgsProcessingCoordinateOperationParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 4656  QHBoxLayout *hl = 
new QHBoxLayout();
 
 4657  hl->setContentsMargins( 0, 0, 0, 0 );
 
 4659  mLineEdit = 
new QLineEdit();
 
 4660  mLineEdit->setEnabled( 
false );
 
 4661  hl->addWidget( mLineEdit, 1 );
 
 4663  mToolButton = 
new QToolButton();
 
 4664  mToolButton->setText( QString( QChar( 0x2026 ) ) );
 
 4665  hl->addWidget( mToolButton );
 
 4671    mLineEdit->setText( tr( 
"%n field(s) selected", 
nullptr, 0 ) );
 
 4674  connect( mToolButton, &QToolButton::clicked, 
this, &QgsProcessingFieldPanelWidget::showDialog );
 
 4677void QgsProcessingFieldPanelWidget::setFields( 
const QgsFields &fields )
 
 4683  QVariantList availableFields;
 
 4684  for ( 
const QgsField &field : std::as_const( mFields ) )
 
 4686    availableFields << field.name();
 
 4688  QList<QVariant>::iterator it = std::remove_if( mValue.begin(), mValue.end(), [&availableFields]( 
const QVariant &value ) { return !availableFields.contains( value ); } );
 
 4689  mValue.erase( it, mValue.end() );
 
 4691  updateSummaryText();
 
 4695void QgsProcessingFieldPanelWidget::setValue( 
const QVariant &value )
 
 4697  if ( value.isValid() )
 
 4698    mValue = value.userType() == QMetaType::Type::QVariantList ? value.toList() : QVariantList() << value;
 
 4702  updateSummaryText();
 
 4706void QgsProcessingFieldPanelWidget::showDialog()
 
 4708  QVariantList availableOptions;
 
 4709  availableOptions.reserve( mFields.size() );
 
 4710  for ( 
const QgsField &field : std::as_const( mFields ) )
 
 4712    availableOptions << field.name();
 
 4718    QgsProcessingMultipleSelectionPanelWidget *widget = 
new QgsProcessingMultipleSelectionPanelWidget( availableOptions, mValue );
 
 4719    widget->setPanelTitle( mParam->description() );
 
 4721    widget->setValueFormatter( []( 
const QVariant &v ) -> QString {
 
 4722      return v.toString();
 
 4725    connect( widget, &QgsProcessingMultipleSelectionPanelWidget::selectionChanged, 
this, [
this, widget]() {
 
 4726      setValue( widget->selectedOptions() );
 
 4733    QgsProcessingMultipleSelectionDialog dlg( availableOptions, mValue, 
this, Qt::WindowFlags() );
 
 4735    dlg.setValueFormatter( []( 
const QVariant &v ) -> QString {
 
 4736      return v.toString();
 
 4740      setValue( dlg.selectedOptions() );
 
 4745void QgsProcessingFieldPanelWidget::updateSummaryText()
 
 4750  if ( mValue.empty() )
 
 4752    mLineEdit->setText( tr( 
"%n field(s) selected", 
nullptr, 0 ) );
 
 4757    values.reserve( mValue.size() );
 
 4758    for ( 
const QVariant &val : std::as_const( mValue ) )
 
 4760      values << val.toString();
 
 4763    const QString concatenated = values.join( tr( 
"," ) );
 
 4764    if ( concatenated.length() < 100 )
 
 4765      mLineEdit->setText( concatenated );
 
 4767      mLineEdit->setText( tr( 
"%n field(s) selected", 
nullptr, mValue.count() ) );
 
 4779  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 4780  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 4782  vlayout->addWidget( 
new QLabel( tr( 
"Parent layer" ) ) );
 
 4783  mParentLayerComboBox = 
new QComboBox();
 
 4785  QString initialParent;
 
 4787    initialParent = fieldParam->parentLayerParameterName();
 
 4789  if ( 
auto *lModel = widgetContext.
model() )
 
 4792    const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
 
 4793    for ( 
auto it = components.constBegin(); it != components.constEnd(); ++it )
 
 4797        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 4798        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 4800          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 4805        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 4806        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 4808          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 4815          mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 4816          if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 4818            mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 4825  if ( mParentLayerComboBox->count() == 0 && !initialParent.isEmpty() )
 
 4828    mParentLayerComboBox->addItem( initialParent, initialParent );
 
 4829    mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 4832  vlayout->addWidget( mParentLayerComboBox );
 
 4834  vlayout->addWidget( 
new QLabel( tr( 
"Allowed data type" ) ) );
 
 4835  mDataTypeComboBox = 
new QComboBox();
 
 4843    mDataTypeComboBox->setCurrentIndex( mDataTypeComboBox->findData( 
static_cast<int>( fieldParam->dataType() ) ) );
 
 4845  vlayout->addWidget( mDataTypeComboBox );
 
 4847  mAllowMultipleCheckBox = 
new QCheckBox( tr( 
"Accept multiple fields" ) );
 
 4849    mAllowMultipleCheckBox->setChecked( fieldParam->allowMultiple() );
 
 4851  vlayout->addWidget( mAllowMultipleCheckBox );
 
 4853  mDefaultToAllCheckBox = 
new QCheckBox( tr( 
"Select all fields by default" ) );
 
 4854  mDefaultToAllCheckBox->setEnabled( mAllowMultipleCheckBox->isChecked() );
 
 4856    mDefaultToAllCheckBox->setChecked( fieldParam->defaultToAllFields() );
 
 4858  vlayout->addWidget( mDefaultToAllCheckBox );
 
 4860  connect( mAllowMultipleCheckBox, &QCheckBox::stateChanged, 
this, [
this] {
 
 4861    mDefaultToAllCheckBox->setEnabled( mAllowMultipleCheckBox->isChecked() );
 
 4864  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 4866  mDefaultLineEdit = 
new QLineEdit();
 
 4867  mDefaultLineEdit->setToolTip( tr( 
"Default field name, or ; separated list of field names for multiple field parameters" ) );
 
 4871    mDefaultLineEdit->setText( fields.join( 
';' ) );
 
 4873  vlayout->addWidget( mDefaultLineEdit );
 
 4875  setLayout( vlayout );
 
 4882  QVariant defaultValue;
 
 4883  if ( !mDefaultLineEdit->text().trimmed().isEmpty() )
 
 4885    defaultValue = mDefaultLineEdit->text();
 
 4887  auto param = std::make_unique<QgsProcessingParameterField>( name, description, defaultValue, mParentLayerComboBox->currentData().toString(), dataType, mAllowMultipleCheckBox->isChecked(), 
false, mDefaultToAllCheckBox->isChecked() );
 
 4889  return param.release();
 
 4897QWidget *QgsProcessingFieldWidgetWrapper::createWidget()
 
 4907        mPanel = 
new QgsProcessingFieldPanelWidget( 
nullptr, fieldParam );
 
 4908        mPanel->setToolTip( parameterDefinition()->toolTip() );
 
 4909        connect( mPanel, &QgsProcessingFieldPanelWidget::changed, 
this, [
this] {
 
 4910          emit widgetValueHasChanged( 
this );
 
 4930        mComboBox->setToolTip( parameterDefinition()->toolTip() );
 
 4932          emit widgetValueHasChanged( 
this );
 
 4940      mLineEdit = 
new QLineEdit();
 
 4941      mLineEdit->setToolTip( QObject::tr( 
"Name of field (separate field names with ; for multiple field parameters)" ) );
 
 4942      connect( mLineEdit, &QLineEdit::textChanged, 
this, [
this] {
 
 4943        emit widgetValueHasChanged( 
this );
 
 4951void QgsProcessingFieldWidgetWrapper::postInitialize( 
const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
 
 4963          setParentLayerWrapperValue( wrapper );
 
 4965            setParentLayerWrapperValue( wrapper );
 
 4982  std::unique_ptr<QgsProcessingContext> tmpContext;
 
 4983  if ( mProcessingContextGenerator )
 
 4984    context = mProcessingContextGenerator->processingContext();
 
 4988    tmpContext = std::make_unique<QgsProcessingContext>();
 
 4989    context = tmpContext.get();
 
 4994  if ( value.userType() == qMetaTypeId<QgsProcessingFeatureSourceDefinition>() )
 
 5004  bool valueSet = 
false;
 
 5008  if ( layers.count() > 1 )
 
 5010    QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layers.at( 0 ) );
 
 5012    const QList<QgsMapLayer *> remainingLayers = layers.mid( 1 );
 
 5018      QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
 
 5019      if ( !vlayer || !vlayer->
isValid() )
 
 5025      for ( 
int fieldIdx = fields.
count() - 1; fieldIdx >= 0; fieldIdx-- )
 
 5028          fields.
remove( fieldIdx );
 
 5033      mComboBox->setFields( fields );
 
 5035      mPanel->setFields( filterFields( fields ) );
 
 5041  if ( !valueSet && !layers.isEmpty() && layers.at( 0 )->isValid() )
 
 5043    QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( layers.at( 0 ) );
 
 5047    std::unique_ptr<QgsMapLayer> ownedLayer( context->
takeResultLayer( layer->
id() ) );
 
 5050      mParentLayer.reset( qobject_cast<QgsVectorLayer *>( ownedLayer.release() ) );
 
 5051      layer = mParentLayer.get();
 
 5059      mComboBox->setLayer( layer );
 
 5061      mPanel->setFields( filterFields( layer->
fields() ) );
 
 5071      const QgsFields fields = source->fields();
 
 5073        mComboBox->setFields( fields );
 
 5075        mPanel->setFields( filterFields( fields ) );
 
 5084      mComboBox->setLayer( 
nullptr );
 
 5088    if ( value.isValid() && widgetContext().messageBar() )
 
 5100    val.reserve( mPanel->fields().size() );
 
 5101    for ( 
const QgsField &field : mPanel->fields() )
 
 5102      val << field.name();
 
 5103    setWidgetValue( val, *context );
 
 5106    setWidgetValue( parameterDefinition()->defaultValueForGui(), *context );
 
 5109void QgsProcessingFieldWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 5113    if ( !value.isValid() )
 
 5114      mComboBox->setField( QString() );
 
 5118      mComboBox->setField( v );
 
 5124    if ( value.isValid() )
 
 5127      opts.reserve( v.size() );
 
 5128      for ( 
const QString &i : v )
 
 5132      mPanel->setValue( opts );
 
 5134  else if ( mLineEdit )
 
 5140      mLineEdit->setText( v.join( 
';' ) );
 
 5149QVariant QgsProcessingFieldWidgetWrapper::widgetValue()
 const 
 5152    return mComboBox->currentField();
 
 5154    return mPanel->value();
 
 5155  else if ( mLineEdit )
 
 5160      return mLineEdit->text().split( 
';' );
 
 5163      return mLineEdit->text();
 
 5169QString QgsProcessingFieldWidgetWrapper::modelerExpressionFormatString()
 const 
 5171  return tr( 
"selected field names as an array of names, or semicolon separated string of options (e.g. 'fid;place_name')" );
 
 5174const QgsVectorLayer *QgsProcessingFieldWidgetWrapper::linkedVectorLayer()
 const 
 5176  if ( mComboBox && mComboBox->layer() )
 
 5177    return mComboBox->layer();
 
 5182QgsFields QgsProcessingFieldWidgetWrapper::filterFields( 
const QgsFields &fields )
 const 
 5195        if ( f.isNumeric() )
 
 5200        if ( f.type() == QMetaType::Type::QString )
 
 5205        if ( f.type() == QMetaType::Type::QDate || f.type() == QMetaType::Type::QTime || f.type() == QMetaType::Type::QDateTime )
 
 5210        if ( f.type() == QMetaType::Type::QByteArray )
 
 5215        if ( f.type() == QMetaType::Type::Bool )
 
 5224QString QgsProcessingFieldWidgetWrapper::parameterType()
 const 
 5231  return new QgsProcessingFieldWidgetWrapper( parameter, type );
 
 5236  return new QgsProcessingFieldParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 5247  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 5248  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 5250  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 5252  mDefaultComboBox = 
new QComboBox();
 
 5253  mDefaultComboBox->addItem( QString(), QVariant( -1 ) );
 
 5256  for ( 
const QString &theme : mapThemes )
 
 5260  mDefaultComboBox->setEditable( 
true );
 
 5264    if ( themeParam->defaultValueForGui().isValid() )
 
 5267      mDefaultComboBox->setCurrentIndex( mDefaultComboBox->findData( -1 ) );
 
 5270    mDefaultComboBox->setCurrentIndex( mDefaultComboBox->findData( -1 ) );
 
 5272  vlayout->addWidget( mDefaultComboBox );
 
 5274  setLayout( vlayout );
 
 5279  QVariant defaultVal;
 
 5280  if ( mDefaultComboBox->currentText().isEmpty() )
 
 5281    defaultVal = QVariant();
 
 5283    defaultVal = mDefaultComboBox->currentText();
 
 5284  auto param = std::make_unique<QgsProcessingParameterMapTheme>( name, description, defaultVal );
 
 5286  return param.release();
 
 5295QWidget *QgsProcessingMapThemeWidgetWrapper::createWidget()
 
 5299  mComboBox = 
new QComboBox();
 
 5302    mComboBox->addItem( tr( 
"[Not selected]" ), QVariant( -1 ) );
 
 5305  for ( 
const QString &theme : mapThemes )
 
 5317      mComboBox->setEditable( 
true );
 
 5321  mComboBox->setToolTip( parameterDefinition()->toolTip() );
 
 5322  connect( mComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), 
this, [
this]( 
int ) {
 
 5323    emit widgetValueHasChanged( 
this );
 
 5329void QgsProcessingMapThemeWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 5333  if ( !value.isValid() )
 
 5334    mComboBox->setCurrentIndex( mComboBox->findData( QVariant( -1 ) ) );
 
 5337    if ( mComboBox->isEditable() && mComboBox->findData( v ) == -1 )
 
 5339      const QString prev = mComboBox->currentText();
 
 5340      mComboBox->setCurrentText( v );
 
 5342        emit widgetValueHasChanged( 
this );
 
 5345      mComboBox->setCurrentIndex( mComboBox->findData( v ) );
 
 5349QVariant QgsProcessingMapThemeWidgetWrapper::widgetValue()
 const 
 5352    return mComboBox->currentData().toInt() == -1 ? QVariant() : !mComboBox->currentData().isValid() && mComboBox->isEditable() ? mComboBox->currentText().isEmpty() ? QVariant() : QVariant( mComboBox->currentText() )
 
 5353                                                                                                                                : mComboBox->currentData();
 
 5358QString QgsProcessingMapThemeWidgetWrapper::modelerExpressionFormatString()
 const 
 5360  return tr( 
"map theme as a string value (e.g. 'base maps')" );
 
 5363QString QgsProcessingMapThemeWidgetWrapper::parameterType()
 const 
 5370  return new QgsProcessingMapThemeWidgetWrapper( parameter, type );
 
 5375  return new QgsProcessingMapThemeParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 5387  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 5388  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 5390  vlayout->addWidget( 
new QLabel( tr( 
"Type" ) ) );
 
 5392  mTypeComboBox = 
new QComboBox();
 
 5397    mTypeComboBox->setCurrentIndex( mTypeComboBox->findData( 
static_cast<int>( datetimeParam->dataType() ) ) );
 
 5399    mTypeComboBox->setCurrentIndex( 0 );
 
 5400  vlayout->addWidget( mTypeComboBox );
 
 5402  setLayout( vlayout );
 
 5407  auto param = std::make_unique<QgsProcessingParameterDateTime>( name, description );
 
 5410  return param.release();
 
 5419QWidget *QgsProcessingDateTimeWidgetWrapper::createWidget()
 
 5424  switch ( dateTimeParam->
dataType() )
 
 5428      widget = mDateTimeEdit;
 
 5451  widget->setToolTip( parameterDefinition()->toolTip() );
 
 5453  if ( mDateTimeEdit )
 
 5456      emit widgetValueHasChanged( 
this );
 
 5459  else if ( mDateEdit )
 
 5462      emit widgetValueHasChanged( 
this );
 
 5465  else if ( mTimeEdit )
 
 5468      emit widgetValueHasChanged( 
this );
 
 5477  return new QgsProcessingDateTimeParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 5480void QgsProcessingDateTimeWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 5482  if ( mDateTimeEdit )
 
 5486  else if ( mDateEdit )
 
 5490  else if ( mTimeEdit )
 
 5496QVariant QgsProcessingDateTimeWidgetWrapper::widgetValue()
 const 
 5498  if ( mDateTimeEdit )
 
 5499    return !mDateTimeEdit->dateTime().isNull() && mDateTimeEdit->dateTime().isValid() ? QVariant( mDateTimeEdit->dateTime() ) : QVariant();
 
 5500  else if ( mDateEdit )
 
 5501    return !mDateEdit->date().isNull() && mDateEdit->date().isValid() ? QVariant( mDateEdit->date() ) : QVariant();
 
 5502  else if ( mTimeEdit )
 
 5503    return !mTimeEdit->time().isNull() && mTimeEdit->time().isValid() ? QVariant( mTimeEdit->time() ) : QVariant();
 
 5508QString QgsProcessingDateTimeWidgetWrapper::modelerExpressionFormatString()
 const 
 5511  if ( dateTimeParam )
 
 5513    switch ( dateTimeParam->
dataType() )
 
 5516        return tr( 
"datetime value, or a ISO string representation of a datetime" );
 
 5519        return tr( 
"date value, or a ISO string representation of a date" );
 
 5522        return tr( 
"time value, or a ISO string representation of a time" );
 
 5528QString QgsProcessingDateTimeWidgetWrapper::parameterType()
 const 
 5535  return new QgsProcessingDateTimeWidgetWrapper( parameter, type );
 
 5548  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 5549  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 5551  vlayout->addWidget( 
new QLabel( tr( 
"Provider" ) ) );
 
 5552  mProviderComboBox = 
new QComboBox();
 
 5553  mProviderComboBox->addItem( QObject::tr( 
"Postgres" ), QStringLiteral( 
"postgres" ) );
 
 5554  mProviderComboBox->addItem( QObject::tr( 
"GeoPackage" ), QStringLiteral( 
"ogr" ) );
 
 5555  mProviderComboBox->addItem( QObject::tr( 
"Spatialite" ), QStringLiteral( 
"spatialite" ) );
 
 5557  vlayout->addWidget( mProviderComboBox );
 
 5559  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 5561  mDefaultEdit = 
new QLineEdit();
 
 5562  vlayout->addWidget( mDefaultEdit );
 
 5563  setLayout( vlayout );
 
 5565  if ( connectionParam )
 
 5567    mProviderComboBox->setCurrentIndex( mProviderComboBox->findData( connectionParam->
providerId() ) );
 
 5574  QVariant defaultVal;
 
 5575  if ( mDefaultEdit->text().isEmpty() )
 
 5576    defaultVal = QVariant();
 
 5578    defaultVal = mDefaultEdit->text();
 
 5579  auto param = std::make_unique<QgsProcessingParameterProviderConnection>( name, description, mProviderComboBox->currentData().toString(), defaultVal );
 
 5581  return param.release();
 
 5590QWidget *QgsProcessingProviderConnectionWidgetWrapper::createWidget()
 
 5596    mProviderComboBox->setAllowEmptyConnection( 
true );
 
 5604      mProviderComboBox->setEditable( 
true );
 
 5608  mProviderComboBox->setToolTip( parameterDefinition()->toolTip() );
 
 5609  connect( mProviderComboBox, &QgsProviderConnectionComboBox::currentTextChanged, 
this, [
this]( 
const QString & ) {
 
 5610    if ( mBlockSignals )
 
 5613    emit widgetValueHasChanged( 
this );
 
 5616  return mProviderComboBox;
 
 5621  return new QgsProcessingProviderConnectionParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 5624void QgsProcessingProviderConnectionWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 5628  if ( !value.isValid() )
 
 5629    mProviderComboBox->setCurrentIndex( -1 );
 
 5632    if ( mProviderComboBox->isEditable() )
 
 5634      const QString prev = mProviderComboBox->currentText();
 
 5636      mProviderComboBox->setConnection( v );
 
 5637      mProviderComboBox->setCurrentText( v );
 
 5641        emit widgetValueHasChanged( 
this );
 
 5644      mProviderComboBox->setConnection( v );
 
 5648QVariant QgsProcessingProviderConnectionWidgetWrapper::widgetValue()
 const 
 5650  if ( mProviderComboBox )
 
 5651    if ( mProviderComboBox->isEditable() )
 
 5652      return mProviderComboBox->currentText().isEmpty() ? QVariant() : QVariant( mProviderComboBox->currentText() );
 
 5654      return mProviderComboBox->currentConnection().isEmpty() ? QVariant() : QVariant( mProviderComboBox->currentConnection() );
 
 5659QString QgsProcessingProviderConnectionWidgetWrapper::modelerExpressionFormatString()
 const 
 5661  return tr( 
"connection name as a string value" );
 
 5664QString QgsProcessingProviderConnectionWidgetWrapper::parameterType()
 const 
 5671  return new QgsProcessingProviderConnectionWidgetWrapper( parameter, type );
 
 5684  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 5685  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 5687  mConnectionParamComboBox = 
new QComboBox();
 
 5688  QString initialConnection;
 
 5694  if ( 
auto *lModel = widgetContext.
model() )
 
 5697    const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
 
 5698    for ( 
auto it = components.constBegin(); it != components.constEnd(); ++it )
 
 5700      if ( definition && it->parameterName() == definition->
name() )
 
 5706      mConnectionParamComboBox->addItem( it->parameterName(), it->parameterName() );
 
 5707      if ( !initialConnection.isEmpty() && initialConnection == it->parameterName() )
 
 5709        mConnectionParamComboBox->setCurrentIndex( mConnectionParamComboBox->count() - 1 );
 
 5714  if ( mConnectionParamComboBox->count() == 0 && !initialConnection.isEmpty() )
 
 5717    mConnectionParamComboBox->addItem( initialConnection, initialConnection );
 
 5718    mConnectionParamComboBox->setCurrentIndex( mConnectionParamComboBox->count() - 1 );
 
 5721  vlayout->addWidget( 
new QLabel( tr( 
"Provider connection parameter" ) ) );
 
 5722  vlayout->addWidget( mConnectionParamComboBox );
 
 5724  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 5726  mDefaultEdit = 
new QLineEdit();
 
 5727  vlayout->addWidget( mDefaultEdit );
 
 5728  setLayout( vlayout );
 
 5738  QVariant defaultVal;
 
 5739  if ( mDefaultEdit->text().isEmpty() )
 
 5740    defaultVal = QVariant();
 
 5742    defaultVal = mDefaultEdit->text();
 
 5743  auto param = std::make_unique<QgsProcessingParameterDatabaseSchema>( name, description, mConnectionParamComboBox->currentData().toString(), defaultVal );
 
 5745  return param.release();
 
 5754QWidget *QgsProcessingDatabaseSchemaWidgetWrapper::createWidget()
 
 5760    mSchemaComboBox->setAllowEmptySchema( 
true );
 
 5768      mSchemaComboBox->comboBox()->setEditable( 
true );
 
 5772  mSchemaComboBox->setToolTip( parameterDefinition()->toolTip() );
 
 5773  connect( mSchemaComboBox->comboBox(), &QComboBox::currentTextChanged, 
this, [
this]( 
const QString & ) {
 
 5774    if ( mBlockSignals )
 
 5777    emit widgetValueHasChanged( this );
 
 5780  return mSchemaComboBox;
 
 5785  return new QgsProcessingDatabaseSchemaParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 5792  std::unique_ptr<QgsProcessingContext> tmpContext;
 
 5793  if ( mProcessingContextGenerator )
 
 5794    context = mProcessingContextGenerator->processingContext();
 
 5798    tmpContext = std::make_unique<QgsProcessingContext>();
 
 5799    context = tmpContext.get();
 
 5805  if ( mSchemaComboBox )
 
 5806    mSchemaComboBox->setConnectionName( connection, qgis::down_cast<const QgsProcessingParameterProviderConnection *>( parentWrapper->
parameterDefinition() )->providerId() );
 
 5810    setWidgetValue( parameterDefinition()->defaultValueForGui(), *context );
 
 5813void QgsProcessingDatabaseSchemaWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 5817  if ( !value.isValid() )
 
 5818    mSchemaComboBox->comboBox()->setCurrentIndex( -1 );
 
 5821    if ( mSchemaComboBox->comboBox()->isEditable() )
 
 5823      const QString prev = mSchemaComboBox->comboBox()->currentText();
 
 5825      mSchemaComboBox->setSchema( v );
 
 5826      mSchemaComboBox->comboBox()->setCurrentText( v );
 
 5830        emit widgetValueHasChanged( 
this );
 
 5833      mSchemaComboBox->setSchema( v );
 
 5837QVariant QgsProcessingDatabaseSchemaWidgetWrapper::widgetValue()
 const 
 5839  if ( mSchemaComboBox )
 
 5840    if ( mSchemaComboBox->comboBox()->isEditable() )
 
 5841      return mSchemaComboBox->comboBox()->currentText().isEmpty() ? QVariant() : QVariant( mSchemaComboBox->comboBox()->currentText() );
 
 5843      return mSchemaComboBox->currentSchema().isEmpty() ? QVariant() : QVariant( mSchemaComboBox->currentSchema() );
 
 5848QString QgsProcessingDatabaseSchemaWidgetWrapper::modelerExpressionFormatString()
 const 
 5850  return tr( 
"database schema name as a string value" );
 
 5853QString QgsProcessingDatabaseSchemaWidgetWrapper::parameterType()
 const 
 5860  return new QgsProcessingDatabaseSchemaWidgetWrapper( parameter, type );
 
 5863void QgsProcessingDatabaseSchemaWidgetWrapper::postInitialize( 
const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
 
 5875          setParentConnectionWrapperValue( wrapper );
 
 5877            setParentConnectionWrapperValue( wrapper );
 
 5900  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 5901  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 5903  mConnectionParamComboBox = 
new QComboBox();
 
 5904  mSchemaParamComboBox = 
new QComboBox();
 
 5905  QString initialConnection;
 
 5906  QString initialSchema;
 
 5913  if ( 
auto *lModel = widgetContext.
model() )
 
 5916    const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
 
 5917    for ( 
auto it = components.constBegin(); it != components.constEnd(); ++it )
 
 5919      if ( definition && it->parameterName() == definition->
name() )
 
 5924        mConnectionParamComboBox->addItem( it->parameterName(), it->parameterName() );
 
 5925        if ( !initialConnection.isEmpty() && initialConnection == it->parameterName() )
 
 5927          mConnectionParamComboBox->setCurrentIndex( mConnectionParamComboBox->count() - 1 );
 
 5932        mSchemaParamComboBox->addItem( it->parameterName(), it->parameterName() );
 
 5933        if ( !initialConnection.isEmpty() && initialConnection == it->parameterName() )
 
 5935          mSchemaParamComboBox->setCurrentIndex( mSchemaParamComboBox->count() - 1 );
 
 5941  if ( mConnectionParamComboBox->count() == 0 && !initialConnection.isEmpty() )
 
 5944    mConnectionParamComboBox->addItem( initialConnection, initialConnection );
 
 5945    mConnectionParamComboBox->setCurrentIndex( mConnectionParamComboBox->count() - 1 );
 
 5948  if ( mSchemaParamComboBox->count() == 0 && !initialSchema.isEmpty() )
 
 5951    mSchemaParamComboBox->addItem( initialSchema, initialSchema );
 
 5952    mSchemaParamComboBox->setCurrentIndex( mSchemaParamComboBox->count() - 1 );
 
 5955  vlayout->addWidget( 
new QLabel( tr( 
"Provider connection parameter" ) ) );
 
 5956  vlayout->addWidget( mConnectionParamComboBox );
 
 5958  vlayout->addWidget( 
new QLabel( tr( 
"Database schema parameter" ) ) );
 
 5959  vlayout->addWidget( mSchemaParamComboBox );
 
 5961  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 5963  mDefaultEdit = 
new QLineEdit();
 
 5964  vlayout->addWidget( mDefaultEdit );
 
 5965  setLayout( vlayout );
 
 5975  QVariant defaultVal;
 
 5976  if ( mDefaultEdit->text().isEmpty() )
 
 5977    defaultVal = QVariant();
 
 5979    defaultVal = mDefaultEdit->text();
 
 5980  auto param = std::make_unique<QgsProcessingParameterDatabaseTable>( name, description, mConnectionParamComboBox->currentData().toString(), mSchemaParamComboBox->currentData().toString(), defaultVal );
 
 5982  return param.release();
 
 5991QWidget *QgsProcessingDatabaseTableWidgetWrapper::createWidget()
 
 5997    mTableComboBox->setAllowEmptyTable( 
true );
 
 6000    mTableComboBox->comboBox()->setEditable( 
true );
 
 6002  mTableComboBox->setToolTip( parameterDefinition()->toolTip() );
 
 6003  connect( mTableComboBox->comboBox(), &QComboBox::currentTextChanged, 
this, [
this]( 
const QString & ) {
 
 6004    if ( mBlockSignals )
 
 6007    emit widgetValueHasChanged( this );
 
 6010  return mTableComboBox;
 
 6015  return new QgsProcessingDatabaseTableParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 6022  std::unique_ptr<QgsProcessingContext> tmpContext;
 
 6023  if ( mProcessingContextGenerator )
 
 6024    context = mProcessingContextGenerator->processingContext();
 
 6028    tmpContext = std::make_unique<QgsProcessingContext>();
 
 6029    context = tmpContext.get();
 
 6034  mProvider = qgis::down_cast<const QgsProcessingParameterProviderConnection *>( parentWrapper->
parameterDefinition() )->providerId();
 
 6035  if ( mTableComboBox && !mSchema.isEmpty() )
 
 6037    mTableComboBox->setSchema( mSchema );
 
 6038    mTableComboBox->setConnectionName( mConnection, mProvider );
 
 6042      setWidgetValue( parameterDefinition()->defaultValueForGui(), *context );
 
 6050  std::unique_ptr<QgsProcessingContext> tmpContext;
 
 6051  if ( mProcessingContextGenerator )
 
 6052    context = mProcessingContextGenerator->processingContext();
 
 6056    tmpContext = std::make_unique<QgsProcessingContext>();
 
 6057    context = tmpContext.get();
 
 6063  if ( mTableComboBox && !mSchema.isEmpty() && !mConnection.isEmpty() )
 
 6065    mTableComboBox->setSchema( mSchema );
 
 6066    mTableComboBox->setConnectionName( mConnection, mProvider );
 
 6070      setWidgetValue( parameterDefinition()->defaultValueForGui(), *context );
 
 6074void QgsProcessingDatabaseTableWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 6078  if ( !value.isValid() )
 
 6079    mTableComboBox->comboBox()->setCurrentIndex( -1 );
 
 6082    if ( mTableComboBox->comboBox()->isEditable() )
 
 6084      const QString prev = mTableComboBox->comboBox()->currentText();
 
 6086      mTableComboBox->setTable( v );
 
 6087      mTableComboBox->comboBox()->setCurrentText( v );
 
 6091        emit widgetValueHasChanged( 
this );
 
 6094      mTableComboBox->setTable( v );
 
 6098QVariant QgsProcessingDatabaseTableWidgetWrapper::widgetValue()
 const 
 6100  if ( mTableComboBox )
 
 6101    if ( mTableComboBox->comboBox()->isEditable() )
 
 6102      return mTableComboBox->comboBox()->currentText().isEmpty() ? QVariant() : QVariant( mTableComboBox->comboBox()->currentText() );
 
 6104      return mTableComboBox->currentTable().isEmpty() ? QVariant() : QVariant( mTableComboBox->currentTable() );
 
 6109QString QgsProcessingDatabaseTableWidgetWrapper::modelerExpressionFormatString()
 const 
 6111  return tr( 
"database table name as a string value" );
 
 6114QString QgsProcessingDatabaseTableWidgetWrapper::parameterType()
 const 
 6121  return new QgsProcessingDatabaseTableWidgetWrapper( parameter, type );
 
 6124void QgsProcessingDatabaseTableWidgetWrapper::postInitialize( 
const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
 
 6136          setParentConnectionWrapperValue( wrapper );
 
 6138            setParentConnectionWrapperValue( wrapper );
 
 6143          setParentSchemaWrapperValue( wrapper );
 
 6145            setParentSchemaWrapperValue( wrapper );
 
 6165  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 6166  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 6168  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 6171  mDefaultWidget->setNullValueAllowed( 
true, tr( 
"Not set" ) );
 
 6174    if ( extentParam->defaultValueForGui().isValid() )
 
 6178      mDefaultWidget->setCurrentExtent( rect, 
crs );
 
 6179      mDefaultWidget->setOutputExtentFromCurrent();
 
 6183      mDefaultWidget->clear();
 
 6187  vlayout->addWidget( mDefaultWidget );
 
 6188  setLayout( vlayout );
 
 6193  const QString defaultVal = mDefaultWidget->isValid() ? QStringLiteral( 
"%1,%2,%3,%4%5" ).arg( QString::number( mDefaultWidget->outputExtent().xMinimum(), 
'f', 9 ), QString::number( mDefaultWidget->outputExtent().xMaximum(), 
'f', 9 ), QString::number( mDefaultWidget->outputExtent().yMinimum(), 
'f', 9 ), QString::number( mDefaultWidget->outputExtent().yMaximum(), 
'f', 9 ), mDefaultWidget->outputCrs().isValid() ? QStringLiteral( 
" [%1]" ).arg( mDefaultWidget->outputCrs().authid() ) : QString() ) : QString();
 
 6194  auto param = std::make_unique<QgsProcessingParameterExtent>( name, description, !defaultVal.isEmpty() ? QVariant( defaultVal ) : QVariant() );
 
 6196  return param.release();
 
 6205QWidget *QgsProcessingExtentWidgetWrapper::createWidget()
 
 6215      if ( widgetContext().mapCanvas() )
 
 6216        mExtentWidget->setMapCanvas( widgetContext().mapCanvas() );
 
 6219        mExtentWidget->setNullValueAllowed( 
true, tr( 
"Not set" ) );
 
 6221      mExtentWidget->setToolTip( parameterDefinition()->toolTip() );
 
 6224        emit widgetValueHasChanged( 
this );
 
 6228        setDialog( mDialog ); 
 
 6230      return mExtentWidget;
 
 6240    mExtentWidget->setMapCanvas( context.
mapCanvas() );
 
 6243void QgsProcessingExtentWidgetWrapper::setDialog( QDialog *dialog )
 
 6250        mDialog->showMinimized();
 
 6253        mDialog->showNormal();
 
 6255        mDialog->activateWindow();
 
 6262void QgsProcessingExtentWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 6264  if ( mExtentWidget )
 
 6266    if ( !value.isValid() || ( value.userType() == QMetaType::Type::QString && value.toString().isEmpty() ) )
 
 6267      mExtentWidget->clear();
 
 6272      mExtentWidget->setCurrentExtent( r, 
crs );
 
 6273      mExtentWidget->setOutputExtentFromUser( r, 
crs );
 
 6278QVariant QgsProcessingExtentWidgetWrapper::widgetValue()
 const 
 6280  if ( mExtentWidget )
 
 6282    const QString val = mExtentWidget->isValid() ? QStringLiteral( 
"%1,%2,%3,%4%5" ).arg( QString::number( mExtentWidget->outputExtent().xMinimum(), 
'f', 9 ), QString::number( mExtentWidget->outputExtent().xMaximum(), 
'f', 9 ), QString::number( mExtentWidget->outputExtent().yMinimum(), 
'f', 9 ), QString::number( mExtentWidget->outputExtent().yMaximum(), 
'f', 9 ), mExtentWidget->outputCrs().isValid() ? QStringLiteral( 
" [%1]" ).arg( mExtentWidget->outputCrs().authid() ) : QString() ) : QString();
 
 6284    return val.isEmpty() ? QVariant() : QVariant( val );
 
 6290QString QgsProcessingExtentWidgetWrapper::modelerExpressionFormatString()
 const 
 6292  return tr( 
"string of the format 'x min,x max,y min,y max' or a geometry value (bounding box is used)" );
 
 6295QString QgsProcessingExtentWidgetWrapper::parameterType()
 const 
 6302  return new QgsProcessingExtentWidgetWrapper( parameter, type );
 
 6307  return new QgsProcessingExtentParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 6318  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 6319  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 6321  vlayout->addWidget( 
new QLabel( tr( 
"Layer type" ) ) );
 
 6337    for ( 
int i : layerParam->dataTypes() )
 
 6339      mLayerTypeComboBox->setItemCheckState( mLayerTypeComboBox->findData( i ), Qt::Checked );
 
 6343  vlayout->addWidget( mLayerTypeComboBox );
 
 6345  setLayout( vlayout );
 
 6350  QList<int> dataTypes;
 
 6351  for ( 
const QVariant &v : mLayerTypeComboBox->checkedItemsData() )
 
 6352    dataTypes << v.toInt();
 
 6354  auto param = std::make_unique<QgsProcessingParameterMapLayer>( name, description );
 
 6355  param->setDataTypes( dataTypes );
 
 6357  return param.release();
 
 6365QWidget *QgsProcessingMapLayerWidgetWrapper::createWidget()
 
 6367  mComboBox = 
new QgsProcessingMapLayerComboBox( parameterDefinition(), type() );
 
 6375      mComboBox->setEditable( 
true );
 
 6379  mComboBox->setToolTip( parameterDefinition()->toolTip() );
 
 6381  connect( mComboBox, &QgsProcessingMapLayerComboBox::valueChanged, 
this, [
this]() {
 
 6382    if ( mBlockSignals )
 
 6385    emit widgetValueHasChanged( 
this );
 
 6388  setWidgetContext( widgetContext() );
 
 6397    mComboBox->setWidgetContext( context );
 
 6402      if ( !parameterDefinition()->defaultValueForGui().isValid() )
 
 6408void QgsProcessingMapLayerWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 6411    mComboBox->setValue( value, context );
 
 6414QVariant QgsProcessingMapLayerWidgetWrapper::widgetValue()
 const 
 6416  return mComboBox ? mComboBox->value() : QVariant();
 
 6419QString QgsProcessingMapLayerWidgetWrapper::modelerExpressionFormatString()
 const 
 6421  return tr( 
"path to a map layer" );
 
 6438QString QgsProcessingMapLayerWidgetWrapper::parameterType()
 const 
 6445  return new QgsProcessingMapLayerWidgetWrapper( parameter, type );
 
 6450  return new QgsProcessingMapLayerParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 6459  : QgsProcessingMapLayerWidgetWrapper( parameter, type, parent )
 
 6463QString QgsProcessingRasterLayerWidgetWrapper::modelerExpressionFormatString()
 const 
 6465  return tr( 
"path to a raster layer" );
 
 6468QString QgsProcessingRasterLayerWidgetWrapper::parameterType()
 const 
 6475  return new QgsProcessingRasterLayerWidgetWrapper( parameter, type );
 
 6480  Q_UNUSED( context );
 
 6481  Q_UNUSED( widgetContext );
 
 6482  Q_UNUSED( definition );
 
 6496  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 6497  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 6499  vlayout->addWidget( 
new QLabel( tr( 
"Geometry type" ) ) );
 
 6509    for ( 
int i : vectorParam->dataTypes() )
 
 6511      mGeometryTypeComboBox->setItemCheckState( mGeometryTypeComboBox->findData( i ), Qt::Checked );
 
 6515  vlayout->addWidget( mGeometryTypeComboBox );
 
 6517  setLayout( vlayout );
 
 6522  QList<int> dataTypes;
 
 6523  for ( 
const QVariant &v : mGeometryTypeComboBox->checkedItemsData() )
 
 6524    dataTypes << v.toInt();
 
 6526  auto param = std::make_unique<QgsProcessingParameterVectorLayer>( name, description, dataTypes );
 
 6528  return param.release();
 
 6533  : QgsProcessingMapLayerWidgetWrapper( parameter, type, parent )
 
 6537QString QgsProcessingVectorLayerWidgetWrapper::modelerExpressionFormatString()
 const 
 6539  return tr( 
"path to a vector layer" );
 
 6542QString QgsProcessingVectorLayerWidgetWrapper::parameterType()
 const 
 6549  return new QgsProcessingVectorLayerWidgetWrapper( parameter, type );
 
 6554  return new QgsProcessingVectorLayerParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 6565  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 6566  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 6568  vlayout->addWidget( 
new QLabel( tr( 
"Geometry type" ) ) );
 
 6578    for ( 
int i : sourceParam->dataTypes() )
 
 6580      mGeometryTypeComboBox->setItemCheckState( mGeometryTypeComboBox->findData( i ), Qt::Checked );
 
 6588  vlayout->addWidget( mGeometryTypeComboBox );
 
 6590  setLayout( vlayout );
 
 6595  QList<int> dataTypes;
 
 6596  for ( 
const QVariant &v : mGeometryTypeComboBox->checkedItemsData() )
 
 6597    dataTypes << v.toInt();
 
 6599  auto param = std::make_unique<QgsProcessingParameterFeatureSource>( name, description, dataTypes );
 
 6601  return param.release();
 
 6605  : QgsProcessingMapLayerWidgetWrapper( parameter, type, parent )
 
 6609QString QgsProcessingFeatureSourceWidgetWrapper::modelerExpressionFormatString()
 const 
 6611  return tr( 
"path to a vector layer" );
 
 6614QString QgsProcessingFeatureSourceWidgetWrapper::parameterType()
 const 
 6621  return new QgsProcessingFeatureSourceWidgetWrapper( parameter, type );
 
 6626  return new QgsProcessingFeatureSourceParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 6634  : QgsProcessingMapLayerWidgetWrapper( parameter, type, parent )
 
 6638QString QgsProcessingMeshLayerWidgetWrapper::modelerExpressionFormatString()
 const 
 6640  return tr( 
"path to a mesh layer" );
 
 6643QString QgsProcessingMeshLayerWidgetWrapper::parameterType()
 const 
 6650  return new QgsProcessingMeshLayerWidgetWrapper( parameter, type );
 
 6655  Q_UNUSED( context );
 
 6656  Q_UNUSED( widgetContext );
 
 6657  Q_UNUSED( definition );
 
 6668QgsProcessingRasterBandPanelWidget::QgsProcessingRasterBandPanelWidget( QWidget *parent, 
const QgsProcessingParameterBand *param )
 
 6672  QHBoxLayout *hl = 
new QHBoxLayout();
 
 6673  hl->setContentsMargins( 0, 0, 0, 0 );
 
 6675  mLineEdit = 
new QLineEdit();
 
 6676  mLineEdit->setEnabled( 
false );
 
 6677  hl->addWidget( mLineEdit, 1 );
 
 6679  mToolButton = 
new QToolButton();
 
 6680  mToolButton->setText( QString( QChar( 0x2026 ) ) );
 
 6681  hl->addWidget( mToolButton );
 
 6687    mLineEdit->setText( tr( 
"%n band(s) selected", 
nullptr, 0 ) );
 
 6690  connect( mToolButton, &QToolButton::clicked, 
this, &QgsProcessingRasterBandPanelWidget::showDialog );
 
 6693void QgsProcessingRasterBandPanelWidget::setBands( 
const QList<int> &bands )
 
 6698void QgsProcessingRasterBandPanelWidget::setBandNames( 
const QHash<int, QString> &names )
 
 6703void QgsProcessingRasterBandPanelWidget::setValue( 
const QVariant &value )
 
 6705  if ( value.isValid() )
 
 6706    mValue = value.userType() == QMetaType::Type::QVariantList ? value.toList() : QVariantList() << value;
 
 6710  updateSummaryText();
 
 6714void QgsProcessingRasterBandPanelWidget::showDialog()
 
 6716  QVariantList availableOptions;
 
 6717  availableOptions.reserve( mBands.size() );
 
 6718  for ( 
int band : std::as_const( mBands ) )
 
 6720    availableOptions << band;
 
 6726    QgsProcessingMultipleSelectionPanelWidget *widget = 
new QgsProcessingMultipleSelectionPanelWidget( availableOptions, mValue );
 
 6727    widget->setPanelTitle( mParam->description() );
 
 6729    widget->setValueFormatter( [
this]( 
const QVariant &v ) -> QString {
 
 6730      int band = v.toInt();
 
 6731      return mBandNames.contains( band ) ? mBandNames.value( band ) : v.toString();
 
 6734    connect( widget, &QgsProcessingMultipleSelectionPanelWidget::selectionChanged, 
this, [
this, widget]() {
 
 6735      setValue( widget->selectedOptions() );
 
 6742    QgsProcessingMultipleSelectionDialog dlg( availableOptions, mValue, 
this, Qt::WindowFlags() );
 
 6744    dlg.setValueFormatter( [
this]( 
const QVariant &v ) -> QString {
 
 6745      int band = v.toInt();
 
 6746      return mBandNames.contains( band ) ? mBandNames.value( band ) : v.toString();
 
 6750      setValue( dlg.selectedOptions() );
 
 6755void QgsProcessingRasterBandPanelWidget::updateSummaryText()
 
 6758    mLineEdit->setText( tr( 
"%n band(s) selected", 
nullptr, mValue.count() ) );
 
 6769  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 6770  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 6772  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 6774  mDefaultLineEdit = 
new QLineEdit();
 
 6775  mDefaultLineEdit->setToolTip( tr( 
"Band number (separate bands with ; for multiple band parameters)" ) );
 
 6780    for ( 
int b : bands )
 
 6782      defVal << QString::number( b );
 
 6785    mDefaultLineEdit->setText( defVal.join( 
';' ) );
 
 6787  vlayout->addWidget( mDefaultLineEdit );
 
 6789  vlayout->addWidget( 
new QLabel( tr( 
"Parent layer" ) ) );
 
 6790  mParentLayerComboBox = 
new QComboBox();
 
 6792  QString initialParent;
 
 6794    initialParent = bandParam->parentLayerParameterName();
 
 6796  if ( 
auto *lModel = widgetContext.
model() )
 
 6799    const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
 
 6800    for ( 
auto it = components.constBegin(); it != components.constEnd(); ++it )
 
 6804        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 6805        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 6807          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 6813  if ( mParentLayerComboBox->count() == 0 && !initialParent.isEmpty() )
 
 6816    mParentLayerComboBox->addItem( initialParent, initialParent );
 
 6817    mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 6820  vlayout->addWidget( mParentLayerComboBox );
 
 6822  mAllowMultipleCheckBox = 
new QCheckBox( tr( 
"Allow multiple" ) );
 
 6824    mAllowMultipleCheckBox->setChecked( bandParam->allowMultiple() );
 
 6826  vlayout->addWidget( mAllowMultipleCheckBox );
 
 6827  setLayout( vlayout );
 
 6832  auto param = std::make_unique<QgsProcessingParameterBand>( name, description, mDefaultLineEdit->text().split( 
';' ), mParentLayerComboBox->currentData().toString(), 
false, mAllowMultipleCheckBox->isChecked() );
 
 6834  return param.release();
 
 6842QWidget *QgsProcessingBandWidgetWrapper::createWidget()
 
 6852        mPanel = 
new QgsProcessingRasterBandPanelWidget( 
nullptr, bandParam );
 
 6853        mPanel->setToolTip( parameterDefinition()->toolTip() );
 
 6854        connect( mPanel, &QgsProcessingRasterBandPanelWidget::changed, 
this, [
this] {
 
 6855          emit widgetValueHasChanged( 
this );
 
 6864        mComboBox->setToolTip( parameterDefinition()->toolTip() );
 
 6866          emit widgetValueHasChanged( 
this );
 
 6874      mLineEdit = 
new QLineEdit();
 
 6875      mLineEdit->setToolTip( QObject::tr( 
"Band number (separate bands with ; for multiple band parameters)" ) );
 
 6876      connect( mLineEdit, &QLineEdit::textChanged, 
this, [
this] {
 
 6877        emit widgetValueHasChanged( 
this );
 
 6885void QgsProcessingBandWidgetWrapper::postInitialize( 
const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
 
 6897          setParentLayerWrapperValue( wrapper );
 
 6899            setParentLayerWrapperValue( wrapper );
 
 6916  std::unique_ptr<QgsProcessingContext> tmpContext;
 
 6917  if ( mProcessingContextGenerator )
 
 6918    context = mProcessingContextGenerator->processingContext();
 
 6922    tmpContext = std::make_unique<QgsProcessingContext>();
 
 6923    context = tmpContext.get();
 
 6929  if ( layer && layer->
isValid() )
 
 6933    std::unique_ptr<QgsMapLayer> ownedLayer( context->
takeResultLayer( layer->
id() ) );
 
 6936      mParentLayer.reset( qobject_cast<QgsRasterLayer *>( ownedLayer.release() ) );
 
 6937      layer = mParentLayer.get();
 
 6945      mComboBox->setLayer( layer );
 
 6949      if ( provider && layer->
isValid() )
 
 6954        QHash<int, QString> bandNames;
 
 6955        for ( 
int i = 1; i <= nBands; ++i )
 
 6960        mPanel->setBands( bands );
 
 6961        mPanel->setBandNames( bandNames );
 
 6968      mComboBox->setLayer( 
nullptr );
 
 6970      mPanel->setBands( QList<int>() );
 
 6972    if ( value.isValid() && widgetContext().messageBar() )
 
 6979  if ( parameterDefinition()->defaultValueForGui().isValid() )
 
 6980    setWidgetValue( parameterDefinition()->defaultValueForGui(), *context );
 
 6983void QgsProcessingBandWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 6987    if ( !value.isValid() )
 
 6988      mComboBox->setBand( -1 );
 
 6992      mComboBox->setBand( v );
 
 6998    if ( value.isValid() )
 
 7001      opts.reserve( v.size() );
 
 7006      mPanel->setValue( value.isValid() ? opts : QVariant() );
 
 7008  else if ( mLineEdit )
 
 7015      opts.reserve( v.size() );
 
 7017        opts << QString::number( i );
 
 7018      mLineEdit->setText( value.isValid() && !opts.empty() ? opts.join( 
';' ) : QString() );
 
 7022      if ( value.isValid() )
 
 7030QVariant QgsProcessingBandWidgetWrapper::widgetValue()
 const 
 7033    return mComboBox->currentBand() == -1 ? QVariant() : mComboBox->currentBand();
 
 7035    return !mPanel->value().toList().isEmpty() ? mPanel->value() : QVariant();
 
 7036  else if ( mLineEdit )
 
 7041      const QStringList parts = mLineEdit->text().split( 
';', Qt::SkipEmptyParts );
 
 7043      res.reserve( parts.count() );
 
 7044      for ( 
const QString &s : parts )
 
 7047        int band = s.toInt( &ok );
 
 7051      return res.
isEmpty() ? QVariant() : res;
 
 7055      return mLineEdit->text().isEmpty() ? QVariant() : mLineEdit->text();
 
 7062QString QgsProcessingBandWidgetWrapper::modelerExpressionFormatString()
 const 
 7064  return tr( 
"selected band numbers as an array of numbers, or semicolon separated string of options (e.g. '1;3')" );
 
 7067QString QgsProcessingBandWidgetWrapper::parameterType()
 const 
 7074  return new QgsProcessingBandWidgetWrapper( parameter, type );
 
 7079  return new QgsProcessingBandParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 7090  setAcceptDrops( 
true );
 
 7093void QgsProcessingMultipleLayerLineEdit::dragEnterEvent( QDragEnterEvent *event )
 
 7095  const QStringList uris = QgsProcessingMultipleInputPanelWidget::compatibleUrisFromMimeData( mParam, event->mimeData(), {} );
 
 7096  if ( !uris.isEmpty() )
 
 7098    event->setDropAction( Qt::CopyAction );
 
 7100    setHighlighted( 
true );
 
 7108void QgsProcessingMultipleLayerLineEdit::dragLeaveEvent( QDragLeaveEvent *event )
 
 7110  QgsHighlightableLineEdit::dragLeaveEvent( event );
 
 7112  setHighlighted( 
false );
 
 7115void QgsProcessingMultipleLayerLineEdit::dropEvent( QDropEvent *event )
 
 7117  const QStringList uris = QgsProcessingMultipleInputPanelWidget::compatibleUrisFromMimeData( mParam, event->mimeData(), {} );
 
 7118  if ( !uris.isEmpty() )
 
 7120    event->setDropAction( Qt::CopyAction );
 
 7122    QVariantList uriList;
 
 7123    uriList.reserve( uris.size() );
 
 7124    for ( 
const QString &uri : uris )
 
 7125      uriList.append( QVariant( uri ) );
 
 7126    emit layersDropped( uriList );
 
 7129  setHighlighted( 
false );
 
 7140  QHBoxLayout *hl = 
new QHBoxLayout();
 
 7141  hl->setContentsMargins( 0, 0, 0, 0 );
 
 7143  mLineEdit = 
new QgsProcessingMultipleLayerLineEdit( 
nullptr, param );
 
 7144  mLineEdit->setEnabled( 
true );
 
 7145  mLineEdit->setReadOnly( 
true );
 
 7147  hl->addWidget( mLineEdit, 1 );
 
 7148  connect( mLineEdit, &QgsProcessingMultipleLayerLineEdit::layersDropped, 
this, &QgsProcessingMultipleLayerPanelWidget::setValue );
 
 7150  mToolButton = 
new QToolButton();
 
 7151  mToolButton->setText( QString( QChar( 0x2026 ) ) );
 
 7152  hl->addWidget( mToolButton );
 
 7158    mLineEdit->setText( tr( 
"%n input(s) selected", 
nullptr, 0 ) );
 
 7161  connect( mToolButton, &QToolButton::clicked, 
this, &QgsProcessingMultipleLayerPanelWidget::showDialog );
 
 7164void QgsProcessingMultipleLayerPanelWidget::setValue( 
const QVariant &value )
 
 7166  if ( value.isValid() )
 
 7167    mValue = value.userType() == QMetaType::Type::QVariantList ? value.toList() : QVariantList() << value;
 
 7171  updateSummaryText();
 
 7175void QgsProcessingMultipleLayerPanelWidget::setProject( 
QgsProject *project )
 
 7181      if ( mValue.removeAll( layerId ) )
 
 7183        updateSummaryText();
 
 7190void QgsProcessingMultipleLayerPanelWidget::setModel( QgsProcessingModelAlgorithm *model, 
const QString &modelChildAlgorithmID )
 
 7196  switch ( mParam->layerType() )
 
 7278void QgsProcessingMultipleLayerPanelWidget::showDialog()
 
 7283    QgsProcessingMultipleInputPanelWidget *widget = 
new QgsProcessingMultipleInputPanelWidget( mParam, mValue, mModelSources, mModel );
 
 7284    widget->setPanelTitle( mParam->description() );
 
 7285    widget->setProject( mProject );
 
 7286    connect( widget, &QgsProcessingMultipleSelectionPanelWidget::selectionChanged, 
this, [
this, widget]() {
 
 7287      setValue( widget->selectedOptions() );
 
 7294    QgsProcessingMultipleInputDialog dlg( mParam, mValue, mModelSources, mModel, 
this, Qt::WindowFlags() );
 
 7295    dlg.setProject( mProject );
 
 7298      setValue( dlg.selectedOptions() );
 
 7303void QgsProcessingMultipleLayerPanelWidget::updateSummaryText()
 
 7306    mLineEdit->setText( tr( 
"%n input(s) selected", 
nullptr, mValue.count() ) );
 
 7316  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 7317  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 7319  vlayout->addWidget( 
new QLabel( tr( 
"Allowed layer type" ) ) );
 
 7320  mLayerTypeComboBox = 
new QComboBox();
 
 7334    mLayerTypeComboBox->setCurrentIndex( mLayerTypeComboBox->findData( 
static_cast<int>( layersParam->layerType() ) ) );
 
 7336  vlayout->addWidget( mLayerTypeComboBox );
 
 7337  setLayout( vlayout );
 
 7342  auto param = std::make_unique<QgsProcessingParameterMultipleLayers>( name, description, 
static_cast<Qgis::ProcessingSourceType>( mLayerTypeComboBox->currentData().toInt() ) );
 
 7344  return param.release();
 
 7352QWidget *QgsProcessingMultipleLayerWidgetWrapper::createWidget()
 
 7356  mPanel = 
new QgsProcessingMultipleLayerPanelWidget( 
nullptr, layerParam );
 
 7357  mPanel->setToolTip( parameterDefinition()->toolTip() );
 
 7358  mPanel->setProject( widgetContext().project() );
 
 7360    mPanel->setModel( widgetContext().model(), widgetContext().modelChildAlgorithmId() );
 
 7361  connect( mPanel, &QgsProcessingMultipleLayerPanelWidget::changed, 
this, [
this] {
 
 7362    emit widgetValueHasChanged( 
this );
 
 7372    mPanel->setProject( context.
project() );
 
 7374      mPanel->setModel( widgetContext().model(), widgetContext().modelChildAlgorithmId() );
 
 7378void QgsProcessingMultipleLayerWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 7383    if ( value.isValid() )
 
 7386      opts.reserve( v.size() );
 
 7388        opts << l->source();
 
 7391    for ( 
const QVariant &v : value.toList() )
 
 7393      if ( v.userType() == qMetaTypeId<QgsProcessingModelChildParameterSource>() )
 
 7395        const QgsProcessingModelChildParameterSource source = v.value<QgsProcessingModelChildParameterSource>();
 
 7396        opts << QVariant::fromValue( source );
 
 7401      mPanel->setValue( value.isValid() ? opts : QVariant() );
 
 7405QVariant QgsProcessingMultipleLayerWidgetWrapper::widgetValue()
 const 
 7408    return !mPanel->value().toList().isEmpty() ? mPanel->value() : QVariant();
 
 7413QString QgsProcessingMultipleLayerWidgetWrapper::modelerExpressionFormatString()
 const 
 7415  return tr( 
"an array of layer paths, or semicolon separated string of layer paths" );
 
 7418QString QgsProcessingMultipleLayerWidgetWrapper::parameterType()
 const 
 7425  return new QgsProcessingMultipleLayerWidgetWrapper( parameter, type );
 
 7430  return new QgsProcessingMultipleLayerParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 7439  : QgsProcessingMapLayerWidgetWrapper( parameter, type, parent )
 
 7443QString QgsProcessingPointCloudLayerWidgetWrapper::modelerExpressionFormatString()
 const 
 7445  return tr( 
"path to a point cloud layer" );
 
 7448QString QgsProcessingPointCloudLayerWidgetWrapper::parameterType()
 const 
 7455  return new QgsProcessingPointCloudLayerWidgetWrapper( parameter, type );
 
 7460  Q_UNUSED( context );
 
 7461  Q_UNUSED( widgetContext );
 
 7462  Q_UNUSED( definition );
 
 7478QString QgsProcessingAnnotationLayerWidgetWrapper::modelerExpressionFormatString()
 const 
 7480  return tr( 
"name of an annotation layer, or \"main\" for the main annotation layer" );
 
 7483QString QgsProcessingAnnotationLayerWidgetWrapper::parameterType()
 const 
 7490  return new QgsProcessingAnnotationLayerWidgetWrapper( parameter, type );
 
 7495  Q_UNUSED( context );
 
 7496  Q_UNUSED( widgetContext );
 
 7497  Q_UNUSED( definition );
 
 7508    if ( mWidgetContext.project() )
 
 7509      mComboBox->setAdditionalLayers( { mWidgetContext.project()->mainAnnotationLayer() } );
 
 7513QWidget *QgsProcessingAnnotationLayerWidgetWrapper::createWidget()
 
 7524      mComboBox->setEditable( 
true );
 
 7528  mComboBox->setToolTip( parameterDefinition()->toolTip() );
 
 7530  if ( mWidgetContext.project() )
 
 7531    mComboBox->setAdditionalLayers( { mWidgetContext.project()->mainAnnotationLayer() } );
 
 7534    mComboBox->setAllowEmptyLayer( 
true );
 
 7537    if ( mBlockSignals )
 
 7540    emit widgetValueHasChanged( 
this );
 
 7543  setWidgetContext( widgetContext() );
 
 7547void QgsProcessingAnnotationLayerWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 7553      mComboBox->setLayer( 
nullptr );
 
 7557    QVariant val = value;
 
 7558    if ( val.userType() == qMetaTypeId<QgsProperty>() )
 
 7570    QgsMapLayer *layer = qobject_cast<QgsMapLayer *>( val.value<QObject *>() );
 
 7571    if ( !layer && val.userType() == QMetaType::Type::QString )
 
 7578      mComboBox->setLayer( layer );
 
 7583QVariant QgsProcessingAnnotationLayerWidgetWrapper::widgetValue()
 const 
 7585  return mComboBox && mComboBox->currentLayer() ? ( mWidgetContext.project() ? ( mComboBox->currentLayer() == mWidgetContext.project()->mainAnnotationLayer() ? QStringLiteral( 
"main" ) : mComboBox->currentLayer()->id() ) : mComboBox->currentLayer()->id() )
 
 7598  QHBoxLayout *hl = 
new QHBoxLayout();
 
 7599  hl->setContentsMargins( 0, 0, 0, 0 );
 
 7601  mLineEdit = 
new QLineEdit();
 
 7602  mLineEdit->setEnabled( 
false );
 
 7603  hl->addWidget( mLineEdit, 1 );
 
 7605  mToolButton = 
new QToolButton();
 
 7606  mToolButton->setText( QString( QChar( 0x2026 ) ) );
 
 7607  hl->addWidget( mToolButton );
 
 7613    mLineEdit->setText( tr( 
"%n attribute(s) selected", 
nullptr, 0 ) );
 
 7616  connect( mToolButton, &QToolButton::clicked, 
this, &QgsProcessingPointCloudAttributePanelWidget::showDialog );
 
 7621  mAttributes = attributes;
 
 7624void QgsProcessingPointCloudAttributePanelWidget::setValue( 
const QVariant &value )
 
 7626  if ( value.isValid() )
 
 7627    mValue = value.userType() == QMetaType::Type::QVariantList ? value.toList() : QVariantList() << value;
 
 7631  updateSummaryText();
 
 7635void QgsProcessingPointCloudAttributePanelWidget::showDialog()
 
 7637  QVariantList availableOptions;
 
 7638  availableOptions.reserve( mAttributes.count() );
 
 7639  const QVector<QgsPointCloudAttribute> attributes = mAttributes.attributes();
 
 7642    availableOptions << attr.name();
 
 7648    QgsProcessingMultipleSelectionPanelWidget *widget = 
new QgsProcessingMultipleSelectionPanelWidget( availableOptions, mValue );
 
 7649    widget->setPanelTitle( mParam->description() );
 
 7651    widget->setValueFormatter( []( 
const QVariant &v ) -> QString {
 
 7652      return v.toString();
 
 7655    connect( widget, &QgsProcessingMultipleSelectionPanelWidget::selectionChanged, 
this, [
this, widget]() {
 
 7656      setValue( widget->selectedOptions() );
 
 7663    QgsProcessingMultipleSelectionDialog dlg( availableOptions, mValue, 
this, Qt::WindowFlags() );
 
 7665    dlg.setValueFormatter( []( 
const QVariant &v ) -> QString {
 
 7666      return v.toString();
 
 7670      setValue( dlg.selectedOptions() );
 
 7675void QgsProcessingPointCloudAttributePanelWidget::updateSummaryText()
 
 7680  if ( mValue.empty() )
 
 7682    mLineEdit->setText( tr( 
"%n attribute(s) selected", 
nullptr, 0 ) );
 
 7687    values.reserve( mValue.size() );
 
 7688    for ( 
const QVariant &val : std::as_const( mValue ) )
 
 7690      values << val.toString();
 
 7693    const QString concatenated = values.join( tr( 
"," ) );
 
 7694    if ( concatenated.length() < 100 )
 
 7695      mLineEdit->setText( concatenated );
 
 7697      mLineEdit->setText( tr( 
"%n attribute(s) selected", 
nullptr, mValue.count() ) );
 
 7709  QVBoxLayout *vlayout = 
new QVBoxLayout();
 
 7710  vlayout->setContentsMargins( 0, 0, 0, 0 );
 
 7712  vlayout->addWidget( 
new QLabel( tr( 
"Parent layer" ) ) );
 
 7713  mParentLayerComboBox = 
new QComboBox();
 
 7715  QString initialParent;
 
 7717    initialParent = attrParam->parentLayerParameterName();
 
 7719  if ( 
auto *lModel = widgetContext.
model() )
 
 7722    const QMap<QString, QgsProcessingModelParameter> components = lModel->parameterComponents();
 
 7723    for ( 
auto it = components.constBegin(); it != components.constEnd(); ++it )
 
 7727        mParentLayerComboBox->addItem( definition->
description(), definition->
name() );
 
 7728        if ( !initialParent.isEmpty() && initialParent == definition->
name() )
 
 7730          mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 7736  if ( mParentLayerComboBox->count() == 0 && !initialParent.isEmpty() )
 
 7739    mParentLayerComboBox->addItem( initialParent, initialParent );
 
 7740    mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
 
 7743  vlayout->addWidget( mParentLayerComboBox );
 
 7745  mAllowMultipleCheckBox = 
new QCheckBox( tr( 
"Accept multiple attributes" ) );
 
 7747    mAllowMultipleCheckBox->setChecked( attrParam->allowMultiple() );
 
 7749  vlayout->addWidget( mAllowMultipleCheckBox );
 
 7751  mDefaultToAllCheckBox = 
new QCheckBox( tr( 
"Select all attributes by default" ) );
 
 7752  mDefaultToAllCheckBox->setEnabled( mAllowMultipleCheckBox->isChecked() );
 
 7754    mDefaultToAllCheckBox->setChecked( attrParam->defaultToAllAttributes() );
 
 7756  vlayout->addWidget( mDefaultToAllCheckBox );
 
 7758  connect( mAllowMultipleCheckBox, &QCheckBox::stateChanged, 
this, [
this] {
 
 7759    mDefaultToAllCheckBox->setEnabled( mAllowMultipleCheckBox->isChecked() );
 
 7762  vlayout->addWidget( 
new QLabel( tr( 
"Default value" ) ) );
 
 7764  mDefaultLineEdit = 
new QLineEdit();
 
 7765  mDefaultLineEdit->setToolTip( tr( 
"Default attribute name, or ; separated list of attribute names for multiple attribute parameters" ) );
 
 7769    mDefaultLineEdit->setText( attributes.join( 
';' ) );
 
 7771  vlayout->addWidget( mDefaultLineEdit );
 
 7773  setLayout( vlayout );
 
 7778  QVariant defaultValue;
 
 7779  if ( !mDefaultLineEdit->text().trimmed().isEmpty() )
 
 7781    defaultValue = mDefaultLineEdit->text();
 
 7783  auto param = std::make_unique<QgsProcessingParameterPointCloudAttribute>( name, description, defaultValue, mParentLayerComboBox->currentData().toString(), mAllowMultipleCheckBox->isChecked(), 
false, mDefaultToAllCheckBox->isChecked() );
 
 7785  return param.release();
 
 7793QWidget *QgsProcessingPointCloudAttributeWidgetWrapper::createWidget()
 
 7803        mPanel = 
new QgsProcessingPointCloudAttributePanelWidget( 
nullptr, attrParam );
 
 7804        mPanel->setToolTip( parameterDefinition()->toolTip() );
 
 7805        connect( mPanel, &QgsProcessingPointCloudAttributePanelWidget::changed, 
this, [
this] {
 
 7806          emit widgetValueHasChanged( 
this );
 
 7814        mComboBox->setToolTip( parameterDefinition()->toolTip() );
 
 7816          emit widgetValueHasChanged( 
this );
 
 7824      mLineEdit = 
new QLineEdit();
 
 7825      mLineEdit->setToolTip( QObject::tr( 
"Name of attribute (separate attribute names with ; for multiple attribute parameters)" ) );
 
 7826      connect( mLineEdit, &QLineEdit::textChanged, 
this, [
this] {
 
 7827        emit widgetValueHasChanged( 
this );
 
 7835void QgsProcessingPointCloudAttributeWidgetWrapper::postInitialize( 
const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
 
 7847          setParentLayerWrapperValue( wrapper );
 
 7849            setParentLayerWrapperValue( wrapper );
 
 7866  std::unique_ptr<QgsProcessingContext> tmpContext;
 
 7867  if ( mProcessingContextGenerator )
 
 7868    context = mProcessingContextGenerator->processingContext();
 
 7872    tmpContext = std::make_unique<QgsProcessingContext>();
 
 7873    context = tmpContext.get();
 
 7879  if ( layer && layer->
isValid() )
 
 7883    std::unique_ptr<QgsMapLayer> ownedLayer( context->
takeResultLayer( layer->
id() ) );
 
 7886      mParentLayer.reset( qobject_cast<QgsPointCloudLayer *>( ownedLayer.release() ) );
 
 7887      layer = mParentLayer.get();
 
 7895      mComboBox->setLayer( layer );
 
 7898      mPanel->setAttributes( layer->
attributes() );
 
 7905      mComboBox->setLayer( 
nullptr );
 
 7910    if ( value.isValid() && widgetContext().messageBar() )
 
 7921    val.reserve( mPanel->attributes().attributes().size() );
 
 7924    setWidgetValue( val, *context );
 
 7927    setWidgetValue( parameterDefinition()->defaultValueForGui(), *context );
 
 7930void QgsProcessingPointCloudAttributeWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext &context )
 
 7934    if ( !value.isValid() )
 
 7935      mComboBox->setAttribute( QString() );
 
 7939      mComboBox->setAttribute( v );
 
 7945    if ( value.isValid() )
 
 7948      opts.reserve( v.size() );
 
 7949      for ( 
const QString &i : v )
 
 7953      mPanel->setValue( opts );
 
 7955  else if ( mLineEdit )
 
 7961      mLineEdit->setText( v.join( 
';' ) );
 
 7970QVariant QgsProcessingPointCloudAttributeWidgetWrapper::widgetValue()
 const 
 7973    return mComboBox->currentAttribute();
 
 7975    return mPanel->value();
 
 7976  else if ( mLineEdit )
 
 7981      return mLineEdit->text().split( 
';' );
 
 7984      return mLineEdit->text();
 
 7990QString QgsProcessingPointCloudAttributeWidgetWrapper::modelerExpressionFormatString()
 const 
 7992  return tr( 
"selected attribute names as an array of names, or semicolon separated string of options (e.g. 'X;Intensity')" );
 
 7995QString QgsProcessingPointCloudAttributeWidgetWrapper::parameterType()
 const 
 8002  return new QgsProcessingPointCloudAttributeWidgetWrapper( parameter, type );
 
 8007  return new QgsProcessingPointCloudAttributeParameterDefinitionWidget( context, widgetContext, definition, 
algorithm );
 
 8020QWidget *QgsProcessingOutputWidgetWrapper::createWidget()
 
 8028      mOutputWidget = 
new QgsProcessingLayerOutputDestinationWidget( destParam, 
false );
 
 8029      if ( mProcessingContextGenerator )
 
 8030        mOutputWidget->setContext( mProcessingContextGenerator->processingContext() );
 
 8031      if ( mParametersGenerator )
 
 8032        mOutputWidget->registerProcessingParametersGenerator( mParametersGenerator );
 
 8033      mOutputWidget->setToolTip( parameterDefinition()->toolTip() );
 
 8035      connect( mOutputWidget, &QgsProcessingLayerOutputDestinationWidget::destinationChanged, 
this, [
this]() {
 
 8036        if ( mBlockSignals )
 
 8039        emit widgetValueHasChanged( 
this );
 
 8044        mOutputWidget->addOpenAfterRunningOption();
 
 8046      return mOutputWidget;
 
 8056void QgsProcessingOutputWidgetWrapper::setWidgetValue( 
const QVariant &value, 
QgsProcessingContext & )
 
 8058  if ( mOutputWidget )
 
 8059    mOutputWidget->setValue( value );
 
 8062QVariant QgsProcessingOutputWidgetWrapper::widgetValue()
 const 
 8064  if ( mOutputWidget )
 
 8065    return mOutputWidget->value();
 
 8070QVariantMap QgsProcessingOutputWidgetWrapper::customProperties()
 const 
 8073  if ( mOutputWidget )
 
 8074    res.insert( QStringLiteral( 
"OPEN_AFTER_RUNNING" ), mOutputWidget->openAfterRunning() );
 
 8083  : QgsProcessingOutputWidgetWrapper( parameter, type, parent )
 
 8087QString QgsProcessingFeatureSinkWidgetWrapper::parameterType()
 const 
 8094  return new QgsProcessingFeatureSinkWidgetWrapper( parameter, type );
 
 8097QString QgsProcessingFeatureSinkWidgetWrapper::modelerExpressionFormatString()
 const 
 8099  return tr( 
"path to layer destination" );
 
 8107  : QgsProcessingOutputWidgetWrapper( parameter, type, parent )
 
 8111QString QgsProcessingVectorDestinationWidgetWrapper::parameterType()
 const 
 8118  return new QgsProcessingVectorDestinationWidgetWrapper( parameter, type );
 
 8121QString QgsProcessingVectorDestinationWidgetWrapper::modelerExpressionFormatString()
 const 
 8123  return tr( 
"path to layer destination" );
 
 8131  : QgsProcessingOutputWidgetWrapper( parameter, type, parent )
 
 8135QString QgsProcessingRasterDestinationWidgetWrapper::parameterType()
 const 
 8142  return new QgsProcessingRasterDestinationWidgetWrapper( parameter, type );
 
 8145QString QgsProcessingRasterDestinationWidgetWrapper::modelerExpressionFormatString()
 const 
 8147  return tr( 
"path to layer destination" );
 
 8155  : QgsProcessingOutputWidgetWrapper( parameter, type, parent )
 
 8159QString QgsProcessingPointCloudDestinationWidgetWrapper::parameterType()
 const 
 8166  return new QgsProcessingPointCloudDestinationWidgetWrapper( parameter, type );
 
 8169QString QgsProcessingPointCloudDestinationWidgetWrapper::modelerExpressionFormatString()
 const 
 8171  return tr( 
"path to layer destination" );
 
 8179  : QgsProcessingOutputWidgetWrapper( parameter, type, parent )
 
 8183QString QgsProcessingFileDestinationWidgetWrapper::parameterType()
 const 
 8190  return new QgsProcessingFileDestinationWidgetWrapper( parameter, type );
 
 8194QString QgsProcessingFileDestinationWidgetWrapper::modelerExpressionFormatString()
 const 
 8196  return tr( 
"path to file destination" );
 
 8204  : QgsProcessingOutputWidgetWrapper( parameter, type, parent )
 
 8208QString QgsProcessingFolderDestinationWidgetWrapper::parameterType()
 const 
 8215  return new QgsProcessingFolderDestinationWidgetWrapper( parameter, type );
 
 8219QString QgsProcessingFolderDestinationWidgetWrapper::modelerExpressionFormatString()
 const 
 8221  return tr( 
"path to folder destination" );
 
 8229  : QgsProcessingOutputWidgetWrapper( parameter, type, parent )
 
 8233QString QgsProcessingVectorTileDestinationWidgetWrapper::parameterType()
 const 
 8240  return new QgsProcessingPointCloudDestinationWidgetWrapper( parameter, type );
 
 8243QString QgsProcessingVectorTileDestinationWidgetWrapper::modelerExpressionFormatString()
 const 
 8245  return tr( 
"path to layer destination" );
 
@ Standard
Unit is a standard measurement unit.
 
ProcessingSourceType
Processing data source types.
 
@ File
Files (i.e. non map layer sources, such as text files)
 
@ Annotation
Annotation layers.
 
@ Vector
Tables (i.e. vector layers with or without geometry). When used for a sink this indicates the sink ha...
 
@ VectorTile
Vector tile layers.
 
@ MapLayer
Any map layer type (raster, vector, mesh, point cloud, annotation or plugin layer)
 
@ VectorAnyGeometry
Any vector layer with geometry.
 
@ VectorPoint
Vector point layers.
 
@ VectorPolygon
Vector polygon layers.
 
@ VectorLine
Vector line layers.
 
@ PointCloud
Point cloud layers.
 
ProcessingFileParameterBehavior
Flags which dictate the behavior of QgsProcessingParameterFile.
 
@ File
Parameter is a single file.
 
@ Folder
Parameter is a folder.
 
ExpressionType
Expression types.
 
@ RasterCalculator
Raster calculator expression.
 
@ Qgis
Native QGIS expression.
 
@ PointCloud
Point cloud expression.
 
ProcessingMode
Types of modes which Processing widgets can be created for.
 
@ Batch
Batch processing mode.
 
@ Standard
Standard (single-run) algorithm mode.
 
DistanceUnit
Units of distance.
 
@ Centimeters
Centimeters.
 
@ Millimeters
Millimeters.
 
@ Miles
Terrestrial miles.
 
@ Unknown
Unknown distance unit.
 
@ Degrees
Degrees, for planar geographic CRS distance measurements.
 
@ NauticalMiles
Nautical miles.
 
ProcessingFieldParameterDataType
Processing field parameter data types.
 
@ String
Accepts string fields.
 
@ Boolean
Accepts boolean fields, since QGIS 3.34.
 
@ Binary
Accepts binary fields, since QGIS 3.34.
 
@ Numeric
Accepts numeric fields.
 
@ DateTime
Accepts datetime fields.
 
@ SquareCentimeters
Square centimeters.
 
@ SquareInches
Square inches.
 
@ SquareNauticalMiles
Square nautical miles.
 
@ SquareMillimeters
Square millimeters.
 
@ SquareYards
Square yards.
 
@ SquareKilometers
Square kilometers.
 
@ SquareMeters
Square meters.
 
@ Unknown
Unknown areal unit.
 
@ SquareDegrees
Square degrees, for planar geographic CRS area measurements.
 
@ SquareMiles
Square miles.
 
@ Info
Information message.
 
@ AnnotationLayer
QgsAnnotationLayer.
 
TemporalUnit
Temporal units.
 
@ Milliseconds
Milliseconds.
 
@ PointCloud
Point cloud layer. Added in QGIS 3.18.
 
QFlags< ProcessingParameterFlag > ProcessingParameterFlags
Flags which dictate the behavior of Processing parameters.
 
VolumeUnit
Units of volume.
 
@ CubicMeters
Cubic meters.
 
@ CubicDegrees
Cubic degrees, for planar geographic CRS volume measurements.
 
@ CubicDecimeter
Cubic decimeters.
 
@ Unknown
Unknown volume unit.
 
@ CubicCentimeter
Cubic Centimeters.
 
ProcessingModelChildParameterSource
Processing model child parameter sources.
 
@ ModelParameter
Parameter value is taken from a parent model parameter.
 
@ StaticValue
Parameter value is a static value.
 
@ Optional
Parameter is optional.
 
ProcessingDateTimeParameterDataType
Processing date time parameter data types.
 
@ DateTime
Datetime values.
 
ProcessingNumberParameterType
Processing numeric parameter data types.
 
@ Double
Double/float values.
 
static QCursor getThemeCursor(Cursor cursor)
Helper to get a theme cursor.
 
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
 
@ CapturePoint
Select and capture a point or a feature.
 
Selector widget for authentication configs.
 
void selectedConfigIdChanged(const QString &authcfg)
Emitted when authentication config is changed or missing.
 
QComboBox subclass which allows selecting multiple items.
 
Represents a coordinate reference system (CRS).
 
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
 
Qgis::DistanceUnit mapUnits
 
A combo box which displays the list of schemas for a specific database connection.
 
A combobox which displays the list of tables for a specific database connection.
 
A QDateEdit widget with the capability of setting/reading null dates.
 
void dateValueChanged(const QDate &date)
Signal emitted whenever the date changes.
 
A QDateTimeEdit with the capability of setting/reading null date/times.
 
void setAllowNull(bool allowNull)
Determines if the widget allows setting null date/time.
 
void setNullRepresentation(const QString &null)
Sets the widget's null representation, which defaults to QgsApplication::nullRepresentation().
 
void valueChanged(const QDateTime &date)
Signal emitted whenever the value changes.
 
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
 
static double toDouble(const QString &input, bool *ok)
Converts input string to double value.
 
A widget which includes a line edit for entering expressions together with a button to open the expre...
 
void expressionChanged(const QString &expression)
Emitted when the expression is changed.
 
A combobox which displays the list of fields of a given layer.
 
void fieldChanged(const QString &fieldName)
Emitted when the currently selected field changes.
 
@ DateTime
Datetime fields.
 
@ Date
Date or datetime fields.
 
@ Binary
Binary fields, since QGIS 3.34.
 
@ Boolean
Boolean fields, since QGIS 3.34.
 
@ Numeric
All numeric fields.
 
Encapsulate a field in an attribute table or data source.
 
Container of fields for a vector layer.
 
bool append(const QgsField &field, Qgis::FieldOrigin origin=Qgis::FieldOrigin::Provider, int originIndex=-1)
Appends a field.
 
void remove(int fieldIdx)
Removes the field with the given index.
 
QgsField at(int i) const
Returns the field at particular index (must be in range 0..N-1).
 
Q_INVOKABLE int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
 
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
 
A geometry is the spatial representation of a feature.
 
static QgsGeometry fromPointXY(const QgsPointXY &point)
Creates a new geometry from a QgsPointXY object.
 
bool isEmpty() const
Returns true if the geometry is empty (eg a linestring with no vertices, or a collection with no geom...
 
A QgsFilterLineEdit subclass with the ability to "highlight" the edges of the widget.
 
A combobox which displays available layouts from a QgsLayoutManager.
 
void layoutChanged(QgsMasterLayoutInterface *layout)
Emitted whenever the currently selected layout changes.
 
void setAllowEmptyLayout(bool allowEmpty)
Sets whether an optional empty layout ("not set") option is present in the combobox.
 
A combo box which displays items of a matching type from a layout.
 
void itemChanged(QgsLayoutItem *item)
Emitted whenever the currently selected item changes.
 
Base class for graphical items within a QgsLayout.
 
virtual QString uuid() const
Returns the item identification string.
 
@ FilterPrintLayouts
Includes print layouts.
 
QList< QgsPrintLayout * > printLayouts() const
Returns a list of all print layouts contained in the manager.
 
Map canvas is a class for displaying all GIS data types on a canvas.
 
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering.
 
A combobox which displays a dynamic list of layers from a QGIS project.
 
void layerChanged(QgsMapLayer *layer)
Emitted whenever the currently selected layer changes.
 
Base class for all map layer types.
 
A mouse event which is the result of a user interaction with a QgsMapCanvas.
 
QgsPointLocator::Match mapPointMatch() const
Returns the matching data from the most recently snapped point.
 
QgsPointXY snapPoint()
snapPoint will snap the points using the map canvas snapping utils configuration
 
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system for the map render.
 
Interface for master layout type objects, such as print layouts and reports.
 
virtual QString name() const =0
Returns the layout's name.
 
void pushMessage(const QString &text, Qgis::MessageLevel level=Qgis::MessageLevel::Info, int duration=-1)
A convenience method for pushing a message with the specified text to the bar.
 
bool clearWidgets()
Removes all items from the bar.
 
A collection of point cloud attributes.
 
A combobox which displays the list of attributes of a given point cloud layer.
 
void attributeChanged(const QString &name)
Emitted when the currently selected attribute changes.
 
Attribute for point cloud data pair of name and size in bytes.
 
Represents a map layer supporting display of point clouds.
 
QgsPointCloudAttributeCollection attributes() const
Returns the attributes available from the layer.
 
Print layout, a QgsLayout subclass for static or atlas-based layouts.
 
Abstract base class for processing algorithms.
 
An interface for objects which can create Processing contexts.
 
Contains information about the context in which a processing algorithm is executed.
 
QgsExpressionContext & expressionContext()
Returns the expression context.
 
QgsCoordinateTransformContext transformContext() const
Returns the coordinate transform context.
 
QgsMapLayer * takeResultLayer(const QString &id)
Takes the result map layer with matching id from the context and transfers ownership of it back to th...
 
Base class for all parameter definitions which represent file or layer destinations,...
 
Encapsulates settings relating to a feature source input to a processing algorithm.
 
QgsProperty source
Source definition.
 
static QString typeName()
Returns the type name for the output class.
 
static QString typeName()
Returns the type name for the output class.
 
static QString typeName()
Returns the type name for the output class.
 
static QString typeName()
Returns the type name for the output class.
 
static QString typeName()
Returns the type name for the output class.
 
static QString typeName()
Returns the type name for the parameter class.
 
A double numeric parameter for area values.
 
Qgis::AreaUnit defaultUnit() const
Returns the default area 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.
 
A raster band parameter for Processing algorithms.
 
static QString typeName()
Returns the type name for the parameter class.
 
bool allowMultiple() const
Returns whether multiple band selections are permitted.
 
A boolean parameter for processing algorithms.
 
static QString typeName()
Returns the type name for the parameter class.
 
A color parameter for processing algorithms.
 
bool opacityEnabled() const
Returns true if the parameter allows opacity control.
 
static QString typeName()
Returns the type name for the parameter class.
 
A coordinate operation parameter for processing algorithms.
 
static QString typeName()
Returns the type name for the parameter class.
 
QVariant sourceCrs() const
Returns the static source CRS, or an invalid value if this is not set.
 
QVariant destinationCrs() const
Returns the static destination CRS, or an invalid value if this is not set.
 
A coordinate reference system parameter for processing algorithms.
 
static QString typeName()
Returns the type name for the parameter class.
 
A database schema parameter for processing algorithms, allowing users to select from existing schemas...
 
static QString typeName()
Returns the type name for the parameter class.
 
QString parentConnectionParameterName() const
Returns the name of the parent connection parameter, or an empty string if this is not set.
 
A database table name parameter for processing algorithms.
 
static QString typeName()
Returns the type name for the parameter class.
 
QString parentConnectionParameterName() const
Returns the name of the parent connection parameter, or an empty string if this is not set.
 
QString parentSchemaParameterName() const
Returns the name of the parent schema parameter, or an empty string if this is not set.
 
bool allowNewTableNames() const
Returns true if the parameter allows users to enter names for a new (non-existing) tables.
 
A datetime (or pure date or time) parameter for processing algorithms.
 
static QString typeName()
Returns the type name for the parameter class.
 
Qgis::ProcessingDateTimeParameterDataType dataType() const
Returns the acceptable data type for the parameter.
 
Base class for the definition of processing parameters.
 
void setFlags(Qgis::ProcessingParameterFlags flags)
Sets the flags associated with the parameter.
 
QVariantMap metadata() const
Returns the parameter's freeform metadata.
 
QString description() const
Returns the description for the parameter.
 
QVariant defaultValueForGui() const
Returns the default value to use for the parameter in a GUI.
 
virtual QString type() const =0
Unique parameter type name.
 
QString name() const
Returns the name of the parameter.
 
Qgis::ProcessingParameterFlags flags() const
Returns any flags associated with the parameter.
 
A double numeric parameter for distance values.
 
static QString typeName()
Returns the type name for the parameter class.
 
Qgis::DistanceUnit defaultUnit() const
Returns the default distance unit for the parameter.
 
A double numeric parameter for duration values.
 
Qgis::TemporalUnit defaultUnit() const
Returns the default duration unit for the parameter.
 
static QString typeName()
Returns the type name for the parameter class.
 
An enum based parameter for processing algorithms, allowing for selection from predefined values.
 
bool allowMultiple() const
Returns true if the parameter allows multiple selected values.
 
QStringList options() const
Returns the list of acceptable options for the parameter.
 
bool usesStaticStrings() const
Returns true if the parameter uses static (non-translated) string values for its enumeration choice l...
 
static QString typeName()
Returns the type name for the parameter class.
 
An expression parameter for processing algorithms.
 
QString parentLayerParameterName() const
Returns the name of the parent layer parameter, or an empty string if this is not set.
 
static QString typeName()
Returns the type name for the parameter class.
 
Qgis::ExpressionType expressionType() const
Returns the parameter's expression type.
 
A rectangular map extent 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.
 
An input feature source (such as vector layers) parameter for processing algorithms.
 
static QString typeName()
Returns the type name for the parameter class.
 
A vector layer or feature source field parameter for processing algorithms.
 
Qgis::ProcessingFieldParameterDataType dataType() const
Returns the acceptable data type for the field.
 
bool allowMultiple() const
Returns whether multiple field selections are permitted.
 
bool defaultToAllFields() const
Returns whether a parameter which allows multiple selections (see allowMultiple()) should automatical...
 
static QString typeName()
Returns the type name for the parameter class.
 
void setDataType(Qgis::ProcessingFieldParameterDataType type)
Sets the acceptable data type for the field.
 
static QString typeName()
Returns the type name for the parameter class.
 
An input file or folder parameter for processing algorithms.
 
QString extension() const
Returns any specified file extension for the parameter.
 
static QString typeName()
Returns the type name for the parameter class.
 
QString fileFilter() const
Returns the file filter string for file destinations compatible with this parameter.
 
Qgis::ProcessingFileParameterBehavior behavior() const
Returns the parameter behavior (e.g.
 
static QString typeName()
Returns the type name for the parameter class.
 
A geometry parameter for processing algorithms.
 
static QString typeName()
Returns the type name for the parameter class.
 
A print layout item parameter, allowing users to select a particular item from a print layout.
 
static QString typeName()
Returns the type name for the parameter class.
 
int itemType() const
Returns the acceptable item type, or -1 if any item type is allowed.
 
A print layout parameter, allowing users to select a print layout.
 
static QString typeName()
Returns the type name for the parameter class.
 
A map layer parameter for processing algorithms.
 
static QString typeName()
Returns the type name for the parameter class.
 
A map theme parameter for processing algorithms, allowing users to select an existing map theme from ...
 
static QString typeName()
Returns the type name for the parameter class.
 
A table (matrix) 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.
 
A parameter for processing algorithms which accepts multiple map layers.
 
static QString typeName()
Returns the type name for the parameter class.
 
A numeric parameter for processing algorithms.
 
double minimum() const
Returns the minimum value acceptable by the parameter.
 
double maximum() const
Returns the maximum value acceptable by the parameter.
 
Qgis::ProcessingNumberParameterType dataType() const
Returns the acceptable data type for the parameter.
 
static QString typeName()
Returns the type name for the parameter class.
 
A point cloud layer attribute parameter for Processing algorithms.
 
static QString typeName()
Returns the type name for the parameter class.
 
bool allowMultiple() const
Returns whether multiple field selections are permitted.
 
bool defaultToAllAttributes() const
Returns whether a parameter which allows multiple selections (see allowMultiple()) should automatical...
 
static QString typeName()
Returns the type name for the parameter class.
 
A point cloud layer parameter for processing algorithms.
 
static QString typeName()
Returns the type name for the parameter class.
 
A point parameter for processing algorithms.
 
static QString typeName()
Returns the type name for the parameter class.
 
A data provider connection parameter for processing algorithms, allowing users to select from availab...
 
static QString typeName()
Returns the type name for the parameter class.
 
QString providerId() const
Returns the ID of the provider associated with the connections.
 
A numeric range parameter for processing algorithms.
 
static QString typeName()
Returns the type name for the parameter class.
 
Qgis::ProcessingNumberParameterType dataType() const
Returns the acceptable data type for the range.
 
static QString typeName()
Returns the type name for the parameter class.
 
A raster layer parameter for processing algorithms.
 
static QString typeName()
Returns the type name for the parameter class.
 
A double numeric parameter for map scale values.
 
static QString typeName()
Returns the type name for the parameter class.
 
A string parameter for processing algorithms.
 
static QString typeName()
Returns the type name for the parameter class.
 
bool multiLine() const
Returns true if the parameter allows multiline strings.
 
static QString typeName()
Returns the type name for the parameter class.
 
A vector layer (with or without geometry) 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.
 
A double numeric parameter for volume values.
 
static QString typeName()
Returns the type name for the parameter class.
 
Qgis::VolumeUnit defaultUnit() const
Returns the default volume unit for the parameter.
 
Contains settings which reflect the context in which a Processing parameter widget is shown.
 
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
 
QgsProject * project() const
Returns the project associated with the widget.
 
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
 
QgsProcessingModelAlgorithm * model() const
Returns the model which the parameter widget is associated with.
 
QgsMapLayer * activeLayer() const
Returns the current active layer.
 
static int parameterAsEnum(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a enum value.
 
static double parameterAsDouble(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static double value.
 
static QgsPointXY parameterAsPoint(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a point.
 
static QgsPrintLayout * parameterAsLayout(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a print layout.
 
static QList< QgsMapLayer * > parameterAsLayerList(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Evaluates the parameter with matching definition to a list of map layers.
 
static QTime parameterAsTime(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static time value.
 
static QgsRectangle parameterAsExtent(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a rectangular extent.
 
static QString parameterAsEnumString(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static enum string.
 
static QList< double > parameterAsRange(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a range of values.
 
static QStringList parameterAsStrings(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of strings (e.g.
 
static QList< int > parameterAsInts(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of integer values.
 
static QString parameterAsConnectionName(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a connection name string.
 
static QgsProcessingFeatureSource * parameterAsSource(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a feature source.
 
static QgsPointCloudLayer * parameterAsPointCloudLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Evaluates the parameter with matching definition to a point cloud layer.
 
static QgsCoordinateReferenceSystem parameterAsPointCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with an point parameter value.
 
static QgsLayoutItem * parameterAsLayoutItem(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, QgsPrintLayout *layout)
Evaluates the parameter with matching definition to a print layout item, taken from the specified lay...
 
static bool parameterAsBool(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static boolean value.
 
static QColor parameterAsColor(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the color associated with an point parameter value, or an invalid color if the parameter was ...
 
static QgsVectorLayer * parameterAsVectorLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a vector layer.
 
static int parameterAsInt(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static integer value.
 
static QString parameterAsDatabaseTableName(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a database table name.
 
static QString parameterAsSchema(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a database schema name.
 
static QgsGeometry parameterAsGeometry(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
Evaluates the parameter with matching definition to a geometry.
 
static QString parameterAsExpression(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to an expression.
 
static QString parameterAsString(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static string value.
 
static QgsRasterLayer * parameterAsRasterLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a raster layer.
 
static QList< int > parameterAsEnums(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to list of enum values.
 
static QStringList parameterAsEnumStrings(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to list of static enum strings.
 
static QgsCoordinateReferenceSystem parameterAsExtentCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Returns the coordinate reference system associated with an extent parameter value.
 
static QDateTime parameterAsDateTime(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static datetime value.
 
static QDate parameterAsDate(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static date value.
 
static QVariantList parameterAsMatrix(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a matrix/table of values.
 
static QgsCoordinateReferenceSystem parameterAsCrs(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a coordinate reference system.
 
Utility functions for use with processing classes.
 
@ Annotation
Annotation layer type, since QGIS 3.22.
 
static QgsCoordinateReferenceSystem variantToCrs(const QVariant &value, QgsProcessingContext &context, const QVariant &fallbackValue=QVariant())
Converts a variant value to a coordinate reference system.
 
static QgsMapLayer * mapLayerFromString(const QString &string, QgsProcessingContext &context, bool allowLoadingNewLayers=true, QgsProcessingUtils::LayerHint typeHint=QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Interprets a string as a map layer within the supplied context.
 
@ SkipIndexGeneration
Do not generate index when creating a layer. Makes sense only for point cloud layers.
 
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
 
static QgsProject * instance()
Returns the QgsProject singleton instance.
 
QgsMapThemeCollection * mapThemeCollection
 
const QgsLayoutManager * layoutManager() const
Returns the project's layout manager, which manages print layouts, atlases and reports within the pro...
 
void layerRemoved(const QString &layerId)
Emitted after a layer was removed from the registry.
 
A store for object properties.
 
Qgis::PropertyType propertyType() const
Returns the property type.
 
A combo box which displays the list of connections registered for a given provider.
 
A combobox widget which displays the bands present in a raster layer.
 
void bandChanged(int band)
Emitted when the currently selected band changes.
 
static QString displayBandName(QgsRasterDataProvider *provider, int band)
Returns a user-friendly band name for the specified band.
 
Base class for raster data providers.
 
virtual int bandCount() const =0
Gets number of bands.
 
Represents a raster layer.
 
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
 
A rectangle specified with double values.
 
A QgsGeometry with associated coordinate reference system.
 
Responsible for drawing transient features (e.g.
 
@ ICON_X
A cross is used to highlight points (x)
 
Stores settings for use within QGIS.
 
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
 
Shows a snapping marker on map canvas for the current snapping match.
 
A spin box with a clear button that will set the value to the defined clear value.
 
A QTimeEdit widget with the capability of setting/reading null date/times.
 
void timeValueChanged(const QTime &time)
Signal emitted whenever the time changes.
 
static Q_INVOKABLE QString toString(Qgis::DistanceUnit unit)
Returns a translated string representing a distance unit.
 
static Q_INVOKABLE double fromUnitToUnitFactor(Qgis::DistanceUnit fromUnit, Qgis::DistanceUnit toUnit)
Returns the conversion factor between the specified distance units.
 
static Q_INVOKABLE Qgis::DistanceUnitType unitType(Qgis::DistanceUnit unit)
Returns the type for a distance unit.
 
static Q_INVOKABLE Qgis::AreaUnit distanceToAreaUnit(Qgis::DistanceUnit distanceUnit)
Converts a distance unit to its corresponding area unit, e.g., meters to square meters.
 
static Q_INVOKABLE Qgis::VolumeUnit distanceToVolumeUnit(Qgis::DistanceUnit distanceUnit)
Converts a distance unit to its corresponding volume unit, e.g., meters to cubic meters.
 
Represents a vector layer which manages a vector based dataset.
 
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
 
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 c
 
double qgsRound(double number, int places)
Returns a double number, rounded (as close as possible) to the specified number of places.
 
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
 
const QgsCoordinateReferenceSystem & crs