Skip to content

Commit e0fa9eb

Browse files
committed
Add QStringLiteral(), QStringLiteral( "" ) and QLatin1String( "" )
to banned keywords And replace use with QString()
1 parent 07037ec commit e0fa9eb

File tree

183 files changed

+514
-503
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+514
-503
lines changed

src/app/dwg/qgsdwgimporter.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,8 @@ void QgsDwgImporter::addLType( const DRW_LType &data )
793793
}
794794
}
795795

796-
QString typeName( data.name.c_str() ), dash( QLatin1String( "" ) );
796+
QString typeName( data.name.c_str() );
797+
QString dash;
797798
if ( !upath.empty() )
798799
{
799800
QStringList l;
@@ -866,9 +867,9 @@ QString QgsDwgImporter::linetypeString( const std::string &olinetype, const std:
866867
QString linetype( olinetype.c_str() );
867868

868869
if ( linetype == QLatin1String( "bylayer" ) )
869-
return mLayerLinetype.value( layer.c_str(), QLatin1String( "" ) );
870+
return mLayerLinetype.value( layer.c_str(), QString() );
870871
else
871-
return mLinetype.value( linetype, QLatin1String( "" ) );
872+
return mLinetype.value( linetype, QString() );
872873
}
873874

874875
void QgsDwgImporter::addLayer( const DRW_Layer &data )

src/app/gps/qgsgpsinformationwidget.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -760,11 +760,11 @@ void QgsGpsInformationWidget::displayGPSInformation( const QgsGpsInformation &in
760760
mTxtVacc->setEnabled( false );
761761
mTxtVacc->setText( tr( "Not available" ) );
762762
}
763-
mTxtFixMode->setText( info.fixMode == 'A' ? tr( "Automatic" ) : info.fixMode == 'M' ? tr( "Manual" ) : QLatin1String( "" ) ); // A=automatic 2d/3d, M=manual; allowing for anything else
763+
mTxtFixMode->setText( info.fixMode == 'A' ? tr( "Automatic" ) : info.fixMode == 'M' ? tr( "Manual" ) : QString() ); // A=automatic 2d/3d, M=manual; allowing for anything else
764764
mTxtFixType->setText( info.fixType == 3 ? tr( "3D" ) : info.fixType == 2 ? tr( "2D" ) : info.fixType == 1 ? tr( "No fix" ) : QString::number( info.fixType ) ); // 1=no fix, 2=2D, 3=3D; allowing for anything else
765-
mTxtQuality->setText( info.quality == 2 ? tr( "Differential" ) : info.quality == 1 ? tr( "Non-differential" ) : info.quality == 0 ? tr( "No position" ) : info.quality > 2 ? QString::number( info.quality ) : QLatin1String( "" ) ); // allowing for anything else
765+
mTxtQuality->setText( info.quality == 2 ? tr( "Differential" ) : info.quality == 1 ? tr( "Non-differential" ) : info.quality == 0 ? tr( "No position" ) : info.quality > 2 ? QString::number( info.quality ) : QString() ); // allowing for anything else
766766
mTxtSatellitesUsed->setText( QString::number( info.satellitesUsed ) );
767-
mTxtStatus->setText( info.status == 'A' ? tr( "Valid" ) : info.status == 'V' ? tr( "Invalid" ) : QLatin1String( "" ) );
767+
mTxtStatus->setText( info.status == 'A' ? tr( "Valid" ) : info.status == 'V' ? tr( "Invalid" ) : QString() );
768768
} //position
769769

770770
// Avoid refreshing / panning if we haven't moved

src/app/pluginmanager/qgspluginmanager.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ void QgsPluginManager::reloadModelData()
509509

510510
if ( !mCurrentlyDisplayedPlugin.isEmpty() )
511511
{
512-
wvDetails->setHtml( QLatin1String( "" ) );
512+
wvDetails->setHtml( QString() );
513513
buttonInstall->setEnabled( false );
514514
buttonUninstall->setEnabled( false );
515515
}
@@ -1161,12 +1161,12 @@ void QgsPluginManager::setCurrentTab( int idx )
11611161
{
11621162
case PLUGMAN_TAB_ALL:
11631163
// all (statuses ends with Z are for spacers to always sort properly)
1164-
acceptedStatuses << QStringLiteral( "installed" ) << QStringLiteral( "not installed" ) << QStringLiteral( "new" ) << QStringLiteral( "orphan" ) << QStringLiteral( "newer" ) << QStringLiteral( "upgradeable" ) << QStringLiteral( "not installedZ" ) << QStringLiteral( "installedZ" ) << QStringLiteral( "upgradeableZ" ) << QStringLiteral( "orphanZ" ) << QStringLiteral( "newerZZ" ) << QLatin1String( "" );
1164+
acceptedStatuses << QStringLiteral( "installed" ) << QStringLiteral( "not installed" ) << QStringLiteral( "new" ) << QStringLiteral( "orphan" ) << QStringLiteral( "newer" ) << QStringLiteral( "upgradeable" ) << QStringLiteral( "not installedZ" ) << QStringLiteral( "installedZ" ) << QStringLiteral( "upgradeableZ" ) << QStringLiteral( "orphanZ" ) << QStringLiteral( "newerZZ" ) << QString();
11651165
tabTitle = QStringLiteral( "all_plugins" );
11661166
break;
11671167
case PLUGMAN_TAB_INSTALLED:
11681168
// installed (statuses ends with Z are for spacers to always sort properly)
1169-
acceptedStatuses << QStringLiteral( "installed" ) << QStringLiteral( "orphan" ) << QStringLiteral( "newer" ) << QStringLiteral( "upgradeable" ) << QStringLiteral( "installedZ" ) << QStringLiteral( "upgradeableZ" ) << QStringLiteral( "orphanZ" ) << QStringLiteral( "newerZZ" ) << QLatin1String( "" );
1169+
acceptedStatuses << QStringLiteral( "installed" ) << QStringLiteral( "orphan" ) << QStringLiteral( "newer" ) << QStringLiteral( "upgradeable" ) << QStringLiteral( "installedZ" ) << QStringLiteral( "upgradeableZ" ) << QStringLiteral( "orphanZ" ) << QStringLiteral( "newerZZ" ) << QString();
11701170
tabTitle = QStringLiteral( "installed_plugins" );
11711171
break;
11721172
case PLUGMAN_TAB_NOT_INSTALLED:

src/app/qgisapp.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -6757,7 +6757,7 @@ void QgisApp::refreshFeatureActions()
67576757
if ( !vlayer->isEditable() && action.isEnabledOnlyWhenEditable() )
67586758
continue;
67596759

6760-
QString actionTitle = !action.shortTitle().isEmpty() ? action.shortTitle() : action.icon().isNull() ? action.name() : QStringLiteral( "" );
6760+
QString actionTitle = !action.shortTitle().isEmpty() ? action.shortTitle() : action.icon().isNull() ? action.name() : QString();
67616761
QAction *qAction = new QAction( action.icon(), actionTitle, mFeatureActionMenu );
67626762
qAction->setData( QVariant::fromValue<QgsAction>( action ) );
67636763
mFeatureActionMenu->addAction( qAction );
@@ -6853,7 +6853,7 @@ void QgisApp::labelingFontNotFound( QgsVectorLayer *vlayer, const QString &fontf
68536853
act->setText( tr( "Open labeling dialog" ) );
68546854
btnOpenPrefs->addAction( act );
68556855
btnOpenPrefs->setDefaultAction( act );
6856-
btnOpenPrefs->setToolTip( QLatin1String( "" ) );
6856+
btnOpenPrefs->setToolTip( QString() );
68576857
connect( btnOpenPrefs, &QToolButton::triggered, this, &QgisApp::labelingDialogFontNotFound );
68586858

68596859
// no timeout set, since notice needs attention and is only shown first time layer is labeled
@@ -9668,7 +9668,7 @@ void QgisApp::duplicateLayers( const QList<QgsMapLayer *> &lyrList )
96689668
tr( "Duplicate layer: " ),
96699669
tr( "%1 (%2 type unsupported)" )
96709670
.arg( selectedLyr->name(),
9671-
!unSppType.isEmpty() ? QStringLiteral( "'" ) + unSppType + "' " : QLatin1String( "" ) ),
9671+
!unSppType.isEmpty() ? QStringLiteral( "'" ) + unSppType + "' " : QString() ),
96729672
Qgis::Warning,
96739673
0,
96749674
mInfoBar ) );
@@ -11105,7 +11105,7 @@ void QgisApp::closeProject()
1110511105

1110611106
mTrustedMacros = false;
1110711107

11108-
mLegendExpressionFilterButton->setExpressionText( QLatin1String( "" ) );
11108+
mLegendExpressionFilterButton->setExpressionText( QString() );
1110911109
mLegendExpressionFilterButton->setChecked( false );
1111011110
mActionFilterLegend->setChecked( false );
1111111111

@@ -13501,7 +13501,7 @@ void QgisApp::namProxyAuthenticationRequired( const QNetworkProxy &proxy, QAuthe
1350113501
if ( !settings.value( QStringLiteral( "proxy/proxyEnabled" ), false ).toBool() ||
1350213502
settings.value( QStringLiteral( "proxy/proxyType" ), "" ).toString() == QLatin1String( "DefaultProxy" ) )
1350313503
{
13504-
auth->setUser( QLatin1String( "" ) );
13504+
auth->setUser( QString() );
1350513505
return;
1350613506
}
1350713507

src/app/qgsattributeactiondialog.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void QgsAttributeActionDialog::insertRow( int row, const QgsAction &action )
141141

142142
// Icon
143143
QIcon icon = action.icon();
144-
QTableWidgetItem *headerItem = new QTableWidgetItem( icon, QLatin1String( "" ) );
144+
QTableWidgetItem *headerItem = new QTableWidgetItem( icon, QString() );
145145
headerItem->setData( Qt::UserRole, action.iconPath() );
146146
mAttributeActionTable->setVerticalHeaderItem( row, headerItem );
147147

@@ -312,15 +312,15 @@ void QgsAttributeActionDialog::updateButtons()
312312
void QgsAttributeActionDialog::addDefaultActions()
313313
{
314314
int pos = 0;
315-
insertRow( pos++, QgsAction::Generic, tr( "Echo attribute's value" ), QStringLiteral( "echo \"[% \"MY_FIELD\" %]\"" ), QLatin1String( "" ), true, tr( "Attribute Value" ), QSet<QString>() << QStringLiteral( "Field" ), QString() );
316-
insertRow( pos++, QgsAction::Generic, tr( "Run an application" ), QStringLiteral( "ogr2ogr -f \"GPKG\" \"[% \"OUTPUT_PATH\" %]\" \"[% \"INPUT_FILE\" %]\"" ), QLatin1String( "" ), true, tr( "Run application" ), QSet<QString>() << QStringLiteral( "Feature" ) << QStringLiteral( "Canvas" ), QString() );
317-
insertRow( pos++, QgsAction::GenericPython, tr( "Get feature id" ), QStringLiteral( "from qgis.PyQt import QtWidgets\n\nQtWidgets.QMessageBox.information(None, \"Feature id\", \"feature id is [% $id %]\")" ), QLatin1String( "" ), false, tr( "Feature ID" ), QSet<QString>() << QStringLiteral( "Feature" ) << QStringLiteral( "Canvas" ), QString() );
318-
insertRow( pos++, QgsAction::GenericPython, tr( "Selected field's value (Identify features tool)" ), QStringLiteral( "from qgis.PyQt import QtWidgets\n\nQtWidgets.QMessageBox.information(None, \"Current field's value\", \"[% @current_field %]\")" ), QLatin1String( "" ), false, tr( "Field Value" ), QSet<QString>() << QStringLiteral( "Field" ), QString() );
319-
insertRow( pos++, QgsAction::GenericPython, tr( "Clicked coordinates (Run feature actions tool)" ), QStringLiteral( "from qgis.PyQt import QtWidgets\n\nQtWidgets.QMessageBox.information(None, \"Clicked coords\", \"layer: [% @layer_id %]\\ncoords: ([% @click_x %],[% @click_y %])\")" ), QLatin1String( "" ), false, tr( "Clicked Coordinate" ), QSet<QString>() << QStringLiteral( "Canvas" ), QString() );
320-
insertRow( pos++, QgsAction::OpenUrl, tr( "Open file" ), QStringLiteral( "[% \"PATH\" %]" ), QLatin1String( "" ), false, tr( "Open file" ), QSet<QString>() << QStringLiteral( "Feature" ) << QStringLiteral( "Canvas" ), QString() );
321-
insertRow( pos++, QgsAction::OpenUrl, tr( "Search on web based on attribute's value" ), QStringLiteral( "http://www.google.com/search?q=[% \"ATTRIBUTE\" %]" ), QLatin1String( "" ), false, tr( "Search Web" ), QSet<QString>() << QStringLiteral( "Field" ), QString() );
322-
insertRow( pos++, QgsAction::GenericPython, tr( "List feature ids" ), QStringLiteral( "from qgis.PyQt import QtWidgets\n\nlayer = QgsProject.instance().mapLayer('[% @layer_id %]')\nif layer.selectedFeatureCount():\n ids = layer.selectedFeatureIds()\nelse:\n ids = [f.id() for f in layer.getFeatures()]\n\nQtWidgets.QMessageBox.information(None, \"Feature ids\", ', '.join([str(id) for id in ids]))" ), QLatin1String( "" ), false, tr( "List feature ids" ), QSet<QString>() << QStringLiteral( "Layer" ), QString() );
323-
insertRow( pos++, QgsAction::GenericPython, tr( "Duplicate selected features" ), QStringLiteral( "project = QgsProject.instance()\nlayer = QgsProject.instance().mapLayer('[% @layer_id %]')\nif not layer.isEditable():\n qgis.utils.iface.messageBar().pushMessage( 'Cannot duplicate feature in not editable mode on layer {layer}'.format( layer=layer.name() ) )\nelse:\n features=[]\n if len('[% $id %]')>0:\n features.append( layer.getFeature( [% $id %] ) )\n else:\n for x in layer.selectedFeatures():\n features.append( x )\n feature_count=0\n children_info=''\n featureids=[]\n for f in features:\n result=QgsVectorLayerUtils.duplicateFeature(layer, f, project, 0 )\n featureids.append( result[0].id() )\n feature_count+=1\n for ch_layer in result[1].layers():\n children_info+='{number_of_children} children on layer {children_layer}\\n'.format( number_of_children=str( len( result[1].duplicatedFeatures(ch_layer) ) ), children_layer=ch_layer.name() )\n ch_layer.selectByIds( result[1].duplicatedFeatures(ch_layer) )\n layer.selectByIds( featureids )\n qgis.utils.iface.messageBar().pushMessage( '{number_of_features} features on layer {layer} duplicated with\\n{children_info}'.format( number_of_features=str( feature_count ), layer=layer.name(), children_info=children_info ) )" ), QLatin1String( "" ), false, tr( "Duplicate selected" ), QSet<QString>() << QStringLiteral( "Layer" ), QString(), true );
315+
insertRow( pos++, QgsAction::Generic, tr( "Echo attribute's value" ), QStringLiteral( "echo \"[% \"MY_FIELD\" %]\"" ), QString(), true, tr( "Attribute Value" ), QSet<QString>() << QStringLiteral( "Field" ), QString() );
316+
insertRow( pos++, QgsAction::Generic, tr( "Run an application" ), QStringLiteral( "ogr2ogr -f \"GPKG\" \"[% \"OUTPUT_PATH\" %]\" \"[% \"INPUT_FILE\" %]\"" ), QString(), true, tr( "Run application" ), QSet<QString>() << QStringLiteral( "Feature" ) << QStringLiteral( "Canvas" ), QString() );
317+
insertRow( pos++, QgsAction::GenericPython, tr( "Get feature id" ), QStringLiteral( "from qgis.PyQt import QtWidgets\n\nQtWidgets.QMessageBox.information(None, \"Feature id\", \"feature id is [% $id %]\")" ), QString(), false, tr( "Feature ID" ), QSet<QString>() << QStringLiteral( "Feature" ) << QStringLiteral( "Canvas" ), QString() );
318+
insertRow( pos++, QgsAction::GenericPython, tr( "Selected field's value (Identify features tool)" ), QStringLiteral( "from qgis.PyQt import QtWidgets\n\nQtWidgets.QMessageBox.information(None, \"Current field's value\", \"[% @current_field %]\")" ), QString(), false, tr( "Field Value" ), QSet<QString>() << QStringLiteral( "Field" ), QString() );
319+
insertRow( pos++, QgsAction::GenericPython, tr( "Clicked coordinates (Run feature actions tool)" ), QStringLiteral( "from qgis.PyQt import QtWidgets\n\nQtWidgets.QMessageBox.information(None, \"Clicked coords\", \"layer: [% @layer_id %]\\ncoords: ([% @click_x %],[% @click_y %])\")" ), QString(), false, tr( "Clicked Coordinate" ), QSet<QString>() << QStringLiteral( "Canvas" ), QString() );
320+
insertRow( pos++, QgsAction::OpenUrl, tr( "Open file" ), QStringLiteral( "[% \"PATH\" %]" ), QString(), false, tr( "Open file" ), QSet<QString>() << QStringLiteral( "Feature" ) << QStringLiteral( "Canvas" ), QString() );
321+
insertRow( pos++, QgsAction::OpenUrl, tr( "Search on web based on attribute's value" ), QStringLiteral( "http://www.google.com/search?q=[% \"ATTRIBUTE\" %]" ), QString(), false, tr( "Search Web" ), QSet<QString>() << QStringLiteral( "Field" ), QString() );
322+
insertRow( pos++, QgsAction::GenericPython, tr( "List feature ids" ), QStringLiteral( "from qgis.PyQt import QtWidgets\n\nlayer = QgsProject.instance().mapLayer('[% @layer_id %]')\nif layer.selectedFeatureCount():\n ids = layer.selectedFeatureIds()\nelse:\n ids = [f.id() for f in layer.getFeatures()]\n\nQtWidgets.QMessageBox.information(None, \"Feature ids\", ', '.join([str(id) for id in ids]))" ), QString(), false, tr( "List feature ids" ), QSet<QString>() << QStringLiteral( "Layer" ), QString() );
323+
insertRow( pos++, QgsAction::GenericPython, tr( "Duplicate selected features" ), QStringLiteral( "project = QgsProject.instance()\nlayer = QgsProject.instance().mapLayer('[% @layer_id %]')\nif not layer.isEditable():\n qgis.utils.iface.messageBar().pushMessage( 'Cannot duplicate feature in not editable mode on layer {layer}'.format( layer=layer.name() ) )\nelse:\n features=[]\n if len('[% $id %]')>0:\n features.append( layer.getFeature( [% $id %] ) )\n else:\n for x in layer.selectedFeatures():\n features.append( x )\n feature_count=0\n children_info=''\n featureids=[]\n for f in features:\n result=QgsVectorLayerUtils.duplicateFeature(layer, f, project, 0 )\n featureids.append( result[0].id() )\n feature_count+=1\n for ch_layer in result[1].layers():\n children_info+='{number_of_children} children on layer {children_layer}\\n'.format( number_of_children=str( len( result[1].duplicatedFeatures(ch_layer) ) ), children_layer=ch_layer.name() )\n ch_layer.selectByIds( result[1].duplicatedFeatures(ch_layer) )\n layer.selectByIds( featureids )\n qgis.utils.iface.messageBar().pushMessage( '{number_of_features} features on layer {layer} duplicated with\\n{children_info}'.format( number_of_features=str( feature_count ), layer=layer.name(), children_info=children_info ) )" ), QString(), false, tr( "Duplicate selected" ), QSet<QString>() << QStringLiteral( "Layer" ), QString(), true );
324324

325325
}
326326

src/app/qgsbookmarks.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void QgsBookmarks::addClicked()
155155
QgsMapCanvas *canvas = QgisApp::instance()->mapCanvas();
156156
Q_ASSERT( canvas );
157157

158-
QString projStr( QLatin1String( "" ) );
158+
QString projStr;
159159
if ( QgsProject::instance() )
160160
{
161161
if ( !QgsProject::instance()->title().isEmpty() )
@@ -165,7 +165,7 @@ void QgsBookmarks::addClicked()
165165
else if ( !QgsProject::instance()->fileName().isEmpty() )
166166
{
167167
QFileInfo fi( QgsProject::instance()->fileName() );
168-
projStr = fi.exists() ? fi.fileName() : QLatin1String( "" );
168+
projStr = fi.exists() ? fi.fileName() : QString();
169169
}
170170
}
171171

src/app/qgscustomization.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ QTreeWidgetItem *QgsCustomizationDialog::readWidgetsXmlNode( const QDomNode &nod
344344
{
345345
QDomElement myElement = node.toElement();
346346

347-
QString name = myElement.attribute( QStringLiteral( "objectName" ), QLatin1String( "" ) );
347+
QString name = myElement.attribute( QStringLiteral( "objectName" ), QString() );
348348
QStringList data( name );
349349

350350
data << myElement.attribute( QStringLiteral( "label" ), name );
@@ -353,7 +353,7 @@ QTreeWidgetItem *QgsCustomizationDialog::readWidgetsXmlNode( const QDomNode &nod
353353

354354
// It is nice to have icons for each Qt widget class, is it too heavy?
355355
// There are 47 png files, total 196K in qt/tools/designer/src/components/formeditor/images/
356-
QString iconName = myElement.attribute( QStringLiteral( "class" ), QLatin1String( "" ) ).toLower().mid( 1 ) + ".png";
356+
QString iconName = myElement.attribute( QStringLiteral( "class" ), QString() ).toLower().mid( 1 ) + ".png";
357357
QString iconPath = QgsApplication::iconPath( "/customization/" + iconName );
358358
QgsDebugMsg( "iconPath = " + iconPath );
359359
if ( QFile::exists( iconPath ) )

src/app/qgsdxfexportdialog.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,9 @@ QgsDxfExportDialog::QgsDxfExportDialog( QWidget *parent, Qt::WindowFlags f )
475475
mMTextCheckBox->setChecked( QgsProject::instance()->readEntry( QStringLiteral( "dxf" ), QStringLiteral( "/lastDxfUseMText" ), settings.value( QStringLiteral( "qgis/lastDxfUseMText" ), "true" ).toString() ) != QLatin1String( "false" ) );
476476

477477
QStringList ids = QgsProject::instance()->mapThemeCollection()->mapThemes();
478-
ids.prepend( QLatin1String( "" ) );
478+
ids.prepend( QString() );
479479
mVisibilityPresets->addItems( ids );
480-
mVisibilityPresets->setCurrentIndex( mVisibilityPresets->findText( QgsProject::instance()->readEntry( QStringLiteral( "dxf" ), QStringLiteral( "/lastVisibliltyPreset" ), QLatin1String( "" ) ) ) );
480+
mVisibilityPresets->setCurrentIndex( mVisibilityPresets->findText( QgsProject::instance()->readEntry( QStringLiteral( "dxf" ), QStringLiteral( "/lastVisibliltyPreset" ), QString() ) ) );
481481

482482
buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
483483

src/app/qgsfieldcalculator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ void QgsFieldCalculator::setOkButtonState()
484484
return;
485485
}
486486

487-
okButton->setToolTip( QLatin1String( "" ) );
487+
okButton->setToolTip( QString() );
488488
okButton->setEnabled( true );
489489
}
490490

src/app/qgshandlebadlayers.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ QgsHandleBadLayers::QgsHandleBadLayers( const QList<QDomNode> &layers )
135135
}
136136
else
137137
{
138-
item = new QTableWidgetItem( QLatin1String( "" ) );
138+
item = new QTableWidgetItem( QString() );
139139
mLayerList->setItem( j, 3, item );
140140
}
141141

0 commit comments

Comments
 (0)