Skip to content
Permalink
Browse files

Switch double quoted single character to single quotes for some

QString methods

Using single quotes is a significant performance boost. Rough
benchmarks indicate the QString single quote methods take
about 15% of the time the double quote variants take.
  • Loading branch information
nyalldawson committed Nov 2, 2015
1 parent c522bb1 commit b7e1cae4f042a33fe361980edc473976badb9e67
Showing with 1,199 additions and 1,199 deletions.
  1. +2 −2 src/analysis/interpolation/qgsgridfilewriter.cpp
  2. +3 −3 src/analysis/openstreetmap/qgsosmdatabase.cpp
  3. +2 −2 src/analysis/openstreetmap/qgsosmimport.cpp
  4. +1 −1 src/analysis/raster/qgsrelief.cpp
  5. +2 −2 src/analysis/vector/qgstransectsample.cpp
  6. +11 −11 src/app/composer/qgscomposer.cpp
  7. +2 −2 src/app/composer/qgscomposermapwidget.cpp
  8. +1 −1 src/app/composer/qgscomposerpicturewidget.cpp
  9. +1 −1 src/app/composer/qgscomposerscalebarwidget.cpp
  10. +2 −2 src/app/main.cpp
  11. +1 −1 src/app/nodetool/qgsselectedfeature.cpp
  12. +4 −4 src/app/ogr/qgsnewogrconnection.cpp
  13. +9 −9 src/app/ogr/qgsogrhelperfunctions.cpp
  14. +14 −14 src/app/ogr/qgsopenvectorlayerdialog.cpp
  15. +2 −2 src/app/ogr/qgsvectorlayersaveasdialog.cpp
  16. +9 −9 src/app/pluginmanager/qgspluginmanager.cpp
  17. +1 −1 src/app/pluginmanager/qgspluginsortfilterproxymodel.cpp
  18. +24 −24 src/app/qgisapp.cpp
  19. +2 −2 src/app/qgsabout.cpp
  20. +1 −1 src/app/qgsattributeactiondialog.cpp
  21. +5 −5 src/app/qgsbookmarks.cpp
  22. +3 −3 src/app/qgsbrowserdockwidget.cpp
  23. +1 −1 src/app/qgsclipboard.cpp
  24. +9 −9 src/app/qgscustomization.cpp
  25. +6 −6 src/app/qgscustomprojectiondialog.cpp
  26. +1 −1 src/app/qgsdecorationitem.cpp
  27. +2 −2 src/app/qgsdiagramproperties.cpp
  28. +2 −2 src/app/qgshandlebadlayers.cpp
  29. +1 −1 src/app/qgsidentifyresultsdialog.cpp
  30. +1 −1 src/app/qgsjoindialog.cpp
  31. +2 −2 src/app/qgsloadstylefromdbdialog.cpp
  32. +1 −1 src/app/qgsmaptoolsimplify.cpp
  33. +2 −2 src/app/qgsmeasuredialog.cpp
  34. +6 −6 src/app/qgsnewspatialitelayerdialog.cpp
  35. +15 −15 src/app/qgsoptions.cpp
  36. +2 −2 src/app/qgspluginregistry.cpp
  37. +2 −2 src/app/qgsprojectproperties.cpp
  38. +5 −5 src/app/qgsrastercalcdialog.cpp
  39. +6 −6 src/app/qgsrasterlayerproperties.cpp
  40. +1 −1 src/app/qgssettingstree.cpp
  41. +2 −2 src/app/qgsvariantdelegate.cpp
  42. +1 −1 src/app/qgsvectorlayerproperties.cpp
  43. +1 −1 src/app/qgsversioninfo.cpp
  44. +3 −3 src/auth/basic/qgsauthbasicmethod.cpp
  45. +1 −1 src/auth/pkipaths/qgsauthpkipathsedit.cpp
  46. +1 −1 src/core/auth/qgsauthcertutils.cpp
  47. +1 −1 src/core/auth/qgsauthmethodregistry.cpp
  48. +2 −2 src/core/composer/qgscomposerlabel.cpp
  49. +1 −1 src/core/composer/qgscomposermap.cpp
  50. +1 −1 src/core/composer/qgscomposermapgrid.cpp
  51. +7 −7 src/core/composer/qgscomposertablev2.cpp
  52. +1 −1 src/core/composer/qgscomposerutils.cpp
  53. +6 −6 src/core/composer/qgscomposition.cpp
  54. +2 −2 src/core/composer/qgsscalebarstyle.cpp
  55. +15 −15 src/core/dxf/qgsdxfexport.cpp
  56. +2 −2 src/core/geometry/qgsabstractgeometryv2.cpp
  57. +1 −1 src/core/geometry/qgscircularstringv2.cpp
  58. +4 −4 src/core/geometry/qgscompoundcurvev2.cpp
  59. +7 −7 src/core/geometry/qgscurvepolygonv2.cpp
  60. +5 −5 src/core/geometry/qgsgeometrycollectionv2.cpp
  61. +18 −18 src/core/geometry/qgsgeometryutils.cpp
  62. +2 −2 src/core/geometry/qgslinestringv2.cpp
  63. +1 −1 src/core/geometry/qgsmultipointv2.cpp
  64. +1 −1 src/core/geometry/qgsmultipolygonv2.cpp
  65. +1 −1 src/core/geometry/qgsmultisurfacev2.cpp
  66. +8 −8 src/core/geometry/qgspointv2.cpp
  67. +1 −1 src/core/geometry/qgswkbtypes.cpp
  68. +1 −1 src/core/gps/qextserialport/qextserialenumerator.cpp
  69. +2 −2 src/core/gps/qgsgpsdetector.cpp
  70. +1 −1 src/core/layertree/qgslayertreegroup.cpp
  71. +22 −22 src/core/qgsapplication.cpp
  72. +4 −4 src/core/qgsattributeaction.cpp
  73. +1 −1 src/core/qgsbrowsermodel.cpp
  74. +21 −21 src/core/qgscoordinatereferencesystem.cpp
  75. +7 −7 src/core/qgscoordinatetransform.cpp
  76. +1 −1 src/core/qgsdartmeasurement.cpp
  77. +6 −6 src/core/qgsdataitem.cpp
  78. +11 −11 src/core/qgsdatasourceuri.cpp
  79. +2 −2 src/core/qgsdiagramrendererv2.cpp
  80. +2 −2 src/core/qgsdistancearea.cpp
  81. +2 −2 src/core/qgserror.cpp
  82. +19 −19 src/core/qgsexpression.cpp
  83. +2 −2 src/core/qgsexpressioncontext.cpp
  84. +2 −2 src/core/qgsfontutils.cpp
  85. +6 −6 src/core/qgsgml.cpp
  86. +2 −2 src/core/qgsgmlschema.cpp
  87. +6 −6 src/core/qgshttptransaction.cpp
  88. +1 −1 src/core/qgslabel.cpp
  89. +20 −20 src/core/qgsmaplayer.cpp
  90. +1 −1 src/core/qgsmaplayerlegend.cpp
  91. +1 −1 src/core/qgsmaprenderer.cpp
  92. +2 −2 src/core/qgsmaptopixel.cpp
  93. +3 −3 src/core/qgsmimedatautils.cpp
  94. +2 −2 src/core/qgsnetworkaccessmanager.cpp
  95. +5 −5 src/core/qgsofflineediting.cpp
  96. +16 −16 src/core/qgsogcutils.cpp
  97. +4 −4 src/core/qgsowsconnection.cpp
  98. +11 −11 src/core/qgspallabeling.cpp
  99. +2 −2 src/core/qgspoint.cpp
  100. +18 −18 src/core/qgsproject.cpp
  101. +1 −1 src/core/qgsprojectfiletransform.cpp
  102. +1 −1 src/core/qgsprojectversion.cpp
  103. +1 −1 src/core/qgsproviderregistry.cpp
  104. +12 −12 src/core/qgsrectangle.cpp
  105. +7 −7 src/core/qgsrenderchecker.cpp
  106. +2 −2 src/core/qgsrenderchecker.h
  107. +9 −9 src/core/qgsvectorfilewriter.cpp
  108. +3 −3 src/core/qgsvectorlayer.cpp
  109. +6 −6 src/core/qgsvectorlayereditbuffer.cpp
  110. +4 −4 src/core/qgsvectorlayerfeatureiterator.cpp
  111. +7 −7 src/core/qgsvectorlayerimport.cpp
  112. +1 −1 src/core/qgsvectorlayerjoinbuffer.cpp
  113. +2 −2 src/core/raster/qgsrasterchecker.cpp
  114. +3 −3 src/core/raster/qgsrasterfilewriter.cpp
  115. +1 −1 src/core/raster/qgsrasterinterface.cpp
  116. +1 −1 src/core/raster/qgsrasterlayer.cpp
  117. +1 −1 src/core/raster/qgsrasterprojector.cpp
  118. +2 −2 src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp
  119. +39 −39 src/core/symbology-ng/qgscptcityarchive.cpp
  120. +2 −2 src/core/symbology-ng/qgsfillsymbollayerv2.cpp
  121. +3 −3 src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
  122. +1 −1 src/core/symbology-ng/qgsinvertedpolygonrenderer.cpp
  123. +3 −3 src/core/symbology-ng/qgslinesymbollayerv2.cpp
  124. +3 −3 src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
  125. +4 −4 src/core/symbology-ng/qgsrulebasedrendererv2.cpp
  126. +5 −5 src/core/symbology-ng/qgssvgcache.cpp
  127. +29 −29 src/core/symbology-ng/qgssymbollayerv2utils.cpp
  128. +2 −2 src/core/symbology-ng/qgssymbolv2.cpp
  129. +2 −2 src/gui/auth/qgsauthcertificateinfo.cpp
  130. +1 −1 src/gui/auth/qgsauthconfigidedit.cpp
  131. +1 −1 src/gui/auth/qgsauthsslimportdialog.cpp
  132. +2 −2 src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.cpp
  133. +4 −4 src/gui/editorwidgets/qgsvaluemapconfigdlg.cpp
  134. +1 −1 src/gui/editorwidgets/qgsvaluerelationsearchwidgetwrapper.cpp
  135. +1 −1 src/gui/editorwidgets/qgsvaluerelationwidgetfactory.cpp
  136. +2 −2 src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp
  137. +1 −1 src/gui/layertree/qgscustomlayerorderwidget.cpp
  138. +1 −1 src/gui/layertree/qgslayertreeviewdefaultactions.cpp
  139. +2 −2 src/gui/qgisgui.cpp
  140. +1 −1 src/gui/qgsattributeform.cpp
  141. +3 −3 src/gui/qgsbrowsertreeview.cpp
  142. +5 −5 src/gui/qgscollapsiblegroupbox.cpp
  143. +2 −2 src/gui/qgscomposerruler.cpp
  144. +4 −4 src/gui/qgsdatadefinedbutton.cpp
  145. +2 −2 src/gui/qgsdatumtransformdialog.cpp
  146. +12 −12 src/gui/qgsexpressionbuilderwidget.cpp
  147. +2 −2 src/gui/qgsexpressionbuilderwidget.h
  148. +12 −12 src/gui/qgsmanageconnectionsdialog.cpp
  149. +2 −2 src/gui/qgsmapcanvas.cpp
  150. +1 −1 src/gui/qgsmessagebaritem.cpp
  151. +1 −1 src/gui/qgsmessagelogviewer.cpp
  152. +3 −3 src/gui/qgsnewhttpconnection.cpp
  153. +1 −1 src/gui/qgsnewnamedialog.cpp
  154. +6 −6 src/gui/qgsowssourceselect.cpp
  155. +5 −5 src/gui/qgsprojectionselector.cpp
  156. +3 −3 src/gui/qgsquerybuilder.cpp
  157. +5 −5 src/gui/qgsrasterformatsaveoptionswidget.cpp
  158. +1 −1 src/gui/qgsrasterlayersaveasdialog.cpp
  159. +3 −3 src/gui/qgsrasterpyramidsoptionswidget.cpp
  160. +1 −1 src/gui/qgsscalecombobox.cpp
  161. +1 −1 src/gui/qgssearchquerybuilder.cpp
  162. +1 −1 src/gui/qgssublayersdialog.cpp
  163. +1 −1 src/gui/qgsvariableeditorwidget.cpp
  164. +8 −8 src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp
  165. +10 −10 src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp
  166. +1 −1 src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
  167. +1 −1 src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp
  168. +1 −1 src/gui/symbology-ng/qgsstylev2exportimportdialog.cpp
  169. +2 −2 src/gui/symbology-ng/qgsstylev2managerdialog.cpp
  170. +2 −2 src/gui/symbology-ng/qgssvgselectorwidget.cpp
  171. +4 −4 src/gui/symbology-ng/qgssymbollayerv2widget.cpp
  172. +1 −1 src/gui/symbology-ng/qgssymbolslistwidget.cpp
  173. +4 −4 src/plugins/coordinate_capture/coordinatecapture.cpp
  174. +1 −1 src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.cpp
  175. +2 −2 src/plugins/evis/eventbrowser/evisconfiguration.cpp
  176. +3 −3 src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp
  177. +1 −1 src/plugins/evis/eventbrowser/evisimagedisplaywidget.cpp
  178. +10 −10 src/plugins/georeferencer/qgsgeorefplugingui.cpp
  179. +6 −6 src/plugins/georeferencer/qgsgeorefvalidators.cpp
  180. +1 −1 src/plugins/heatmap/heatmapgui.cpp
  181. +2 −2 src/plugins/oracle_raster/qgsoracleconnect_ui.cpp
  182. +1 −1 src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.cpp
  183. +3 −3 src/plugins/spit/qgspgutil.cpp
  184. +8 −8 src/plugins/spit/qgsshapefile.cpp
  185. +22 −22 src/plugins/spit/qgsspit.cpp
  186. +1 −1 src/plugins/zonal_statistics/qgszonalstatisticsdialog.cpp
  187. +5 −5 src/providers/delimitedtext/qgsdelimitedtextfile.cpp
  188. +3 −3 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
  189. +16 −16 src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp
  190. +7 −7 src/providers/gdal/qgsgdaldataitems.cpp
  191. +15 −15 src/providers/gdal/qgsgdalprovider.cpp
  192. +1 −1 src/providers/gdal/qgsgdalproviderbase.cpp
  193. +5 −5 src/providers/gpx/gpsdata.cpp
  194. +7 −7 src/providers/mssql/qgsmssqldataitems.cpp
  195. +7 −7 src/providers/mssql/qgsmssqlfeatureiterator.cpp
  196. +12 −12 src/providers/mssql/qgsmssqlprovider.cpp
  197. +6 −6 src/providers/mssql/qgsmssqlsourceselect.cpp
  198. +2 −2 src/providers/mssql/qgsmssqltablemodel.cpp
  199. +2 −2 src/providers/ogr/qgsogrdataitems.cpp
  200. +16 −16 src/providers/ogr/qgsogrprovider.cpp
  201. +1 −1 src/providers/ows/qgsowsdataitems.cpp
  202. +1 −1 src/providers/postgres/qgspgsourceselect.cpp
  203. +10 −10 src/providers/postgres/qgspostgresconn.cpp
  204. +3 −3 src/providers/postgres/qgspostgresconn.h
  205. +6 −6 src/providers/postgres/qgspostgresdataitems.cpp
  206. +1 −1 src/providers/postgres/qgspostgresexpressioncompiler.cpp
  207. +6 −6 src/providers/postgres/qgspostgresfeatureiterator.cpp
  208. +30 −30 src/providers/postgres/qgspostgresprovider.cpp
  209. +3 −3 src/providers/spatialite/qgsspatialiteconnection.cpp
  210. +3 −3 src/providers/spatialite/qgsspatialitedataitems.cpp
  211. +6 −6 src/providers/spatialite/qgsspatialitefeatureiterator.cpp
  212. +21 −21 src/providers/spatialite/qgsspatialiteprovider.cpp
  213. +5 −5 src/providers/spatialite/qgsspatialitesourceselect.cpp
  214. +1 −1 src/providers/spatialite/qgsspatialitetablemodel.cpp
  215. +15 −15 src/providers/wcs/qgswcscapabilities.cpp
  216. +5 −5 src/providers/wcs/qgswcsdataitems.cpp
  217. +11 −11 src/providers/wcs/qgswcsprovider.cpp
  218. +5 −5 src/providers/wfs/qgswfscapabilities.cpp
  219. +1 −1 src/providers/wfs/qgswfsdataitems.cpp
  220. +12 −12 src/providers/wfs/qgswfsprovider.cpp
  221. +3 −3 src/providers/wfs/qgswfssourceselect.cpp
  222. +9 −9 src/providers/wms/qgswmscapabilities.cpp
  223. +9 −9 src/providers/wms/qgswmsdataitems.cpp
  224. +11 −11 src/providers/wms/qgswmsprovider.cpp
  225. +2 −2 src/providers/wms/qgswmssourceselect.cpp
  226. +12 −12 src/python/qgspythonutilsimpl.cpp
  227. +7 −7 tests/bench/qgsbench.cpp
  228. +1 −1 tests/src/analysis/testqgsrastercalculator.cpp
  229. +6 −6 tests/src/analysis/testqgsvectoranalyzer.cpp
  230. +1 −1 tests/src/analysis/testqgszonalstatistics.cpp
  231. +1 −1 tests/src/app/testqgisappclipboard.cpp
  232. +1 −1 tests/src/core/qgscompositionchecker.cpp
  233. +1 −1 tests/src/core/regression1141.cpp
  234. +1 −1 tests/src/core/regression992.cpp
  235. +2 −2 tests/src/core/testqgsauthmanager.cpp
  236. +1 −1 tests/src/core/testqgsblendmodes.cpp
  237. +1 −1 tests/src/core/testqgscomposerlabel.cpp
  238. +1 −1 tests/src/core/testqgscomposerobject.cpp
  239. +1 −1 tests/src/core/testqgscomposertable.cpp
  240. +1 −1 tests/src/core/testqgscomposerutils.cpp
  241. +1 −1 tests/src/core/testqgscoordinatereferencesystem.cpp
  242. +1 −1 tests/src/core/testqgsdiagram.cpp
  243. +4 −4 tests/src/core/testqgsexpression.cpp
  244. +1 −1 tests/src/core/testqgsgeometry.cpp
  245. +1 −1 tests/src/core/testqgsgradients.cpp
  246. +1 −1 tests/src/core/testqgsimageoperation.cpp
  247. +1 −1 tests/src/core/testqgsinvertedpolygonrenderer.cpp
  248. +1 −1 tests/src/core/testqgslabelingenginev2.cpp
  249. +1 −1 tests/src/core/testqgslegendrenderer.cpp
  250. +2 −2 tests/src/core/testqgsmaprenderer.cpp
  251. +1 −1 tests/src/core/testqgsmaprotation.cpp
  252. +1 −1 tests/src/core/testqgsnetworkcontentfetcher.cpp
  253. +2 −2 tests/src/core/testqgspainteffect.cpp
  254. +3 −3 tests/src/core/testqgsrasterfilewriter.cpp
  255. +1 −1 tests/src/core/testqgsrasterfill.cpp
  256. +4 −4 tests/src/core/testqgsrasterlayer.cpp
  257. +2 −2 tests/src/core/testqgsrastersublayer.cpp
  258. +1 −1 tests/src/core/testqgsrenderers.cpp
  259. +1 −1 tests/src/core/testqgsrulebasedrenderer.cpp
  260. +1 −1 tests/src/core/testqgsshapeburst.cpp
  261. +1 −1 tests/src/core/testqgsstylev2.cpp
  262. +2 −2 tests/src/core/testqgssymbolv2.cpp
  263. +1 −1 tests/src/core/testqgsvectorlayer.cpp
  264. +2 −2 tests/src/core/testqgsvectorlayercache.cpp
  265. +1 −1 tests/src/gui/testprojectionissues.cpp
  266. +1 −1 tests/src/gui/testqgsdualview.cpp
  267. +1 −1 tests/src/gui/testqgsrubberband.cpp
  268. +1 −1 tests/src/providers/testqgsgdalprovider.cpp
  269. +2 −2 tests/src/providers/testqgswcsprovider.cpp
  270. +19 −19 tests/src/providers/testqgswcspublicservers.cpp
@@ -86,7 +86,7 @@ int QgsGridFileWriter::writeFile( bool showProgressDialog )
{
if ( mInterpolator->interpolatePoint( currentXValue, currentYValue, interpolatedValue ) == 0 )
{
outStream << interpolatedValue << " ";
outStream << interpolatedValue << ' ';
}
else
{
@@ -114,7 +114,7 @@ int QgsGridFileWriter::writeFile( bool showProgressDialog )
QgsVectorLayer* vl = ld.vectorLayer;
QString crs = vl->crs().toWkt();
QFileInfo fi( mOutputFilePath );
QString fileName = fi.absolutePath() + "/" + fi.completeBaseName() + ".prj";
QString fileName = fi.absolutePath() + '/' + fi.completeBaseName() + ".prj";
QFile prjFile( fileName );
if ( !prjFile.open( QFile::WriteOnly ) )
{
@@ -336,7 +336,7 @@ bool QgsOSMDatabase::createSpatialTable( const QString& tableName, const QString
QString sqlCreateTable = QString( "CREATE TABLE %1 (id INTEGER PRIMARY KEY" ).arg( quotedIdentifier( tableName ) );
for ( int i = 0; i < tagKeys.count(); ++i )
sqlCreateTable += QString( ", %1 TEXT" ).arg( quotedIdentifier( tagKeys[i] ) );
sqlCreateTable += ")";
sqlCreateTable += ')';

char *errMsg = NULL;
int ret = sqlite3_exec( mDatabase, sqlCreateTable.toUtf8().constData(), NULL, NULL, &errMsg );
@@ -530,7 +530,7 @@ void QgsOSMDatabase::exportSpatiaLiteWays( bool closed, const QString& tableName

QString QgsOSMDatabase::quotedIdentifier( QString id )
{
id.replace( "\"", "\"\"" );
id.replace( '\"', "\"\"" );
return QString( "\"%1\"" ).arg( id );
}

@@ -539,7 +539,7 @@ QString QgsOSMDatabase::quotedValue( QString value )
if ( value.isNull() )
return "NULL";

value.replace( "'", "''" );
value.replace( '\'', "''" );
return QString( "'%1'" ).arg( value );
}

@@ -141,10 +141,10 @@ bool QgsOSMXmlImport::createDatabase()
if ( ret == SQLITE_OK && rows == 1 && columns == 1 )
{
QString version = QString::fromUtf8( results[1] );
QStringList parts = version.split( " ", QString::SkipEmptyParts );
QStringList parts = version.split( ' ', QString::SkipEmptyParts );
if ( parts.size() >= 1 )
{
QStringList verparts = parts[0].split( ".", QString::SkipEmptyParts );
QStringList verparts = parts[0].split( '.', QString::SkipEmptyParts );
above41 = verparts.size() >= 2 && ( verparts[0].toInt() > 4 || ( verparts[0].toInt() == 4 && verparts[1].toInt() >= 1 ) );
}
}
@@ -560,7 +560,7 @@ bool QgsRelief::exportFrequencyDistributionToCsv( const QString& file )
QTextStream outstream( &outFile );
for ( int i = 0; i < 252; ++i )
{
outstream << QString::number( i ) + "," + QString::number( frequency[i] ) << endl;
outstream << QString::number( i ) + ',' + QString::number( frequency[i] ) << endl;
}
outFile.close();
return true;
@@ -210,7 +210,7 @@ int QgsTransectSample::createSample( QProgressDialog* pd )
samplePointFeature.setAttribute( "id", nTotalTransects + 1 );
samplePointFeature.setAttribute( "station_id", nCreatedTransects + 1 );
samplePointFeature.setAttribute( "stratum_id", strataId );
samplePointFeature.setAttribute( "station_code", strataId.toString() + "_" + QString::number( nCreatedTransects + 1 ) );
samplePointFeature.setAttribute( "station_code", strataId.toString() + '_' + QString::number( nCreatedTransects + 1 ) );
samplePointFeature.setAttribute( "start_lat", latLongSamplePoint.y() );
samplePointFeature.setAttribute( "start_long", latLongSamplePoint.x() );

@@ -279,7 +279,7 @@ int QgsTransectSample::createSample( QProgressDialog* pd )
sampleLineFeature.setAttribute( "id", nTotalTransects + 1 );
sampleLineFeature.setAttribute( "station_id", nCreatedTransects + 1 );
sampleLineFeature.setAttribute( "stratum_id", strataId );
sampleLineFeature.setAttribute( "station_code", strataId.toString() + "_" + QString::number( nCreatedTransects + 1 ) );
sampleLineFeature.setAttribute( "station_code", strataId.toString() + '_' + QString::number( nCreatedTransects + 1 ) );
sampleLineFeature.setAttribute( "start_lat", latLongSamplePoint.y() );
sampleLineFeature.setAttribute( "start_long", latLongSamplePoint.x() );
sampleLineFeature.setAttribute( "bearing", bearing );
@@ -2088,7 +2088,7 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )
else
{
QFileInfo fi( fileNExt.first );
outputFilePath = fi.absolutePath() + "/" + fi.baseName() + "_" + QString::number( i + 1 ) + "." + fi.suffix();
outputFilePath = fi.absolutePath() + '/' + fi.baseName() + '_' + QString::number( i + 1 ) + '.' + fi.suffix();
}

saveOk = image.save( outputFilePath, fileNExt.second.toLocal8Bit().constData() );
@@ -2115,8 +2115,8 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )
QFileInfo fi( outputFilePath );
// build the world file name
QString outputSuffix = fi.suffix();
QString worldFileName = fi.absolutePath() + "/" + fi.baseName() + "."
+ outputSuffix.at( 0 ) + outputSuffix.at( fi.suffix().size() - 1 ) + "w";
QString worldFileName = fi.absolutePath() + '/' + fi.baseName() + '.'
+ outputSuffix.at( 0 ) + outputSuffix.at( fi.suffix().size() - 1 ) + 'w';

writeWorldFile( worldFileName, a, b, c, d, e, f );
}
@@ -2185,7 +2185,7 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )
}
QString dir = s.at( 0 );
QString format = box->currentText();
QString fileExt = "." + format;
QString fileExt = '.' + format;

if ( dir.isEmpty() )
{
@@ -2309,7 +2309,7 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )
{
//append page number
QFileInfo fi( filename );
imageFilename = fi.absolutePath() + "/" + fi.baseName() + "_" + QString::number( i + 1 ) + "." + fi.suffix();
imageFilename = fi.absolutePath() + '/' + fi.baseName() + '_' + QString::number( i + 1 ) + '.' + fi.suffix();
}

bool saveOk = image.save( imageFilename, format.toLocal8Bit().constData() );
@@ -2336,8 +2336,8 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )
QFileInfo fi( imageFilename );
// build the world file name
QString outputSuffix = fi.suffix();
QString worldFileName = fi.absolutePath() + "/" + fi.baseName() + "."
+ outputSuffix.at( 0 ) + outputSuffix.at( fi.suffix().size() - 1 ) + "w";
QString worldFileName = fi.absolutePath() + '/' + fi.baseName() + '.'
+ outputSuffix.at( 0 ) + outputSuffix.at( fi.suffix().size() - 1 ) + 'w';

writeWorldFile( worldFileName, a, b, c, d, e, f );
}
@@ -2621,7 +2621,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
else
{
QFileInfo fi( outputFileName );
currentFileName = fi.absolutePath() + "/" + fi.baseName() + "_" + QString::number( i + 1 ) + "." + fi.suffix();
currentFileName = fi.absolutePath() + '/' + fi.baseName() + '_' + QString::number( i + 1 ) + '.' + fi.suffix();
generator.setFileName( currentFileName );
}

@@ -2787,7 +2787,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
QString errorMsg;
int errorLine;
if ( ! doc.setContent( &svgBuffer, false, &errorMsg, &errorLine ) )
QMessageBox::warning( 0, tr( "SVG error" ), tr( "There was an error in SVG output for SVG layer " ) + layerName + tr( " on page " ) + QString::number( i + 1 ) + "(" + errorMsg + ")" );
QMessageBox::warning( 0, tr( "SVG error" ), tr( "There was an error in SVG output for SVG layer " ) + layerName + tr( " on page " ) + QString::number( i + 1 ) + '(' + errorMsg + ')' );
if ( 1 == svgLayerId )
{
svg = QDomDocument( doc.doctype() );
@@ -2813,7 +2813,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
}
}
QFileInfo fi( outputFileName );
QString currentFileName = i == 0 ? outputFileName : fi.absolutePath() + "/" + fi.baseName() + "_" + QString::number( i + 1 ) + "." + fi.suffix();
QString currentFileName = i == 0 ? outputFileName : fi.absolutePath() + '/' + fi.baseName() + '_' + QString::number( i + 1 ) + '.' + fi.suffix();
QFile out( currentFileName );
bool openOk = out.open( QIODevice::WriteOnly | QIODevice::Text );
if ( !openOk )
@@ -4159,7 +4159,7 @@ void QgsComposer::loadAtlasPredefinedScalesFromProject()
// default to global map tool scales
QSettings settings;
QString scalesStr( settings.value( "Map/scales", PROJECT_SCALES ).toString() );
scales = scalesStr.split( "," );
scales = scalesStr.split( ',' );
}

for ( QStringList::const_iterator scaleIt = scales.constBegin(); scaleIt != scales.constEnd(); ++scaleIt )
@@ -1171,7 +1171,7 @@ bool QgsComposerMapWidget::hasPredefinedScales() const
// default to global map tool scales
QSettings settings;
QString scalesStr( settings.value( "Map/scales", PROJECT_SCALES ).toString() );
QStringList myScalesList = scalesStr.split( "," );
QStringList myScalesList = scalesStr.split( ',' );
return myScalesList.size() > 0 && myScalesList[0] != "";
}
return true;
@@ -2534,7 +2534,7 @@ void QgsComposerMapWidget::on_mOverviewFrameMapComboBox_currentIndexChanged( con

//extract id
bool conversionOk;
QStringList textSplit = text.split( " " );
QStringList textSplit = text.split( ' ' );
if ( textSplit.size() < 1 )
{
return;
@@ -300,7 +300,7 @@ void QgsComposerPictureWidget::on_mComposerMapComboBox_activated( const QString
//extract id
int id;
bool conversionOk;
QStringList textSplit = text.split( " " );
QStringList textSplit = text.split( ' ' );
if ( textSplit.size() < 1 )
{
return;
@@ -149,7 +149,7 @@ void QgsComposerScaleBarWidget::on_mMapComboBox_activated( const QString& text )
//extract id
int id;
bool conversionOk;
QStringList textSplit = text.split( " " );
QStringList textSplit = text.split( ' ' );
if ( textSplit.size() < 1 )
{
return;
@@ -606,7 +606,7 @@ int main( int argc, char *argv[] )
{
QgsLocaleNumC l;
QString ext( args[++i] );
QStringList coords( ext.split( "," ) );
QStringList coords( ext.split( ',' ) );

if ( coords.size() != 4 )
{
@@ -1115,7 +1115,7 @@ int main( int argc, char *argv[] )
{
#ifdef Q_OS_WIN
//replace backslashes with forward slashes
pythonfile.replace( "\\", "/" );
pythonfile.replace( '\\', '/' );
#endif
QgsPythonRunner::run( QString( "execfile('%1')" ).arg( pythonfile ) );
}
@@ -201,7 +201,7 @@ void QgsSelectedFeature::addError( QgsGeometry::Error e )
{
mGeomErrors << e;
if ( !mTip.isEmpty() )
mTip += "\n";
mTip += '\n';
mTip += e.what();

if ( e.hasWhere() )
@@ -41,19 +41,19 @@ QgsNewOgrConnection::QgsNewOgrConnection( QWidget *parent, const QString& connTy
restoreGeometry( settings.value( "/Windows/OGRDatabaseConnection/geometry" ).toByteArray() );

//add database drivers
QStringList dbDrivers = QgsProviderRegistry::instance()->databaseDrivers().split( ";" );
QStringList dbDrivers = QgsProviderRegistry::instance()->databaseDrivers().split( ';' );
for ( int i = 0; i < dbDrivers.count(); i++ )
{
QString dbDrive = dbDrivers.at( i );
cmbDatabaseTypes->addItem( dbDrive.split( "," ).at( 0 ) );
cmbDatabaseTypes->addItem( dbDrive.split( ',' ).at( 0 ) );
}
txtName->setEnabled( true );
cmbDatabaseTypes->setEnabled( true );
if ( !connName.isEmpty() )
{
// populate the dialog with the information stored for the connection
// populate the fields with the stored setting parameters
QString key = "/" + connType + "/connections/" + connName;
QString key = '/' + connType + "/connections/" + connName;
txtHost->setText( settings.value( key + "/host" ).toString() );
txtDatabase->setText( settings.value( key + "/database" ).toString() );
QString port = settings.value( key + "/port" ).toString();
@@ -104,7 +104,7 @@ void QgsNewOgrConnection::testConnection()
void QgsNewOgrConnection::accept()
{
QSettings settings;
QString baseKey = "/" + cmbDatabaseTypes->currentText() + "/connections/";
QString baseKey = '/' + cmbDatabaseTypes->currentText() + "/connections/";
settings.setValue( baseKey + "selected", txtName->text() );

// warn if entry was renamed to an existing connection
@@ -34,7 +34,7 @@ QString createDatabaseURI( const QString& connectionType, const QString& host, c
if ( port.isEmpty() )
port = "5151";

uri = "SDE:" + host + ",PORT:" + port + "," + database + "," + user + "," + password;
uri = "SDE:" + host + ",PORT:" + port + ',' + database + ',' + user + ',' + password;
}
else if ( connectionType == "Informix DataBlade" )
{
@@ -116,26 +116,26 @@ QString createDatabaseURI( const QString& connectionType, const QString& host, c
if (( !user.isEmpty() && !password.isEmpty() ) ||
( user.isEmpty() && password.isEmpty() ) )
{
uri += "/";
uri += '/';
if ( !password.isEmpty() )
uri += password;
}

if ( !host.isEmpty() || !database.isEmpty() )
{
uri += "@";
uri += '@';

if ( !host.isEmpty() )
{
uri += host;
if ( !port.isEmpty() )
uri += ":" + port;
uri += ':' + port;
}

if ( !database.isEmpty() )
{
if ( !host.isEmpty() )
uri += "/";
uri += '/';
uri += database;
}
}
@@ -146,11 +146,11 @@ QString createDatabaseURI( const QString& connectionType, const QString& host, c
{
if ( password.isEmpty() )
{
uri = "ODBC:" + user + "@" + database;
uri = "ODBC:" + user + '@' + database;
}
else
{
uri = "ODBC:" + user + "/" + password + "@" + database;
uri = "ODBC:" + user + '/' + password + '@' + database;
}

}
@@ -164,7 +164,7 @@ QString createDatabaseURI( const QString& connectionType, const QString& host, c
}
else if ( connectionType == "PostgreSQL" )
{
uri = "PG:dbname='" + database + "'";
uri = "PG:dbname='" + database + '\'';

if ( !host.isEmpty() )
{
@@ -182,7 +182,7 @@ QString createDatabaseURI( const QString& connectionType, const QString& host, c
uri += QString( " password='%1'" ).arg( password );
}

uri += " ";
uri += ' ';
}

QgsDebugMsg( "Connection type is=" + connectionType + " and uri=" + uri );

0 comments on commit b7e1cae

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