Skip to content
Permalink
Browse files

Add QStringLiteral(), QStringLiteral( "" ) and QLatin1String( "" )

to banned keywords

And replace use with QString()
  • Loading branch information
nyalldawson committed Aug 28, 2018
1 parent 07037ec commit e0fa9eb9cf20d3153489bc995e13b10e30240bd5
Showing with 514 additions and 503 deletions.
  1. +4 −3 src/app/dwg/qgsdwgimporter.cpp
  2. +3 −3 src/app/gps/qgsgpsinformationwidget.cpp
  3. +3 −3 src/app/pluginmanager/qgspluginmanager.cpp
  4. +5 −5 src/app/qgisapp.cpp
  5. +10 −10 src/app/qgsattributeactiondialog.cpp
  6. +2 −2 src/app/qgsbookmarks.cpp
  7. +2 −2 src/app/qgscustomization.cpp
  8. +2 −2 src/app/qgsdxfexportdialog.cpp
  9. +1 −1 src/app/qgsfieldcalculator.cpp
  10. +1 −1 src/app/qgshandlebadlayers.cpp
  11. +4 −4 src/app/qgsidentifyresultsdialog.cpp
  12. +4 −4 src/app/qgsloadstylefromdbdialog.cpp
  13. +3 −3 src/app/qgsmaptoollabel.cpp
  14. +2 −2 src/app/qgsnewspatialitelayerdialog.cpp
  15. +28 −28 src/app/qgsprojectproperties.cpp
  16. +1 −1 src/app/qgsrastercalcdialog.cpp
  17. +1 −1 src/app/qgsrasterlayerproperties.cpp
  18. +2 −2 src/app/qgssettingstree.cpp
  19. +1 −1 src/app/qgsvariantdelegate.cpp
  20. +1 −1 src/app/qgsvectorlayerproperties.cpp
  21. +4 −4 src/auth/pkipaths/qgsauthpkipathsedit.cpp
  22. +3 −3 src/auth/pkipkcs12/qgsauthpkcs12edit.cpp
  23. +1 −1 src/auth/pkipkcs12/qgsauthpkcs12method.cpp
  24. +1 −1 src/core/annotations/qgshtmlannotation.cpp
  25. +1 −1 src/core/auth/qgsauthconfig.cpp
  26. +1 −1 src/core/auth/qgsauthmanager.cpp
  27. +4 −4 src/core/dxf/qgsdxfexport.cpp
  28. +1 −1 src/core/expression/qgsexpression.cpp
  29. +11 −11 src/core/layout/qgscompositionconverter.cpp
  30. +2 −2 src/core/layout/qgslayoutitemattributetable.cpp
  31. +1 −1 src/core/layout/qgslayoutitemmapgrid.cpp
  32. +1 −1 src/core/layout/qgslayoutitempicture.cpp
  33. +2 −2 src/core/layout/qgslayoutitempolyline.cpp
  34. +2 −2 src/core/layout/qgslayoutitemscalebar.cpp
  35. +2 −2 src/core/layout/qgslayouttable.cpp
  36. +2 −2 src/core/layout/qgslayouttablecolumn.cpp
  37. +2 −2 src/core/providers/memory/qgsmemoryprovider.cpp
  38. +1 −1 src/core/qgis.cpp
  39. +2 −2 src/core/qgsapplication.cpp
  40. +1 −1 src/core/qgsauxiliarystorage.cpp
  41. +1 −1 src/core/qgsbrowsermodel.cpp
  42. +1 −1 src/core/qgscolorramp.cpp
  43. +2 −2 src/core/qgsdataprovider.h
  44. +5 −5 src/core/qgsgmlschema.cpp
  45. +3 −3 src/core/qgslegendstyle.cpp
  46. +6 −6 src/core/qgsmaplayer.cpp
  47. +1 −1 src/core/qgsmessageoutput.cpp
  48. +1 −1 src/core/qgsmultirenderchecker.cpp
  49. +1 −1 src/core/qgsofflineediting.cpp
  50. +3 −3 src/core/qgspallabeling.cpp
  51. +1 −1 src/core/qgspathresolver.cpp
  52. +1 −1 src/core/qgsprojectfiletransform.cpp
  53. +1 −1 src/core/qgsvectordataprovider.cpp
  54. +27 −27 src/core/qgsvectorfilewriter.cpp
  55. +1 −1 src/core/qgsvectorfilewriter.h
  56. +2 −2 src/core/qgsvirtuallayerdefinition.cpp
  57. +1 −1 src/core/raster/qgsrasterlayer.cpp
  58. +3 −3 src/core/symbology/qgscategorizedsymbolrenderer.cpp
  59. +1 −1 src/core/symbology/qgscptcityarchive.cpp
  60. +4 −4 src/core/symbology/qgsellipsesymbollayer.cpp
  61. +12 −12 src/core/symbology/qgsfillsymbollayer.cpp
  62. +2 −2 src/core/symbology/qgsgraduatedsymbolrenderer.cpp
  63. +6 −6 src/core/symbology/qgslinesymbollayer.cpp
  64. +3 −3 src/core/symbology/qgspointdisplacementrenderer.cpp
  65. +3 −3 src/core/symbology/qgsrulebasedrenderer.cpp
  66. +1 −1 src/core/symbology/qgssinglesymbolrenderer.cpp
  67. +1 −1 src/core/symbology/qgssymbol.cpp
  68. +3 −3 src/core/symbology/qgssymbollayer.cpp
  69. +9 −9 src/core/symbology/qgssymbollayerutils.cpp
  70. +1 −1 src/gui/attributetable/qgsattributetableview.cpp
  71. +3 −3 src/gui/auth/qgsauthcertificateinfo.cpp
  72. +1 −1 src/gui/auth/qgsauthcerttrustpolicycombobox.cpp
  73. +1 −1 src/gui/auth/qgsauthconfigedit.cpp
  74. +2 −2 src/gui/auth/qgsauthconfigidedit.cpp
  75. +5 −5 src/gui/auth/qgsauthconfigselect.cpp
  76. +2 −2 src/gui/auth/qgsauthguiutils.cpp
  77. +1 −1 src/gui/auth/qgsauthimportcertdialog.cpp
  78. +3 −3 src/gui/auth/qgsauthimportidentitydialog.cpp
  79. +4 −4 src/gui/auth/qgsauthsslconfigwidget.cpp
  80. +3 −3 src/gui/auth/qgsauthsslimportdialog.cpp
  81. +1 −1 src/gui/editorwidgets/qgstexteditwrapper.cpp
  82. +2 −2 src/gui/ogr/qgsnewogrconnection.cpp
  83. +1 −1 src/gui/qgscolorrampbutton.cpp
  84. +4 −4 src/gui/qgscredentialdialog.cpp
  85. +1 −1 src/gui/qgserrordialog.cpp
  86. +1 −1 src/gui/qgsfieldcombobox.cpp
  87. +1 −1 src/gui/qgsfieldexpressionwidget.cpp
  88. +1 −1 src/gui/qgsfieldvalidator.cpp
  89. +1 −1 src/gui/qgsformannotation.cpp
  90. +1 −1 src/gui/qgskeyvaluewidget.cpp
  91. +1 −1 src/gui/qgslegendfilterbutton.cpp
  92. +1 −1 src/gui/qgsmaplayerstylemanagerwidget.cpp
  93. +1 −1 src/gui/qgsmaptoolidentify.cpp
  94. +3 −3 src/gui/qgsnewvectorlayerdialog.cpp
  95. +2 −2 src/gui/qgsorderbydialog.cpp
  96. +3 −3 src/gui/qgsprojectionselectiontreewidget.cpp
  97. +3 −3 src/gui/qgsquerybuilder.cpp
  98. +5 −5 src/gui/qgsrasterformatsaveoptionswidget.cpp
  99. +1 −1 src/gui/qgsshortcutsmanager.cpp
  100. +7 −7 src/gui/qgssqlcomposerdialog.cpp
  101. +1 −1 src/gui/qgstextformatwidget.cpp
  102. +2 −2 src/gui/raster/qgsrasterhistogramwidget.cpp
  103. +1 −1 src/gui/raster/qgsrastertransparencywidget.cpp
  104. +1 −1 src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp
  105. +3 −3 src/gui/symbology/qgscptcitycolorrampdialog.cpp
  106. +1 −1 src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp
  107. +1 −1 src/gui/symbology/qgspointdisplacementrendererwidget.cpp
  108. +1 −1 src/gui/symbology/qgsstylegroupselectiondialog.cpp
  109. +2 −2 src/gui/symbology/qgsstylemanagerdialog.cpp
  110. +2 −2 src/gui/symbology/qgsvectorfieldsymbollayerwidget.cpp
  111. +2 −2 src/plugins/coordinate_capture/coordinatecapture.cpp
  112. +1 −1 src/plugins/geometry_checker/qgsgeometrycheckerresulttab.cpp
  113. +1 −1 src/plugins/georeferencer/qgsgeorefplugin.cpp
  114. +3 −3 src/plugins/georeferencer/qgsgeorefplugingui.cpp
  115. +1 −1 src/plugins/gps_importer/qgsgpsplugin.cpp
  116. +1 −1 src/plugins/grass/qgsgrassmapcalc.cpp
  117. +2 −2 src/plugins/grass/qgsgrassmodule.cpp
  118. +4 −4 src/plugins/grass/qgsgrassmoduleinput.cpp
  119. +9 −9 src/plugins/grass/qgsgrassmoduleparam.cpp
  120. +2 −2 src/plugins/grass/qgsgrassnewmapset.cpp
  121. +5 −5 src/plugins/grass/qgsgrassplugin.cpp
  122. +2 −2 src/plugins/grass/qgsgrassshell.cpp
  123. +1 −1 src/plugins/grass/qgsgrasstools.cpp
  124. +4 −4 src/plugins/topology/rulesDialog.cpp
  125. +1 −1 src/providers/arcgisrest/qgsarcgisrestutils.cpp
  126. +2 −2 src/providers/arcgisrest/qgsarcgisservicesourceselect.cpp
  127. +2 −2 src/providers/db2/qgsdb2newconnection.cpp
  128. +2 −2 src/providers/db2/qgsdb2sourceselect.cpp
  129. +1 −1 src/providers/db2/qgsdb2tablemodel.cpp
  130. +1 −1 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
  131. +2 −2 src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp
  132. +1 −1 src/providers/grass/qgis.v.in.cpp
  133. +13 −13 src/providers/grass/qgsgrass.cpp
  134. +4 −4 src/providers/grass/qgsgrassimport.cpp
  135. +7 −7 src/providers/grass/qgsgrassprovidermodule.cpp
  136. +2 −2 src/providers/mssql/qgsmssqlgeomcolumntypethread.cpp
  137. +2 −2 src/providers/mssql/qgsmssqlnewconnection.cpp
  138. +1 −1 src/providers/mssql/qgsmssqlsourceselect.cpp
  139. +1 −1 src/providers/mssql/qgsmssqltablemodel.cpp
  140. +4 −4 src/providers/ogr/qgsogrdataitems.cpp
  141. +2 −2 src/providers/ogr/qgsogrdbsourceselect.cpp
  142. +5 −5 src/providers/ogr/qgsogrprovider.cpp
  143. +2 −2 src/providers/postgres/qgspgnewconnection.cpp
  144. +1 −1 src/providers/postgres/qgspgsourceselect.cpp
  145. +5 −5 src/providers/postgres/qgspgtablemodel.cpp
  146. +2 −2 src/providers/postgres/qgspostgresconn.cpp
  147. +2 −1 src/providers/postgres/qgspostgresfeatureiterator.cpp
  148. +8 −8 src/providers/postgres/qgspostgresprovider.cpp
  149. +1 −1 src/providers/spatialite/qgsspatialitefeatureiterator.cpp
  150. +7 −7 src/providers/spatialite/qgsspatialiteprovider.cpp
  151. +4 −4 src/providers/spatialite/qgsspatialitesourceselect.cpp
  152. +1 −1 src/providers/spatialite/qgsspatialitetablemodel.cpp
  153. +2 −2 src/providers/virtual/qgsvirtuallayerprovider.cpp
  154. +1 −1 src/providers/wcs/qgswcsdataitems.cpp
  155. +1 −1 src/providers/wcs/qgswcsprovider.cpp
  156. +1 −1 src/providers/wfs/qgswfscapabilities.cpp
  157. +1 −1 src/providers/wfs/qgswfsfeatureiterator.cpp
  158. +1 −1 src/providers/wfs/qgswfsprovider.cpp
  159. +3 −3 src/providers/wfs/qgswfssourceselect.cpp
  160. +2 −2 src/providers/wms/qgswmsdataitems.cpp
  161. +5 −5 src/providers/wms/qgswmsprovider.cpp
  162. +3 −3 src/providers/wms/qgswmssourceselect.cpp
  163. +1 −1 src/server/services/wfs/qgswfsdescribefeaturetype.cpp
  164. +5 −5 src/server/services/wfs/qgswfsgetfeature.cpp
  165. +9 −0 tests/code_layout/test_banned_keywords.sh
  166. +1 −1 tests/src/analysis/testqgszonalstatistics.cpp
  167. +1 −1 tests/src/app/testqgsmaptoolidentifyaction.cpp
  168. +5 −5 tests/src/core/testqgscoordinatereferencesystem.cpp
  169. +1 −1 tests/src/core/testqgsdataitem.cpp
  170. +1 −1 tests/src/core/testqgsexpression.cpp
  171. +2 −2 tests/src/core/testqgsfields.cpp
  172. +9 −9 tests/src/core/testqgsgml.cpp
  173. +2 −2 tests/src/core/testqgsogcutils.cpp
  174. +2 −2 tests/src/core/testqgsogrutils.cpp
  175. +2 −2 tests/src/core/testqgsproperty.cpp
  176. +1 −1 tests/src/core/testqgsrasterlayer.cpp
  177. +2 −2 tests/src/core/testqgsstyle.cpp
  178. +5 −5 tests/src/core/testziplayer.cpp
  179. +1 −1 tests/src/gui/testqgsfiledownloader.cpp
  180. +1 −1 tests/src/gui/testqgsscalecombobox.cpp
  181. +3 −3 tests/src/gui/testqgssqlcomposerdialog.cpp
  182. +1 −1 tests/src/gui/testqgsvaluerelationwidgetwrapper.cpp
  183. +2 −2 tests/src/providers/testqgswcspublicservers.cpp
@@ -793,7 +793,8 @@ void QgsDwgImporter::addLType( const DRW_LType &data )
}
}

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

if ( linetype == QLatin1String( "bylayer" ) )
return mLayerLinetype.value( layer.c_str(), QLatin1String( "" ) );
return mLayerLinetype.value( layer.c_str(), QString() );
else
return mLinetype.value( linetype, QLatin1String( "" ) );
return mLinetype.value( linetype, QString() );
}

void QgsDwgImporter::addLayer( const DRW_Layer &data )
@@ -760,11 +760,11 @@ void QgsGpsInformationWidget::displayGPSInformation( const QgsGpsInformation &in
mTxtVacc->setEnabled( false );
mTxtVacc->setText( tr( "Not available" ) );
}
mTxtFixMode->setText( info.fixMode == 'A' ? tr( "Automatic" ) : info.fixMode == 'M' ? tr( "Manual" ) : QLatin1String( "" ) ); // A=automatic 2d/3d, M=manual; allowing for anything else
mTxtFixMode->setText( info.fixMode == 'A' ? tr( "Automatic" ) : info.fixMode == 'M' ? tr( "Manual" ) : QString() ); // A=automatic 2d/3d, M=manual; allowing for anything else
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
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
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
mTxtSatellitesUsed->setText( QString::number( info.satellitesUsed ) );
mTxtStatus->setText( info.status == 'A' ? tr( "Valid" ) : info.status == 'V' ? tr( "Invalid" ) : QLatin1String( "" ) );
mTxtStatus->setText( info.status == 'A' ? tr( "Valid" ) : info.status == 'V' ? tr( "Invalid" ) : QString() );
} //position

// Avoid refreshing / panning if we haven't moved
@@ -509,7 +509,7 @@ void QgsPluginManager::reloadModelData()

if ( !mCurrentlyDisplayedPlugin.isEmpty() )
{
wvDetails->setHtml( QLatin1String( "" ) );
wvDetails->setHtml( QString() );
buttonInstall->setEnabled( false );
buttonUninstall->setEnabled( false );
}
@@ -1161,12 +1161,12 @@ void QgsPluginManager::setCurrentTab( int idx )
{
case PLUGMAN_TAB_ALL:
// all (statuses ends with Z are for spacers to always sort properly)
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( "" );
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();
tabTitle = QStringLiteral( "all_plugins" );
break;
case PLUGMAN_TAB_INSTALLED:
// installed (statuses ends with Z are for spacers to always sort properly)
acceptedStatuses << QStringLiteral( "installed" ) << QStringLiteral( "orphan" ) << QStringLiteral( "newer" ) << QStringLiteral( "upgradeable" ) << QStringLiteral( "installedZ" ) << QStringLiteral( "upgradeableZ" ) << QStringLiteral( "orphanZ" ) << QStringLiteral( "newerZZ" ) << QLatin1String( "" );
acceptedStatuses << QStringLiteral( "installed" ) << QStringLiteral( "orphan" ) << QStringLiteral( "newer" ) << QStringLiteral( "upgradeable" ) << QStringLiteral( "installedZ" ) << QStringLiteral( "upgradeableZ" ) << QStringLiteral( "orphanZ" ) << QStringLiteral( "newerZZ" ) << QString();
tabTitle = QStringLiteral( "installed_plugins" );
break;
case PLUGMAN_TAB_NOT_INSTALLED:
@@ -6757,7 +6757,7 @@ void QgisApp::refreshFeatureActions()
if ( !vlayer->isEditable() && action.isEnabledOnlyWhenEditable() )
continue;

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

// 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 )
tr( "Duplicate layer: " ),
tr( "%1 (%2 type unsupported)" )
.arg( selectedLyr->name(),
!unSppType.isEmpty() ? QStringLiteral( "'" ) + unSppType + "' " : QLatin1String( "" ) ),
!unSppType.isEmpty() ? QStringLiteral( "'" ) + unSppType + "' " : QString() ),
Qgis::Warning,
0,
mInfoBar ) );
@@ -11105,7 +11105,7 @@ void QgisApp::closeProject()

mTrustedMacros = false;

mLegendExpressionFilterButton->setExpressionText( QLatin1String( "" ) );
mLegendExpressionFilterButton->setExpressionText( QString() );
mLegendExpressionFilterButton->setChecked( false );
mActionFilterLegend->setChecked( false );

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

@@ -141,7 +141,7 @@ void QgsAttributeActionDialog::insertRow( int row, const QgsAction &action )

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

@@ -312,15 +312,15 @@ void QgsAttributeActionDialog::updateButtons()
void QgsAttributeActionDialog::addDefaultActions()
{
int pos = 0;
insertRow( pos++, QgsAction::Generic, tr( "Echo attribute's value" ), QStringLiteral( "echo \"[% \"MY_FIELD\" %]\"" ), QLatin1String( "" ), true, tr( "Attribute Value" ), QSet<QString>() << QStringLiteral( "Field" ), QString() );
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() );
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() );
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() );
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() );
insertRow( pos++, QgsAction::OpenUrl, tr( "Open file" ), QStringLiteral( "[% \"PATH\" %]" ), QLatin1String( "" ), false, tr( "Open file" ), QSet<QString>() << QStringLiteral( "Feature" ) << QStringLiteral( "Canvas" ), QString() );
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() );
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() );
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 );
insertRow( pos++, QgsAction::Generic, tr( "Echo attribute's value" ), QStringLiteral( "echo \"[% \"MY_FIELD\" %]\"" ), QString(), true, tr( "Attribute Value" ), QSet<QString>() << QStringLiteral( "Field" ), QString() );
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() );
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() );
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() );
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() );
insertRow( pos++, QgsAction::OpenUrl, tr( "Open file" ), QStringLiteral( "[% \"PATH\" %]" ), QString(), false, tr( "Open file" ), QSet<QString>() << QStringLiteral( "Feature" ) << QStringLiteral( "Canvas" ), QString() );
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() );
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() );
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 );

}

@@ -155,7 +155,7 @@ void QgsBookmarks::addClicked()
QgsMapCanvas *canvas = QgisApp::instance()->mapCanvas();
Q_ASSERT( canvas );

QString projStr( QLatin1String( "" ) );
QString projStr;
if ( QgsProject::instance() )
{
if ( !QgsProject::instance()->title().isEmpty() )
@@ -165,7 +165,7 @@ void QgsBookmarks::addClicked()
else if ( !QgsProject::instance()->fileName().isEmpty() )
{
QFileInfo fi( QgsProject::instance()->fileName() );
projStr = fi.exists() ? fi.fileName() : QLatin1String( "" );
projStr = fi.exists() ? fi.fileName() : QString();
}
}

@@ -344,7 +344,7 @@ QTreeWidgetItem *QgsCustomizationDialog::readWidgetsXmlNode( const QDomNode &nod
{
QDomElement myElement = node.toElement();

QString name = myElement.attribute( QStringLiteral( "objectName" ), QLatin1String( "" ) );
QString name = myElement.attribute( QStringLiteral( "objectName" ), QString() );
QStringList data( name );

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

// It is nice to have icons for each Qt widget class, is it too heavy?
// There are 47 png files, total 196K in qt/tools/designer/src/components/formeditor/images/
QString iconName = myElement.attribute( QStringLiteral( "class" ), QLatin1String( "" ) ).toLower().mid( 1 ) + ".png";
QString iconName = myElement.attribute( QStringLiteral( "class" ), QString() ).toLower().mid( 1 ) + ".png";
QString iconPath = QgsApplication::iconPath( "/customization/" + iconName );
QgsDebugMsg( "iconPath = " + iconPath );
if ( QFile::exists( iconPath ) )
@@ -475,9 +475,9 @@ QgsDxfExportDialog::QgsDxfExportDialog( QWidget *parent, Qt::WindowFlags f )
mMTextCheckBox->setChecked( QgsProject::instance()->readEntry( QStringLiteral( "dxf" ), QStringLiteral( "/lastDxfUseMText" ), settings.value( QStringLiteral( "qgis/lastDxfUseMText" ), "true" ).toString() ) != QLatin1String( "false" ) );

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

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

@@ -484,7 +484,7 @@ void QgsFieldCalculator::setOkButtonState()
return;
}

okButton->setToolTip( QLatin1String( "" ) );
okButton->setToolTip( QString() );
okButton->setEnabled( true );
}

@@ -135,7 +135,7 @@ QgsHandleBadLayers::QgsHandleBadLayers( const QList<QDomNode> &layers )
}
else
{
item = new QTableWidgetItem( QLatin1String( "" ) );
item = new QTableWidgetItem( QString() );
mLayerList->setItem( j, 3, item );
}

0 comments on commit e0fa9eb

Please sign in to comment.
You can’t perform that action at this time.