@@ -1217,6 +1217,9 @@ bool QgsProcessingParameterDefinition::checkValueIsAcceptable( const QVariant &i
1217
1217
1218
1218
QString QgsProcessingParameterDefinition::valueAsPythonString ( const QVariant &value, QgsProcessingContext & ) const
1219
1219
{
1220
+ if ( !value.isValid () )
1221
+ return QStringLiteral ( " None" );
1222
+
1220
1223
if ( value.canConvert <QgsProperty>() )
1221
1224
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
1222
1225
@@ -1283,6 +1286,9 @@ QgsProcessingParameterDefinition *QgsProcessingParameterBoolean::clone() const
1283
1286
1284
1287
QString QgsProcessingParameterBoolean::valueAsPythonString ( const QVariant &val, QgsProcessingContext & ) const
1285
1288
{
1289
+ if ( !val.isValid () )
1290
+ return QStringLiteral ( " None" );
1291
+
1286
1292
if ( val.canConvert <QgsProperty>() )
1287
1293
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( val.value < QgsProperty >().asExpression () );
1288
1294
return val.toBool () ? QStringLiteral ( " True" ) : QStringLiteral ( " False" );
@@ -1336,6 +1342,9 @@ bool QgsProcessingParameterCrs::checkValueIsAcceptable( const QVariant &input, Q
1336
1342
1337
1343
QString QgsProcessingParameterCrs::valueAsPythonString ( const QVariant &value, QgsProcessingContext &context ) const
1338
1344
{
1345
+ if ( !value.isValid () )
1346
+ return QStringLiteral ( " None" );
1347
+
1339
1348
if ( value.canConvert <QgsProperty>() )
1340
1349
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
1341
1350
@@ -1397,6 +1406,9 @@ bool QgsProcessingParameterMapLayer::checkValueIsAcceptable( const QVariant &inp
1397
1406
1398
1407
QString QgsProcessingParameterMapLayer::valueAsPythonString ( const QVariant &val, QgsProcessingContext &context ) const
1399
1408
{
1409
+ if ( !val.isValid () )
1410
+ return QStringLiteral ( " None" );
1411
+
1400
1412
if ( val.canConvert <QgsProperty>() )
1401
1413
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( val.value < QgsProperty >().asExpression () );
1402
1414
@@ -1479,6 +1491,9 @@ bool QgsProcessingParameterExtent::checkValueIsAcceptable( const QVariant &input
1479
1491
1480
1492
QString QgsProcessingParameterExtent::valueAsPythonString ( const QVariant &value, QgsProcessingContext &context ) const
1481
1493
{
1494
+ if ( !value.isValid () )
1495
+ return QStringLiteral ( " None" );
1496
+
1482
1497
if ( value.canConvert <QgsProperty>() )
1483
1498
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
1484
1499
@@ -1566,6 +1581,9 @@ bool QgsProcessingParameterPoint::checkValueIsAcceptable( const QVariant &input,
1566
1581
1567
1582
QString QgsProcessingParameterPoint::valueAsPythonString ( const QVariant &value, QgsProcessingContext &context ) const
1568
1583
{
1584
+ if ( !value.isValid () )
1585
+ return QStringLiteral ( " None" );
1586
+
1569
1587
if ( value.canConvert <QgsProperty>() )
1570
1588
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
1571
1589
@@ -1706,6 +1724,9 @@ bool QgsProcessingParameterMatrix::checkValueIsAcceptable( const QVariant &input
1706
1724
1707
1725
QString QgsProcessingParameterMatrix::valueAsPythonString ( const QVariant &value, QgsProcessingContext &context ) const
1708
1726
{
1727
+ if ( !value.isValid () )
1728
+ return QStringLiteral ( " None" );
1729
+
1709
1730
if ( value.canConvert <QgsProperty>() )
1710
1731
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
1711
1732
@@ -1866,6 +1887,9 @@ bool QgsProcessingParameterMultipleLayers::checkValueIsAcceptable( const QVarian
1866
1887
1867
1888
QString QgsProcessingParameterMultipleLayers::valueAsPythonString ( const QVariant &value, QgsProcessingContext &context ) const
1868
1889
{
1890
+ if ( !value.isValid () )
1891
+ return QStringLiteral ( " None" );
1892
+
1869
1893
if ( value.canConvert <QgsProperty>() )
1870
1894
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
1871
1895
@@ -2017,6 +2041,9 @@ bool QgsProcessingParameterNumber::checkValueIsAcceptable( const QVariant &input
2017
2041
2018
2042
QString QgsProcessingParameterNumber::valueAsPythonString ( const QVariant &value, QgsProcessingContext & ) const
2019
2043
{
2044
+ if ( !value.isValid () )
2045
+ return QStringLiteral ( " None" );
2046
+
2020
2047
if ( value.canConvert <QgsProperty>() )
2021
2048
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
2022
2049
@@ -2147,6 +2174,9 @@ bool QgsProcessingParameterRange::checkValueIsAcceptable( const QVariant &input,
2147
2174
2148
2175
QString QgsProcessingParameterRange::valueAsPythonString ( const QVariant &value, QgsProcessingContext &context ) const
2149
2176
{
2177
+ if ( !value.isValid () )
2178
+ return QStringLiteral ( " None" );
2179
+
2150
2180
if ( value.canConvert <QgsProperty>() )
2151
2181
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
2152
2182
@@ -2233,6 +2263,9 @@ bool QgsProcessingParameterRasterLayer::checkValueIsAcceptable( const QVariant &
2233
2263
2234
2264
QString QgsProcessingParameterRasterLayer::valueAsPythonString ( const QVariant &val, QgsProcessingContext &context ) const
2235
2265
{
2266
+ if ( !val.isValid () )
2267
+ return QStringLiteral ( " None" );
2268
+
2236
2269
if ( val.canConvert <QgsProperty>() )
2237
2270
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( val.value < QgsProperty >().asExpression () );
2238
2271
@@ -2322,6 +2355,9 @@ bool QgsProcessingParameterEnum::checkValueIsAcceptable( const QVariant &input,
2322
2355
2323
2356
QString QgsProcessingParameterEnum::valueAsPythonString ( const QVariant &value, QgsProcessingContext & ) const
2324
2357
{
2358
+ if ( !value.isValid () )
2359
+ return QStringLiteral ( " None" );
2360
+
2325
2361
if ( value.canConvert <QgsProperty>() )
2326
2362
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
2327
2363
@@ -2435,6 +2471,9 @@ QgsProcessingParameterDefinition *QgsProcessingParameterString::clone() const
2435
2471
2436
2472
QString QgsProcessingParameterString::valueAsPythonString ( const QVariant &value, QgsProcessingContext & ) const
2437
2473
{
2474
+ if ( !value.isValid () )
2475
+ return QStringLiteral ( " None" );
2476
+
2438
2477
if ( value.canConvert <QgsProperty>() )
2439
2478
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
2440
2479
@@ -2517,6 +2556,9 @@ QgsProcessingParameterDefinition *QgsProcessingParameterExpression::clone() cons
2517
2556
2518
2557
QString QgsProcessingParameterExpression::valueAsPythonString ( const QVariant &value, QgsProcessingContext & ) const
2519
2558
{
2559
+ if ( !value.isValid () )
2560
+ return QStringLiteral ( " None" );
2561
+
2520
2562
if ( value.canConvert <QgsProperty>() )
2521
2563
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
2522
2564
@@ -2605,6 +2647,9 @@ bool QgsProcessingParameterVectorLayer::checkValueIsAcceptable( const QVariant &
2605
2647
2606
2648
QString QgsProcessingParameterVectorLayer::valueAsPythonString ( const QVariant &val, QgsProcessingContext &context ) const
2607
2649
{
2650
+ if ( !val.isValid () )
2651
+ return QStringLiteral ( " None" );
2652
+
2608
2653
if ( val.canConvert <QgsProperty>() )
2609
2654
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( val.value < QgsProperty >().asExpression () );
2610
2655
@@ -2705,6 +2750,9 @@ bool QgsProcessingParameterField::checkValueIsAcceptable( const QVariant &input,
2705
2750
2706
2751
QString QgsProcessingParameterField::valueAsPythonString ( const QVariant &value, QgsProcessingContext & ) const
2707
2752
{
2753
+ if ( !value.isValid () )
2754
+ return QStringLiteral ( " None" );
2755
+
2708
2756
if ( value.canConvert <QgsProperty>() )
2709
2757
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
2710
2758
@@ -2916,6 +2964,9 @@ bool QgsProcessingParameterFeatureSource::checkValueIsAcceptable( const QVariant
2916
2964
2917
2965
QString QgsProcessingParameterFeatureSource::valueAsPythonString ( const QVariant &value, QgsProcessingContext &context ) const
2918
2966
{
2967
+ if ( !value.isValid () )
2968
+ return QStringLiteral ( " None" );
2969
+
2919
2970
if ( value.canConvert <QgsProperty>() )
2920
2971
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
2921
2972
@@ -3087,6 +3138,9 @@ bool QgsProcessingParameterFeatureSink::checkValueIsAcceptable( const QVariant &
3087
3138
3088
3139
QString QgsProcessingParameterFeatureSink::valueAsPythonString ( const QVariant &value, QgsProcessingContext & ) const
3089
3140
{
3141
+ if ( !value.isValid () )
3142
+ return QStringLiteral ( " None" );
3143
+
3090
3144
if ( value.canConvert <QgsProperty>() )
3091
3145
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
3092
3146
@@ -3280,6 +3334,9 @@ bool QgsProcessingParameterRasterDestination::checkValueIsAcceptable( const QVar
3280
3334
3281
3335
QString QgsProcessingParameterRasterDestination::valueAsPythonString ( const QVariant &value, QgsProcessingContext & ) const
3282
3336
{
3337
+ if ( !value.isValid () )
3338
+ return QStringLiteral ( " None" );
3339
+
3283
3340
if ( value.canConvert <QgsProperty>() )
3284
3341
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
3285
3342
@@ -3365,6 +3422,9 @@ bool QgsProcessingParameterFileDestination::checkValueIsAcceptable( const QVaria
3365
3422
3366
3423
QString QgsProcessingParameterFileDestination::valueAsPythonString ( const QVariant &value, QgsProcessingContext & ) const
3367
3424
{
3425
+ if ( !value.isValid () )
3426
+ return QStringLiteral ( " None" );
3427
+
3368
3428
if ( value.canConvert <QgsProperty>() )
3369
3429
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
3370
3430
@@ -3561,6 +3621,9 @@ bool QgsProcessingParameterVectorDestination::checkValueIsAcceptable( const QVar
3561
3621
3562
3622
QString QgsProcessingParameterVectorDestination::valueAsPythonString ( const QVariant &value, QgsProcessingContext & ) const
3563
3623
{
3624
+ if ( !value.isValid () )
3625
+ return QStringLiteral ( " None" );
3626
+
3564
3627
if ( value.canConvert <QgsProperty>() )
3565
3628
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
3566
3629
@@ -3733,6 +3796,9 @@ bool QgsProcessingParameterBand::checkValueIsAcceptable( const QVariant &input,
3733
3796
3734
3797
QString QgsProcessingParameterBand::valueAsPythonString ( const QVariant &value, QgsProcessingContext & ) const
3735
3798
{
3799
+ if ( !value.isValid () )
3800
+ return QStringLiteral ( " None" );
3801
+
3736
3802
if ( value.canConvert <QgsProperty>() )
3737
3803
return QStringLiteral ( " QgsProperty.fromExpression('%1')" ).arg ( value.value < QgsProperty >().asExpression () );
3738
3804
0 commit comments