@@ -258,7 +258,7 @@ void QgsExpressionBuilderWidget::currentChanged( const QModelIndex &index, const
258
258
259
259
// Get the item
260
260
QModelIndex idx = mProxyModel ->mapToSource ( index );
261
- QgsExpressionItem *item = dynamic_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
261
+ QgsExpressionItem *item = static_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
262
262
if ( !item )
263
263
return ;
264
264
@@ -355,8 +355,8 @@ void QgsExpressionBuilderWidget::updateFunctionFileList( const QString &path )
355
355
{
356
356
// Create default sample entry.
357
357
newFunctionFile ( " default" );
358
- txtPython->setText ( QString ( " '''\n #Sample custom function file\n "
359
- " (uncomment to use and customize or Add button to create a new file) \n %1 \n '''" ).arg ( txtPython->text () ) );
358
+ txtPython->setText ( QStringLiteral ( " '''\n #Sample custom function file\n "
359
+ " (uncomment to use and customize or Add button to create a new file) \n %1 \n '''" ).arg ( txtPython->text () ) );
360
360
saveFunctionFile ( " default" );
361
361
}
362
362
}
@@ -416,7 +416,7 @@ void QgsExpressionBuilderWidget::loadFunctionCode( const QString &code )
416
416
void QgsExpressionBuilderWidget::expressionTree_doubleClicked ( const QModelIndex &index )
417
417
{
418
418
QModelIndex idx = mProxyModel ->mapToSource ( index );
419
- QgsExpressionItem *item = dynamic_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
419
+ QgsExpressionItem *item = static_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
420
420
if ( !item )
421
421
return ;
422
422
@@ -1250,7 +1250,7 @@ void QgsExpressionBuilderWidget::showContextMenu( QPoint pt )
1250
1250
{
1251
1251
QModelIndex idx = expressionTree->indexAt ( pt );
1252
1252
idx = mProxyModel ->mapToSource ( idx );
1253
- QgsExpressionItem *item = dynamic_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
1253
+ QgsExpressionItem *item = static_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
1254
1254
if ( !item )
1255
1255
return ;
1256
1256
@@ -1272,7 +1272,7 @@ void QgsExpressionBuilderWidget::showContextMenu( QPoint pt )
1272
1272
void QgsExpressionBuilderWidget::loadSampleValues ()
1273
1273
{
1274
1274
QModelIndex idx = mProxyModel ->mapToSource ( expressionTree->currentIndex () );
1275
- QgsExpressionItem *item = dynamic_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
1275
+ QgsExpressionItem *item = static_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
1276
1276
// TODO We should really return a error the user of the widget that
1277
1277
// the there is no layer set.
1278
1278
if ( !mLayer || !item )
@@ -1285,7 +1285,7 @@ void QgsExpressionBuilderWidget::loadSampleValues()
1285
1285
void QgsExpressionBuilderWidget::loadAllValues ()
1286
1286
{
1287
1287
QModelIndex idx = mProxyModel ->mapToSource ( expressionTree->currentIndex () );
1288
- QgsExpressionItem *item = dynamic_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
1288
+ QgsExpressionItem *item = static_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
1289
1289
// TODO We should really return a error the user of the widget that
1290
1290
// the there is no layer set.
1291
1291
if ( !mLayer || !item )
@@ -1298,7 +1298,7 @@ void QgsExpressionBuilderWidget::loadAllValues()
1298
1298
void QgsExpressionBuilderWidget::loadSampleUsedValues ()
1299
1299
{
1300
1300
QModelIndex idx = mProxyModel ->mapToSource ( expressionTree->currentIndex () );
1301
- QgsExpressionItem *item = dynamic_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
1301
+ QgsExpressionItem *item = static_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
1302
1302
// TODO We should really return a error the user of the widget that
1303
1303
// the there is no layer set.
1304
1304
if ( !mLayer || !item )
@@ -1311,7 +1311,7 @@ void QgsExpressionBuilderWidget::loadSampleUsedValues()
1311
1311
void QgsExpressionBuilderWidget::loadAllUsedValues ()
1312
1312
{
1313
1313
QModelIndex idx = mProxyModel ->mapToSource ( expressionTree->currentIndex () );
1314
- QgsExpressionItem *item = dynamic_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
1314
+ QgsExpressionItem *item = static_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
1315
1315
// TODO We should really return a error the user of the widget that
1316
1316
// the there is no layer set.
1317
1317
if ( !mLayer || !item )
@@ -1367,7 +1367,7 @@ void QgsExpressionBuilderWidget::editSelectedUserExpression()
1367
1367
{
1368
1368
// Get the item
1369
1369
QModelIndex idx = mProxyModel ->mapToSource ( expressionTree->currentIndex () );
1370
- QgsExpressionItem *item = dynamic_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
1370
+ QgsExpressionItem *item = static_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
1371
1371
if ( !item )
1372
1372
return ;
1373
1373
@@ -1390,7 +1390,7 @@ void QgsExpressionBuilderWidget::removeSelectedUserExpression()
1390
1390
1391
1391
// Get the item
1392
1392
QModelIndex idx = mProxyModel ->mapToSource ( expressionTree->currentIndex () );
1393
- QgsExpressionItem *item = dynamic_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
1393
+ QgsExpressionItem *item = static_cast <QgsExpressionItem *>( mModel ->itemFromIndex ( idx ) );
1394
1394
if ( !item )
1395
1395
return ;
1396
1396
@@ -1603,14 +1603,14 @@ void QgsExpressionBuilderWidget::loadExpressionsFromJson( const QJsonDocument &e
1603
1603
}
1604
1604
1605
1605
// we want to import only items of type expression for now
1606
- if ( expressionObj[" type" ].toString () != " expression" )
1606
+ if ( expressionObj[" type" ].toString () != QStringLiteral ( " expression" ) )
1607
1607
{
1608
1608
skippedExpressionLabels.append ( expressionObj[" name" ].toString () );
1609
1609
continue ;
1610
1610
}
1611
1611
1612
1612
// we want to import only items of type expression for now
1613
- if ( expressionObj[" group" ].toString () != " user" )
1613
+ if ( expressionObj[" group" ].toString () != QStringLiteral ( " user" ) )
1614
1614
{
1615
1615
skippedExpressionLabels.append ( expressionObj[" name" ].toString () );
1616
1616
continue ;
@@ -1621,7 +1621,7 @@ void QgsExpressionBuilderWidget::loadExpressionsFromJson( const QJsonDocument &e
1621
1621
const QString helpText = expressionObj[" description" ].toString ();
1622
1622
1623
1623
// make sure they have valid name
1624
- if ( label.contains ( " \\ " ) || label.contains ( " / " ) )
1624
+ if ( label.contains ( " \\ " ) || label.contains ( ' / ' ) )
1625
1625
{
1626
1626
skippedExpressionLabels.append ( expressionObj[" name" ].toString () );
1627
1627
continue ;
@@ -1657,11 +1657,11 @@ void QgsExpressionBuilderWidget::loadExpressionsFromJson( const QJsonDocument &e
1657
1657
{
1658
1658
QStringList skippedExpressionLabelsQuoted;
1659
1659
for ( const QString &skippedExpressionLabel : skippedExpressionLabels )
1660
- skippedExpressionLabelsQuoted.append ( QString ( " '%1'" ).arg ( skippedExpressionLabel ) );
1660
+ skippedExpressionLabelsQuoted.append ( QStringLiteral ( " '%1'" ).arg ( skippedExpressionLabel ) );
1661
1661
1662
1662
QMessageBox::information ( this ,
1663
1663
tr ( " Skipped Expression Imports" ),
1664
- QString ( " %1\n %2" ).arg ( tr ( " The following expressions have been skipped:" ),
1664
+ QStringLiteral ( " %1\n %2" ).arg ( tr ( " The following expressions have been skipped:" ),
1665
1665
skippedExpressionLabelsQuoted.join ( " , " ) ) );
1666
1666
}
1667
1667
}
@@ -1711,7 +1711,7 @@ const QList<QgsExpressionItem *> QgsExpressionBuilderWidget::findExpressions( co
1711
1711
const QList<QStandardItem *> found { mModel ->findItems ( label, Qt::MatchFlag::MatchRecursive ) };
1712
1712
for ( const auto &item : qgis::as_const ( found ) )
1713
1713
{
1714
- result.push_back ( dynamic_cast <QgsExpressionItem *>( item ) );
1714
+ result.push_back ( static_cast <QgsExpressionItem *>( item ) );
1715
1715
}
1716
1716
return result;
1717
1717
}
0 commit comments