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.
This commit is contained in:
Nyall Dawson 2015-11-02 17:55:08 +11:00
parent c522bb1562
commit b7e1cae4f0
270 changed files with 1199 additions and 1199 deletions

View File

@ -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 ) )
{

View File

@ -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 );
}

View File

@ -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 ) );
}
}

View File

@ -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;

View File

@ -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 );

View File

@ -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 )

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 ) );
}

View File

@ -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() )

View File

@ -41,11 +41,11 @@ 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 );
@ -53,7 +53,7 @@ QgsNewOgrConnection::QgsNewOgrConnection( QWidget *parent, const QString& connTy
{
// 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

View File

@ -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 );

View File

@ -63,31 +63,31 @@ QgsOpenVectorLayerDialog::QgsOpenVectorLayerDialog( QWidget* parent, Qt::WindowF
//add database drivers
mVectorFileFilter = QgsProviderRegistry::instance()->fileVectorFilters();
QgsDebugMsg( "Database drivers :" + QgsProviderRegistry::instance()->databaseDrivers() );
QStringList dbDrivers = QgsProviderRegistry::instance()->databaseDrivers().split( ";" );
QStringList dbDrivers = QgsProviderRegistry::instance()->databaseDrivers().split( ';' );
for ( int i = 0; i < dbDrivers.count(); i++ )
{
QString dbDriver = dbDrivers.at( i );
if (( !dbDriver.isEmpty() ) && ( !dbDriver.isNull() ) )
cmbDatabaseTypes->addItem( dbDriver.split( "," ).at( 0 ) );
cmbDatabaseTypes->addItem( dbDriver.split( ',' ).at( 0 ) );
}
//add directory drivers
QStringList dirDrivers = QgsProviderRegistry::instance()->directoryDrivers().split( ";" );
QStringList dirDrivers = QgsProviderRegistry::instance()->directoryDrivers().split( ';' );
for ( int i = 0; i < dirDrivers.count(); i++ )
{
QString dirDriver = dirDrivers.at( i );
if (( !dirDriver.isEmpty() ) && ( !dirDriver.isNull() ) )
cmbDirectoryTypes->addItem( dirDriver.split( "," ).at( 0 ) );
cmbDirectoryTypes->addItem( dirDriver.split( ',' ).at( 0 ) );
}
//add protocol drivers
QStringList proDrivers = QgsProviderRegistry::instance()->protocolDrivers().split( ";" );
QStringList proDrivers = QgsProviderRegistry::instance()->protocolDrivers().split( ';' );
for ( int i = 0; i < proDrivers.count(); i++ )
{
QString proDriver = proDrivers.at( i );
if (( !proDriver.isEmpty() ) && ( !proDriver.isNull() ) )
cmbProtocolTypes->addItem( proDriver.split( "," ).at( 0 ) );
cmbProtocolTypes->addItem( proDriver.split( ',' ).at( 0 ) );
}
cmbDatabaseTypes->blockSignals( false );
cmbConnections->blockSignals( false );
@ -129,7 +129,7 @@ QString QgsOpenVectorLayerDialog::openDirectory()
{
#ifdef Q_OS_WIN
//replace backslashes with forward slashes
path.replace( "\\", "/" );
path.replace( '\\', '/' );
#endif
path = path + "/head";
}
@ -172,7 +172,7 @@ void QgsOpenVectorLayerDialog::editConnection()
void QgsOpenVectorLayerDialog::deleteConnection()
{
QSettings settings;
QString key = "/" + cmbDatabaseTypes->currentText() + "/connections/" + cmbConnections->currentText();
QString key = '/' + cmbDatabaseTypes->currentText() + "/connections/" + cmbConnections->currentText();
QString msg = tr( "Are you sure you want to remove the %1 connection and all associated settings?" )
.arg( cmbConnections->currentText() );
QMessageBox::StandardButton result = QMessageBox::information( this, tr( "Confirm Delete" ), msg, QMessageBox::Ok | QMessageBox::Cancel );
@ -193,7 +193,7 @@ void QgsOpenVectorLayerDialog::deleteConnection()
void QgsOpenVectorLayerDialog::populateConnectionList()
{
QSettings settings;
settings.beginGroup( "/" + cmbDatabaseTypes->currentText() + "/connections" );
settings.beginGroup( '/' + cmbDatabaseTypes->currentText() + "/connections" );
QStringList keys = settings.childGroups();
QStringList::Iterator it = keys.begin();
cmbConnections->clear();
@ -211,7 +211,7 @@ void QgsOpenVectorLayerDialog::setConnectionListPosition()
QSettings settings;
// If possible, set the item currently displayed database
QString toSelect = settings.value( "/" + cmbDatabaseTypes->currentText() + "/connections/selected" ).toString();
QString toSelect = settings.value( '/' + cmbDatabaseTypes->currentText() + "/connections/selected" ).toString();
// Does toSelect exist in cmbConnections?
bool set = false;
for ( int i = 0; i < cmbConnections->count(); ++i )
@ -262,7 +262,7 @@ void QgsOpenVectorLayerDialog::setSelectedConnectionType()
void QgsOpenVectorLayerDialog::setSelectedConnection()
{
QSettings settings;
settings.setValue( "/" + cmbDatabaseTypes->currentText() + "/connections/selected", cmbConnections->currentText() );
settings.setValue( '/' + cmbDatabaseTypes->currentText() + "/connections/selected", cmbConnections->currentText() );
QgsDebugMsg( "Setting selected connection to " + cmbConnections->currentText() );
}
@ -300,7 +300,7 @@ void QgsOpenVectorLayerDialog::accept()
if ( radioSrcDatabase->isChecked() )
{
if ( !settings.contains( "/" + cmbDatabaseTypes->currentText()
if ( !settings.contains( '/' + cmbDatabaseTypes->currentText()
+ "/connections/" + cmbConnections->currentText()
+ "/host" ) )
{
@ -310,7 +310,7 @@ void QgsOpenVectorLayerDialog::accept()
return;
}
QString baseKey = "/" + cmbDatabaseTypes->currentText() + "/connections/";
QString baseKey = '/' + cmbDatabaseTypes->currentText() + "/connections/";
baseKey += cmbConnections->currentText();
QString host = settings.value( baseKey + "/host" ).toString();
QString database = settings.value( baseKey + "/database" ).toString();
@ -365,7 +365,7 @@ void QgsOpenVectorLayerDialog::accept()
return;
}
mDataSources << inputSrcDataset->text().split( ";" );
mDataSources << inputSrcDataset->text().split( ';' );
}
else if ( radioSrcDirectory->isChecked() )
{

View File

@ -366,7 +366,7 @@ QStringList QgsVectorLayerSaveAsDialog::datasourceOptions() const
}
}
return options + mOgrDatasourceOptions->toPlainText().split( "\n" );
return options + mOgrDatasourceOptions->toPlainText().split( '\n' );
}
QStringList QgsVectorLayerSaveAsDialog::layerOptions() const
@ -415,7 +415,7 @@ QStringList QgsVectorLayerSaveAsDialog::layerOptions() const
}
}
return options + mOgrLayerOptions->toPlainText().split( "\n" );
return options + mOgrLayerOptions->toPlainText().split( '\n' );
}
bool QgsVectorLayerSaveAsDialog::skipAttributeCreation() const

View File

@ -306,7 +306,7 @@ void QgsPluginManager::getCppPluginsMetadata()
QString myPaths = settings.value( "plugins/searchPathsForPlugins", "" ).toString();
if ( !myPaths.isEmpty() )
{
myPathList.append( myPaths.split( "|" ) );
myPathList.append( myPaths.split( '|' ) );
}
for ( int j = 0; j < myPathList.size(); ++j )
@ -754,7 +754,7 @@ void QgsPluginManager::showPluginDetails( QStandardItem * item )
if ( ! metadata->value( "about" ).isEmpty() )
{
QString about = metadata->value( "about" );
html += about.replace( "\n", "<br/>" );
html += about.replace( '\n', "<br/>" );
}
html += "<br/><br/>";
@ -819,7 +819,7 @@ void QgsPluginManager::showPluginDetails( QStandardItem * item )
if ( ! metadata->value( "version_installed" ).isEmpty() )
{
QString ver = metadata->value( "version_installed" );
if ( ver == "-1" ) ver = "?";
if ( ver == "-1" ) ver = '?';
html += tr( "Installed version: %1 (in %2)<br/>" ).arg( ver, metadata->value( "library" ) );
}
if ( ! metadata->value( "version_available" ).isEmpty() )
@ -831,7 +831,7 @@ void QgsPluginManager::showPluginDetails( QStandardItem * item )
{
html += "<br/>";
QString changelog = tr( "changelog:<br/>%1 <br/>" ).arg( metadata->value( "changelog" ) );
html += changelog.replace( "\n", "<br/>" );
html += changelog.replace( '\n', "<br/>" );
}
html += "</td></tr></table>";
@ -1160,8 +1160,8 @@ void QgsPluginManager::on_wvDetails_linkClicked( const QUrl & url )
QString params = url.path();
QString response;
QgsPythonRunner::eval( QString( "pyplugin_installer.instance().sendVote('%1', '%2')" )
.arg( params.split( "/" )[1],
params.split( "/" )[2] ), response );
.arg( params.split( '/' )[1],
params.split( '/' )[2] ), response );
if ( response == "True" )
{
pushMessage( tr( "Vote sent successfully" ), QgsMessageBar::INFO );
@ -1244,7 +1244,7 @@ void QgsPluginManager::setRepositoryFilter()
if ( current )
{
QString key = current->text( 1 );
key = key.replace( "\'", "\\\'" ).replace( "\"", "\\\"" );
key = key.replace( '\'', "\\\'" ).replace( '\"', "\\\"" );
QgsDebugMsg( "Disabling all repositories but selected: " + key );
QgsPythonRunner::run( QString( "pyplugin_installer.instance().setRepositoryInspectionFilter('%1')" ).arg( key ) );
}
@ -1282,7 +1282,7 @@ void QgsPluginManager::on_buttonEditRep_clicked()
if ( current )
{
QString key = current->text( 1 );
key = key.replace( "\'", "\\\'" ).replace( "\"", "\\\"" );
key = key.replace( '\'', "\\\'" ).replace( '\"', "\\\"" );
QgsDebugMsg( "Editing repository connection: " + key );
QgsPythonRunner::run( QString( "pyplugin_installer.instance().editRepository('%1')" ).arg( key ) );
}
@ -1296,7 +1296,7 @@ void QgsPluginManager::on_buttonDeleteRep_clicked()
if ( current )
{
QString key = current->text( 1 );
key = key.replace( "\'", "\\\'" ).replace( "\"", "\\\"" );
key = key.replace( '\'', "\\\'" ).replace( '\"', "\\\"" );
QgsDebugMsg( "Deleting repository connection: " + key );
QgsPythonRunner::run( QString( "pyplugin_installer.instance().deleteRepository('%1')" ).arg( key ) );
}

View File

@ -66,7 +66,7 @@ bool QgsPluginSortFilterProxyModel::filterByStatus( QModelIndex &index ) const
}
QString status = sourceModel()->data( index, PLUGIN_STATUS_ROLE ).toString();
if ( status.endsWith( "Z" ) ) status.chop( 1 );
if ( status.endsWith( 'Z' ) ) status.chop( 1 );
if ( ! mAcceptedStatuses.isEmpty()
&& ! mAcceptedStatuses.contains( "invalid" )
&& ! mAcceptedStatuses.contains( status ) )

View File

@ -796,7 +796,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
QString myPaths = settings.value( "plugins/searchPathsForPlugins", "" ).toString();
if ( !myPaths.isEmpty() )
{
QStringList myPathList = myPaths.split( "|" );
QStringList myPathList = myPaths.split( '|' );
QgsPluginRegistry::instance()->restoreSessionPlugins( myPathList );
}
}
@ -1557,7 +1557,7 @@ void QgisApp::showPythonDialog()
{
QString className, text;
mPythonUtils->getError( className, text );
messageBar()->pushMessage( tr( "Error" ), tr( "Failed to open Python console:" ) + "\n" + className + ": " + text, QgsMessageBar::WARNING );
messageBar()->pushMessage( tr( "Error" ), tr( "Failed to open Python console:" ) + '\n' + className + ": " + text, QgsMessageBar::WARNING );
}
#ifdef Q_OS_MAC
else
@ -3218,12 +3218,12 @@ bool QgisApp::addVectorLayers( const QStringList &theLayerQStringList, const QSt
{
//set friendly name for datasources with only one layer
QStringList sublayers = layer->dataProvider()->subLayers();
QStringList elements = sublayers.at( 0 ).split( ":" );
QStringList elements = sublayers.at( 0 ).split( ':' );
if ( layer->storageType() != "GeoJSON" )
{
while ( elements.size() > 4 )
{
elements[1] += ":" + elements[2];
elements[1] += ':' + elements[2];
elements.removeAt( 2 );
}
@ -3287,7 +3287,7 @@ bool QgisApp::askUserForZipItemLayers( QString path )
QSettings settings;
int promptLayers = settings.value( "/qgis/promptForRasterSublayers", 1 ).toInt();
QgsDebugMsg( "askUserForZipItemLayers( " + path + ")" );
QgsDebugMsg( "askUserForZipItemLayers( " + path + ')' );
// if scanZipBrowser == no: skip to the next file
if ( settings.value( "/qgis/scanZipInBrowser2", "basic" ).toString() == "no" )
@ -3424,20 +3424,20 @@ void QgisApp::askUserForGDALSublayers( QgsRasterLayer *layer )
else
{
// remove driver name and file name
name.replace( name.split( ":" )[0], "" );
name.replace( path, "" );
name.remove( name.split( ':' )[0] );
name.remove( path );
}
// remove any : or " left over
if ( name.startsWith( ":" ) )
if ( name.startsWith( ':' ) )
name.remove( 0, 1 );
if ( name.startsWith( "\"" ) )
if ( name.startsWith( '\"' ) )
name.remove( 0, 1 );
if ( name.endsWith( ":" ) )
if ( name.endsWith( ':' ) )
name.chop( 1 );
if ( name.endsWith( "\"" ) )
if ( name.endsWith( '\"' ) )
name.chop( 1 );
names << name;
@ -3530,7 +3530,7 @@ void QgisApp::askUserForOGRSublayers( QgsVectorLayer *layer )
// If we get here, there are some options added to the filename.
// A valid uri is of the form: filename&option1=value1&option2=value2,...
// We want only the filename here, so we get the first part of the split.
QStringList theURIParts = uri.split( "|" );
QStringList theURIParts = uri.split( '|' );
uri = theURIParts.at( 0 );
}
QgsDebugMsg( "Layer type " + layertype );
@ -3553,10 +3553,10 @@ void QgisApp::loadOGRSublayers( const QString& layertype, const QString& uri, co
for ( int i = 0; i < list.size(); i++ )
{
QString composedURI;
QStringList elements = list.at( i ).split( ":" );
QStringList elements = list.at( i ).split( ':' );
while ( elements.size() > 2 )
{
elements[0] += ":" + elements[1];
elements[0] += ':' + elements[1];
elements.removeAt( 1 );
}
@ -3586,7 +3586,7 @@ void QgisApp::loadOGRSublayers( const QString& layertype, const QString& uri, co
QgsDebugMsg( "Creating new vector layer using " + composedURI );
QString name = list.at( i );
name.replace( ":", " " );
name.replace( ':', ' ' );
QgsVectorLayer *layer = new QgsVectorLayer( composedURI, name, "ogr", false );
if ( layer && layer->isValid() )
{
@ -4406,7 +4406,7 @@ bool QgisApp::fileSave()
QString path = QFileDialog::getSaveFileName(
this,
tr( "Choose a QGIS project file" ),
lastUsedDir + "/" + QgsProject::instance()->title(),
lastUsedDir + '/' + QgsProject::instance()->title(),
tr( "QGIS files" ) + " (*.qgs *.QGS)" );
if ( path.isEmpty() )
return false;
@ -4483,7 +4483,7 @@ void QgisApp::fileSaveAs()
QString path = QFileDialog::getSaveFileName( this,
tr( "Choose a file name to save the QGIS project file as" ),
lastUsedDir + "/" + QgsProject::instance()->title(),
lastUsedDir + '/' + QgsProject::instance()->title(),
tr( "QGIS files" ) + " (*.qgs *.QGS)" );
if ( path.isEmpty() )
return;
@ -5807,7 +5807,7 @@ bool QgisApp::uniqueComposerTitle( QWidget* parent, QString& composerTitle, bool
QString chooseMsg = tr( "Create unique print composer title" );
if ( acceptEmpty )
{
chooseMsg += "\n" + tr( "(title generated if left empty)" );
chooseMsg += '\n' + tr( "(title generated if left empty)" );
}
QString titleMsg = chooseMsg;
@ -6744,7 +6744,7 @@ QgsVectorLayer *QgisApp::pasteToNewMemoryVector()
QGis::WkbType wkbType = typeCounts.size() > 0 ? typeCounts.keys().value( 0 ) : QGis::WKBPoint;
QString typeName = QString( QGis::featureType( wkbType ) ).replace( "WKB", "" );
QString typeName = QString( QGis::featureType( wkbType ) ).remove( "WKB" );
typeName += QString( "?memoryid=%1" ).arg( QUuid::createUuid().toString() );
@ -7554,7 +7554,7 @@ void QgisApp::duplicateLayers( const QList<QgsMapLayer *>& lyrList )
{
dupLayer = 0;
unSppType.clear();
layerDupName = selectedLyr->name() + " " + tr( "copy" );
layerDupName = selectedLyr->name() + ' ' + tr( "copy" );
if ( selectedLyr->type() == QgsMapLayer::PluginLayer )
{
@ -10167,7 +10167,7 @@ bool QgisApp::addRasterLayers( QStringList const &theFileNameQStringList, bool g
msg = tr( "%1 is not a supported raster data source" ).arg( *myIterator );
if ( errMsg.size() > 0 )
msg += "\n" + errMsg;
msg += '\n' + errMsg;
error.append( QGS_ERROR_MESSAGE( msg, tr( "Raster layer" ) ) );
QgsErrorDialog::show( error, tr( "Unsupported Data Source" ) );
@ -10394,13 +10394,13 @@ void QgisApp::projectChanged( const QDomDocument &doc )
if ( !prevProjectDir.isNull() )
{
QString prev = prevProjectDir;
expr = QString( "sys.path.remove('%1'); " ).arg( prev.replace( "'", "\\'" ) );
expr = QString( "sys.path.remove('%1'); " ).arg( prev.replace( '\'', "\\'" ) );
}
prevProjectDir = fi.canonicalPath();
QString prev = prevProjectDir;
expr += QString( "sys.path.append('%1')" ).arg( prev.replace( "'", "\\'" ) );
expr += QString( "sys.path.append('%1')" ).arg( prev.replace( '\'', "\\'" ) );
QgsPythonRunner::run( expr );
}
@ -10561,7 +10561,7 @@ void QgisApp::namAuthenticationRequired( QNetworkReply *reply, QAuthenticator *a
if ( header.startsWith( "Basic " ) )
{
QByteArray auth( QByteArray::fromBase64( header.mid( 6 ) ) );
int pos = auth.indexOf( ":" );
int pos = auth.indexOf( ':' );
if ( pos >= 0 )
{
username = auth.left( pos );

View File

@ -94,7 +94,7 @@ void QgsAbout::init()
//ignore the line if it starts with a hash....
if ( line.left( 1 ) == "#" )
continue;
QStringList myTokens = line.split( "\t", QString::SkipEmptyParts );
QStringList myTokens = line.split( '\t', QString::SkipEmptyParts );
lines << myTokens[0];
}
file.close();
@ -164,7 +164,7 @@ void QgsAbout::init()
//ignore the line if it starts with a hash....
if ( sline.left( 1 ) == "#" )
continue;
QStringList myTokens = sline.split( "|", QString::SkipEmptyParts );
QStringList myTokens = sline.split( '|', QString::SkipEmptyParts );
if ( myTokens.size() > 1 )
{
website = "<a href=\"" + myTokens[1].remove( ' ' ) + "\">" + myTokens[1] + "</a>";

View File

@ -426,7 +426,7 @@ QString QgsAttributeActionDialog::uniqueName( QString name )
while ( !unique )
{
QString suffix = QString::number( suffix_num );
new_name = name + "_" + suffix;
new_name = name + '_' + suffix;
unique = true;
for ( int i = 0; i < pos; ++i )
if ( attributeActionTable->item( i, 0 )->text() == new_name )

View File

@ -283,14 +283,14 @@ void QgsBookmarks::importFromXML()
" VALUES (NULL,"
"'" + name.text() + "',"
"'" + prjname.text() + "',"
+ xmin.text() + ","
+ ymin.text() + ","
+ xmax.text() + ","
+ ymax.text() + ","
+ xmin.text() + ','
+ ymin.text() + ','
+ xmax.text() + ','
+ ymax.text() + ','
+ srid.text() + ");";
}
QStringList queriesList = queries.split( ";" );
QStringList queriesList = queries.split( ';' );
QSqlQuery query( model->database() );
Q_FOREACH ( const QString& queryTxt, queriesList )

View File

@ -134,7 +134,7 @@ class QgsBrowserTreeFilterProxyModel : public QSortFilterProxyModel
mREList.clear();
if ( mPatternSyntax == "normal" )
{
Q_FOREACH ( const QString& f, mFilter.split( "|" ) )
Q_FOREACH ( const QString& f, mFilter.split( '|' ) )
{
QRegExp rx( QString( "*%1*" ).arg( f.trimmed() ) );
rx.setPatternSyntax( QRegExp::Wildcard );
@ -144,7 +144,7 @@ class QgsBrowserTreeFilterProxyModel : public QSortFilterProxyModel
}
else if ( mPatternSyntax == "wildcard" )
{
Q_FOREACH ( const QString& f, mFilter.split( "|" ) )
Q_FOREACH ( const QString& f, mFilter.split( '|' ) )
{
QRegExp rx( f.trimmed() );
rx.setPatternSyntax( QRegExp::Wildcard );
@ -403,7 +403,7 @@ void QgsBrowserLayerProperties::setItem( QgsDataItem* item )
QgsCoordinateReferenceSystem defaultCrs =
QgisApp::instance()->mapCanvas()->mapSettings().destinationCrs();
if ( layerCrs == defaultCrs )
mNoticeLabel->setText( "NOTICE: Layer srs set from project (" + defaultCrs.authid() + ")" );
mNoticeLabel->setText( "NOTICE: Layer srs set from project (" + defaultCrs.authid() + ')' );
}
if ( mNoticeLabel->text().isEmpty() )

View File

@ -157,7 +157,7 @@ QgsFeatureList QgsClipboard::copyOf( const QgsFields &fields )
QString text = cb->text( QClipboard::Clipboard );
#endif
QStringList values = text.split( "\n" );
QStringList values = text.split( '\n' );
if ( values.isEmpty() || text.isEmpty() )
return mFeatureClipboard;

View File

@ -73,7 +73,7 @@ QgsCustomizationDialog::~QgsCustomizationDialog()
QTreeWidgetItem * QgsCustomizationDialog::item( const QString& thePath, QTreeWidgetItem *theItem )
{
QString path = thePath;
if ( path.startsWith( "/" ) )
if ( path.startsWith( '/' ) )
path = path.mid( 1 ); // remove '/'
QStringList names = path.split( '/' );
path = QStringList( names.mid( 1 ) ).join( "/" );
@ -137,7 +137,7 @@ void QgsCustomizationDialog::settingsToItem( const QString& thePath, QTreeWidget
if ( objectName.isEmpty() )
return; // object is not identifiable
QString myPath = thePath + "/" + objectName;
QString myPath = thePath + '/' + objectName;
bool on = theSettings->value( myPath, true ).toBool();
theItem->setCheckState( 0, on ? Qt::Checked : Qt::Unchecked );
@ -156,7 +156,7 @@ void QgsCustomizationDialog::itemToSettings( const QString& thePath, QTreeWidget
if ( objectName.isEmpty() )
return; // object is not identifiable
QString myPath = thePath + "/" + objectName;
QString myPath = thePath + '/' + objectName;
bool on = theItem->checkState( 0 ) == Qt::Checked ? true : false;
theSettings->setValue( myPath, on );
@ -404,7 +404,7 @@ bool QgsCustomizationDialog::switchWidget( QWidget *widget, QMouseEvent *e )
return false;
QString toolbarName = widget->parent()->objectName();
QString actionName = action->objectName();
path = "/Toolbars/" + toolbarName + "/" + actionName;
path = "/Toolbars/" + toolbarName + '/' + actionName;
}
else
{
@ -453,7 +453,7 @@ QString QgsCustomizationDialog::widgetPath( QWidget * theWidget, const QString&
{
if ( !path.isEmpty() )
{
path = name + "/" + path;
path = name + '/' + path;
}
else
{
@ -465,7 +465,7 @@ QString QgsCustomizationDialog::widgetPath( QWidget * theWidget, const QString&
if ( !parent || theWidget->inherits( "QDialog" ) )
{
return "/" + path;
return '/' + path;
}
return widgetPath( parent, path );
@ -510,7 +510,7 @@ void QgsCustomization::addTreeItemMenu( QTreeWidgetItem* parentItem, QMenu* menu
{
QStringList menustrs;
// remove '&' which are used to mark shortcut key
menustrs << menu->objectName() << menu->title().replace( "&", "" );
menustrs << menu->objectName() << menu->title().remove( '&' );
QTreeWidgetItem* menuItem = new QTreeWidgetItem( parentItem, menustrs );
menuItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
menuItem->setCheckState( 0, Qt::Checked );
@ -825,7 +825,7 @@ void QgsCustomization::customizeWidget( const QString& thePath, QWidget * theWid
if ( !QgsCustomization::mInternalWidgets.contains( name ) )
{
myPath = thePath + "/" + name;
myPath = thePath + '/' + name;
}
QObjectList children = theWidget->children();
@ -836,7 +836,7 @@ void QgsCustomization::customizeWidget( const QString& thePath, QWidget * theWid
continue;
QWidget * w = qobject_cast<QWidget*>( *i );
QString p = myPath + "/" + w->objectName();
QString p = myPath + '/' + w->objectName();
bool on = settings->value( p, true ).toBool();
//QgsDebugMsg( QString( "p = %1 on = %2" ).arg( p ).arg( on ) );

View File

@ -211,10 +211,10 @@ void QgsCustomProjectionDialog::insertProjection( const QString& myProjectionAc
// We have the result from system srs.db. Now insert into user db.
mySql = "insert into tbl_projection(acronym,name,notes,parameters) values ("
+ quotedValue( QString::fromUtf8(( char * )sqlite3_column_text( srsPreparedStatement, 0 ) ) )
+ "," + quotedValue( QString::fromUtf8(( char * )sqlite3_column_text( srsPreparedStatement, 1 ) ) )
+ "," + quotedValue( QString::fromUtf8(( char * )sqlite3_column_text( srsPreparedStatement, 2 ) ) )
+ "," + quotedValue( QString::fromUtf8(( char * )sqlite3_column_text( srsPreparedStatement, 3 ) ) )
+ ")"
+ ',' + quotedValue( QString::fromUtf8(( char * )sqlite3_column_text( srsPreparedStatement, 1 ) ) )
+ ',' + quotedValue( QString::fromUtf8(( char * )sqlite3_column_text( srsPreparedStatement, 2 ) ) )
+ ',' + quotedValue( QString::fromUtf8(( char * )sqlite3_column_text( srsPreparedStatement, 3 ) ) )
+ ')'
;
myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(), mySql.length(), &myPreparedStatement, &myTail );
if ( myResult != SQLITE_OK || sqlite3_step( myPreparedStatement ) != SQLITE_DONE )
@ -528,7 +528,7 @@ void QgsCustomProjectionDialog::on_pbnCalculate_clicked()
QString QgsCustomProjectionDialog::quotedValue( QString value )
{
value.replace( "'", "''" );
return value.prepend( "'" ).append( "'" );
value.replace( '\'', "''" );
return value.prepend( '\'' ).append( '\'' );
}

View File

@ -74,7 +74,7 @@ void QgsDecorationItem::setName( const char *name )
{
mName = name;
mNameConfig = name;
mNameConfig.remove( " " );
mNameConfig.remove( ' ' );
mNameTranslated = tr( name );
QgsDebugMsg( QString( "name=%1 nameconfig=%2 nametrans=%3" ).arg( mName, mNameConfig, mNameTranslated ) );
}

View File

@ -484,8 +484,8 @@ void QgsDiagramProperties::on_mDiagramTypeComboBox_currentIndexChanged( int inde
QString QgsDiagramProperties::guessLegendText( const QString& expression )
{
//trim unwanted characters from expression text for legend
QString text = expression.mid( expression.startsWith( "\"" ) ? 1 : 0 );
if ( text.endsWith( "\"" ) )
QString text = expression.mid( expression.startsWith( '\"' ) ? 1 : 0 );
if ( text.endsWith( '\"' ) )
text.chop( 1 );
return text;
}

View File

@ -191,7 +191,7 @@ QString QgsHandleBadLayers::filename( int row )
}
else if ( provider == "ogr" )
{
QStringList theURIParts = datasource.split( "|" );
QStringList theURIParts = datasource.split( '|' );
return theURIParts[0];
}
else if ( provider == "delimitedtext" )
@ -228,7 +228,7 @@ void QgsHandleBadLayers::setFilename( int row, const QString& filename )
}
else if ( provider == "ogr" )
{
QStringList theURIParts = datasource.split( "|" );
QStringList theURIParts = datasource.split( '|' );
theURIParts[0] = filename;
datasource = theURIParts.join( "|" );
}

View File

@ -705,7 +705,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer,
{
// Add format combo box item
// Space added before format to keep it first in ordered list: TODO better (user data)
QTreeWidgetItem *formatItem = new QTreeWidgetItem( QStringList() << " " + tr( "Format" ) );
QTreeWidgetItem *formatItem = new QTreeWidgetItem( QStringList() << ' ' + tr( "Format" ) );
layItem->addChild( formatItem );
lstResults->setItemWidget( formatItem, 1, formatCombo );
connect( formatCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( formatChanged( int ) ) );

View File

@ -169,6 +169,6 @@ void QgsJoinDialog::joinedLayerChanged( QgsMapLayer* layer )
if ( !mUseCustomPrefix->isChecked() )
{
mCustomPrefix->setText( layer->name() + "_" );
mCustomPrefix->setText( layer->name() + '_' );
}
}

View File

@ -67,8 +67,8 @@ void QgsLoadStyleFromDBDialog::initializeLists( const QStringList& ids, const QS
mRelatedTable->setColumnCount( relatedTableNOfCols );
mOthersTable->setColumnCount( othersTableNOfCols );
mRelatedTable->setHorizontalHeaderLabels( relatedTableHeader.split( ";" ) );
mOthersTable->setHorizontalHeaderLabels( othersTableHeader.split( ";" ) );
mRelatedTable->setHorizontalHeaderLabels( relatedTableHeader.split( ';' ) );
mOthersTable->setHorizontalHeaderLabels( othersTableHeader.split( ';' ) );
mRelatedTable->setRowCount( sectionLimit );
mOthersTable->setRowCount( ids.count() - sectionLimit );
mRelatedTable->setDisabled( relatedTableNOfCols == 1 );

View File

@ -351,6 +351,6 @@ QString QgsMapToolSimplify::statusText() const
QString txt = tr( "%1 feature(s): %2 to %3 vertices (%4%)" )
.arg( mSelectedFeatures.count() ).arg( mOriginalVertexCount ).arg( mReducedVertexCount ).arg( percent );
if ( mReducedHasErrors )
txt += "\n" + tr( "Simplification failed!" );
txt += '\n' + tr( "Simplification failed!" );
return txt;
}

View File

@ -261,7 +261,7 @@ void QgsMeasureDialog::updateUi()
QString toolTip = tr( "The calculations are based on:" );
if ( ! mTool->canvas()->hasCrsTransformEnabled() )
{
toolTip += "<br> * " + tr( "Project CRS transformation is turned off." ) + " ";
toolTip += "<br> * " + tr( "Project CRS transformation is turned off." ) + ' ';
toolTip += tr( "Canvas units setting is taken from project properties setting (%1)." ).arg( QGis::tr( mCanvasUnits ) );
toolTip += "<br> * " + tr( "Ellipsoidal calculation is not possible, as project CRS is undefined." );
setWindowTitle( tr( "Measure (OTF off)" ) );
@ -270,7 +270,7 @@ void QgsMeasureDialog::updateUi()
{
if ( mDa.ellipsoidalEnabled() )
{
toolTip += "<br> * " + tr( "Project CRS transformation is turned on and ellipsoidal calculation is selected." ) + " ";
toolTip += "<br> * " + tr( "Project CRS transformation is turned on and ellipsoidal calculation is selected." ) + ' ';
toolTip += "<br> * " + tr( "The coordinates are transformed to the chosen ellipsoid (%1), and the result is in meters" ).arg( mDa.ellipsoid() );
}
else

View File

@ -355,13 +355,13 @@ bool QgsNewSpatialiteLayerDialog::apply()
{
sql += delim + QString( "%1 %2" ).arg( quotedIdentifier(( *it )->text( 0 ) ), ( *it )->text( 1 ) );
delim = ",";
delim = ',';
++it;
}
// complete the create table statement
sql += ")";
sql += ')';
QgsDebugMsg( QString( "Creating table in database %1" ).arg( mDatabaseComboBox->currentText() ) );
@ -452,14 +452,14 @@ bool QgsNewSpatialiteLayerDialog::apply()
QString QgsNewSpatialiteLayerDialog::quotedIdentifier( QString id )
{
id.replace( "\"", "\"\"" );
return id.prepend( "\"" ).append( "\"" );
id.replace( '\"', "\"\"" );
return id.prepend( '\"' ).append( '\"' );
}
QString QgsNewSpatialiteLayerDialog::quotedValue( QString value )
{
value.replace( "'", "''" );
return value.prepend( "'" ).append( "'" );
value.replace( '\'', "''" );
return value.prepend( '\'' ).append( '\'' );
}

View File

@ -218,7 +218,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
QString myPaths = settings.value( "plugins/searchPathsForPlugins", "" ).toString();
if ( !myPaths.isEmpty() )
{
QStringList myPathList = myPaths.split( "|" );
QStringList myPathList = myPaths.split( '|' );
QStringList::const_iterator pathIt = myPathList.constBegin();
for ( ; pathIt != myPathList.constEnd(); ++pathIt )
{
@ -233,7 +233,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
myPaths = settings.value( "svg/searchPathsForSVG", "" ).toString();
if ( !myPaths.isEmpty() )
{
QStringList myPathList = myPaths.split( "|" );
QStringList myPathList = myPaths.split( '|' );
QStringList::const_iterator pathIt = myPathList.constBegin();
for ( ; pathIt != myPathList.constEnd(); ++pathIt )
{
@ -274,7 +274,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
QString proxyExcludedURLs = settings.value( "proxy/proxyExcludedUrls", "" ).toString();
if ( !proxyExcludedURLs.isEmpty() )
{
QStringList splitUrls = proxyExcludedURLs.split( "|" );
QStringList splitUrls = proxyExcludedURLs.split( '|' );
QStringList::const_iterator urlIt = splitUrls.constBegin();
for ( ; urlIt != splitUrls.constEnd(); ++urlIt )
{
@ -395,7 +395,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
{
if ( pkeyIt->contains( "srcTransform" ) || pkeyIt->contains( "destTransform" ) )
{
QStringList split = pkeyIt->split( "/" );
QStringList split = pkeyIt->split( '/' );
QString srcAuthId, destAuthId;
if ( split.size() > 0 )
{
@ -403,7 +403,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
}
if ( split.size() > 1 )
{
destAuthId = split.at( 1 ).split( "_" ).at( 0 );
destAuthId = split.at( 1 ).split( '_' ).at( 0 );
}
if ( pkeyIt->contains( "srcTransform" ) )
@ -544,7 +544,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
mSimplifyDrawingSpinBox->setValue( settings.value( "/qgis/simplifyDrawingTol", QGis::DEFAULT_MAPTOPIXEL_THRESHOLD ).toFloat() );
mSimplifyDrawingAtProvider->setChecked( !settings.value( "/qgis/simplifyLocal", true ).toBool() );
QStringList myScalesList = PROJECT_SCALES.split( "," );
QStringList myScalesList = PROJECT_SCALES.split( ',' );
myScalesList.append( "1:1" );
mSimplifyMaximumScaleComboBox->updateScales( myScalesList );
mSimplifyMaximumScaleComboBox->setScale( 1.0 / settings.value( "/qgis/simplifyMaxScale", 1 ).toFloat() );
@ -659,7 +659,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
myPaths = settings.value( "Map/scales", PROJECT_SCALES ).toString();
if ( !myPaths.isEmpty() )
{
QStringList myScalesList = myPaths.split( "," );
QStringList myScalesList = myPaths.split( ',' );
QStringList::const_iterator scaleIt = myScalesList.constBegin();
for ( ; scaleIt != myScalesList.constEnd(); ++scaleIt )
{
@ -980,9 +980,9 @@ void QgsOptions::saveOptions()
continue;
QComboBox* varApplyCmbBx = qobject_cast<QComboBox*>( mCustomVariablesTable->cellWidget( i, 0 ) );
QString customVar = varApplyCmbBx->itemData( varApplyCmbBx->currentIndex() ).toString();
customVar += "|";
customVar += '|';
customVar += mCustomVariablesTable->item( i, 1 )->text();
customVar += "=";
customVar += '=';
customVar += mCustomVariablesTable->item( i, 2 )->text();
customVars << customVar;
}
@ -994,7 +994,7 @@ void QgsOptions::saveOptions()
{
if ( i != 0 )
{
myPaths += "|";
myPaths += '|';
}
myPaths += mListPluginPaths->item( i )->text();
}
@ -1006,7 +1006,7 @@ void QgsOptions::saveOptions()
{
if ( i != 0 )
{
myPaths += "|";
myPaths += '|';
}
myPaths += mListSVGPaths->item( i )->text();
}
@ -1039,7 +1039,7 @@ void QgsOptions::saveOptions()
{
if ( i != 0 )
{
proxyExcludeString += "|";
proxyExcludeString += '|';
}
proxyExcludeString += mExcludeUrlListWidget->item( i )->text();
}
@ -1282,7 +1282,7 @@ void QgsOptions::saveOptions()
{
if ( i != 0 )
{
myPaths += ",";
myPaths += ',';
}
myPaths += mListGlobalScales->item( i )->text();
}
@ -1500,7 +1500,7 @@ QStringList QgsOptions::i18nList()
// Ignore the 'en' translation file, already added as 'en_US'.
if ( myFileName.compare( "qgis_en.qm" ) == 0 ) continue;
myList << myFileName.replace( "qgis_", "" ).replace( ".qm", "" );
myList << myFileName.remove( "qgis_" ).remove( ".qm" );
}
return myList;
}
@ -1858,7 +1858,7 @@ void QgsOptions::on_pbnDefaultScaleValues_clicked()
{
mListGlobalScales->clear();
QStringList myScalesList = PROJECT_SCALES.split( "," );
QStringList myScalesList = PROJECT_SCALES.split( ',' );
QStringList::const_iterator scaleIt = myScalesList.constBegin();
for ( ; scaleIt != myScalesList.constEnd(); ++scaleIt )
{

View File

@ -238,7 +238,7 @@ bool QgsPluginRegistry::checkQgisVersion( const QString& minVersion, const QStri
// our qgis version - cut release name after version number
QString qgisVersion = QString( QGis::QGIS_VERSION ).section( '-', 0, 0 );
QStringList qgisVersionParts = qgisVersion.split( "." );
QStringList qgisVersionParts = qgisVersion.split( '.' );
int qgisMajor = qgisVersionParts.at( 0 ).toInt();
int qgisMinor = qgisVersionParts.at( 1 ).toInt();
@ -463,7 +463,7 @@ void QgsPluginRegistry::restoreSessionPlugins( const QString& thePluginDirString
for ( uint i = 0; i < myPluginDir.count(); i++ )
{
QString myFullPath = thePluginDirString + "/" + myPluginDir[i];
QString myFullPath = thePluginDirString + '/' + myPluginDir[i];
if ( checkCppPlugin( myFullPath ) )
{
// check if the plugin was active on last session

View File

@ -740,10 +740,10 @@ void QgsProjectProperties::apply()
QgsProject::instance()->writeEntry( "WMSFees", "/", mWMSFees->text() );
QgsProject::instance()->writeEntry( "WMSAccessConstraints", "/", mWMSAccessConstraints->text() );
//WMS keyword list
QStringList keywordStringList = mWMSKeywordList->text().split( "," );
QStringList keywordStringList = mWMSKeywordList->text().split( ',' );
if ( keywordStringList.size() > 0 )
{
QgsProject::instance()->writeEntry( "WMSKeywordList", "/", mWMSKeywordList->text().split( "," ) );
QgsProject::instance()->writeEntry( "WMSKeywordList", "/", mWMSKeywordList->text().split( ',' ) );
}
else
{

View File

@ -78,7 +78,7 @@ QString QgsRasterCalcDialog::outputFile() const
return outputFileName;
}
return outputFileName + "." + it.value();
return outputFileName + '.' + it.value();
}
QString QgsRasterCalcDialog::outputFormat() const
@ -146,7 +146,7 @@ void QgsRasterCalcDialog::insertAvailableRasterBands()
QgsRasterCalculatorEntry entry;
entry.raster = rlayer;
entry.bandNumber = i + 1;
entry.ref = rlayer->name() + "@" + QString::number( i + 1 );
entry.ref = rlayer->name() + '@' + QString::number( i + 1 );
mAvailableRasterBands.push_back( entry );
mRasterBandsListWidget->addItem( entry.ref );
}
@ -450,8 +450,8 @@ QString QgsRasterCalcDialog::quoteBandEntry( const QString& layerName )
{
// '"' -> '\\"'
QString quotedName = layerName;
quotedName.replace( "\"", "\\\"" );
quotedName.append( "\"" );
quotedName.prepend( "\"" );
quotedName.replace( '\"', "\\\"" );
quotedName.append( '\"' );
quotedName.prepend( '\"' );
return quotedName;
}

View File

@ -1239,13 +1239,13 @@ void QgsRasterLayerProperties::on_pbnExportTransparentPixelValues_clicked()
if ( myOutputFile.open( QFile::WriteOnly ) )
{
QTextStream myOutputStream( &myOutputFile );
myOutputStream << "# " << tr( "QGIS Generated Transparent Pixel Value Export File" ) << "\n";
myOutputStream << "# " << tr( "QGIS Generated Transparent Pixel Value Export File" ) << '\n';
if ( rasterIsMultiBandColor() )
{
myOutputStream << "#\n#\n# " << tr( "Red" ) << "\t" << tr( "Green" ) << "\t" << tr( "Blue" ) << "\t" << tr( "Percent Transparent" );
for ( int myTableRunner = 0; myTableRunner < tableTransparency->rowCount(); myTableRunner++ )
{
myOutputStream << "\n" << QString::number( transparencyCellValue( myTableRunner, 0 ) ) << "\t"
myOutputStream << '\n' << QString::number( transparencyCellValue( myTableRunner, 0 ) ) << "\t"
<< QString::number( transparencyCellValue( myTableRunner, 1 ) ) << "\t"
<< QString::number( transparencyCellValue( myTableRunner, 2 ) ) << "\t"
<< QString::number( transparencyCellValue( myTableRunner, 3 ) );
@ -1257,7 +1257,7 @@ void QgsRasterLayerProperties::on_pbnExportTransparentPixelValues_clicked()
for ( int myTableRunner = 0; myTableRunner < tableTransparency->rowCount(); myTableRunner++ )
{
myOutputStream << "\n" << QString::number( transparencyCellValue( myTableRunner, 0 ) ) << "\t"
myOutputStream << '\n' << QString::number( transparencyCellValue( myTableRunner, 0 ) ) << "\t"
<< QString::number( transparencyCellValue( myTableRunner, 1 ) ) << "\t"
<< QString::number( transparencyCellValue( myTableRunner, 2 ) );
}
@ -1411,7 +1411,7 @@ void QgsRasterLayerProperties::on_pbnImportTransparentPixelValues_clicked()
myInputLine = myInputStream.readLine();
if ( !myInputLine.isEmpty() )
{
if ( !myInputLine.simplified().startsWith( "#" ) )
if ( !myInputLine.simplified().startsWith( '#' ) )
{
QStringList myTokens = myInputLine.split( QRegExp( "\\s+" ), QString::SkipEmptyParts );
if ( myTokens.count() != 4 )
@ -1444,7 +1444,7 @@ void QgsRasterLayerProperties::on_pbnImportTransparentPixelValues_clicked()
myInputLine = myInputStream.readLine();
if ( !myInputLine.isEmpty() )
{
if ( !myInputLine.simplified().startsWith( "#" ) )
if ( !myInputLine.simplified().startsWith( '#' ) )
{
QStringList myTokens = myInputLine.split( QRegExp( "\\s+" ), QString::SkipEmptyParts );
if ( myTokens.count() != 3 && myTokens.count() != 2 ) // 2 for QGIS < 1.9 compatibility
@ -1556,7 +1556,7 @@ void QgsRasterLayerProperties::sliderTransparency_valueChanged( int theValue )
{
//set the transparency percentage label to a suitable value
int myInt = static_cast < int >(( theValue / 255.0 ) * 100 ); //255.0 to prevent integer division
lblTransparencyPercent->setText( QString::number( myInt ) + "%" );
lblTransparencyPercent->setText( QString::number( myInt ) + '%' );
}//sliderTransparency_valueChanged
void QgsRasterLayerProperties::toggleSaturationControls( int grayscaleMode )

View File

@ -293,7 +293,7 @@ QString QgsSettingsTree::itemKey( QTreeWidgetItem *item )
QTreeWidgetItem *ancestor = item->parent();
while ( ancestor )
{
key.prepend( ancestor->text( 0 ) + "/" );
key.prepend( ancestor->text( 0 ) + '/' );
ancestor = ancestor->parent();
}

View File

@ -61,7 +61,7 @@ QgsVariantDelegate::QgsVariantDelegate( QObject* parent )
mDateExp.setPattern( "([0-9]{,4})-([0-9]{,2})-([0-9]{,2})" );
mTimeExp.setPattern( "([0-9]{,2}):([0-9]{,2}):([0-9]{,2})" );
mDateTimeExp.setPattern( mDateExp.pattern() + "T" + mTimeExp.pattern() );
mDateTimeExp.setPattern( mDateExp.pattern() + 'T' + mTimeExp.pattern() );
}
void QgsVariantDelegate::paint( QPainter* painter,
@ -225,7 +225,7 @@ void QgsVariantDelegate::setModelData( QWidget* editor, QAbstractItemModel* mode
value = QSize( mSizeExp.cap( 1 ).toInt(), mSizeExp.cap( 2 ).toInt() );
break;
case QVariant::StringList:
value = text.split( "," );
value = text.split( ',' );
break;
case QVariant::Time:
{

View File

@ -448,7 +448,7 @@ void QgsVectorLayerProperties::syncToLayer( void )
mSimplifyDrawingGroupBox->setEnabled( false );
}
QStringList myScalesList = PROJECT_SCALES.split( "," );
QStringList myScalesList = PROJECT_SCALES.split( ',' );
myScalesList.append( "1:1" );
mSimplifyMaximumScaleComboBox->updateScales( myScalesList );
mSimplifyMaximumScaleComboBox->setScale( 1.0 / simplifyMethod.maximumScale() );

View File

@ -63,7 +63,7 @@ void QgsVersionInfo::versionReplyFinished()
pos += contentFlag.length();
versionMessage = versionMessage.mid( pos );
QStringList parts = versionMessage.split( "|", QString::SkipEmptyParts );
QStringList parts = versionMessage.split( '|', QString::SkipEmptyParts );
// check the version from the server against our version
mLatestVersion = parts[0].toInt();
mDownloadInfo = parts.value( 1 );

View File

@ -100,7 +100,7 @@ bool QgsAuthBasicMethod::updateDataSourceUriItems( QStringList &connectionItems,
return false;
}
QString userparam = "user='" + escapeUserPass( username ) + "'";
QString userparam = "user='" + escapeUserPass( username ) + '\'';
int userindx = connectionItems.indexOf( QRegExp( "^user='.*" ) );
if ( userindx != -1 )
{
@ -111,7 +111,7 @@ bool QgsAuthBasicMethod::updateDataSourceUriItems( QStringList &connectionItems,
connectionItems.append( userparam );
}
QString passparam = "password='" + escapeUserPass( password ) + "'";
QString passparam = "password='" + escapeUserPass( password ) + '\'';
int passindx = connectionItems.indexOf( QRegExp( "^password='.*" ) );
if ( passindx != -1 )
{
@ -190,7 +190,7 @@ QString QgsAuthBasicMethod::escapeUserPass( const QString &theVal, QChar delim )
{
QString val = theVal;
val.replace( "\\", "\\\\" );
val.replace( '\\', "\\\\" );
val.replace( delim, QString( "\\%1" ).arg( delim ) );
return val;

View File

@ -62,7 +62,7 @@ bool QgsAuthPkiPathsEdit::validateConfig()
QSslCertificate cert;
QFile file( certpath );
QFileInfo fileinfo( file );
QString ext( fileinfo.fileName().replace( fileinfo.completeBaseName(), "" ).toLower() );
QString ext( fileinfo.fileName().remove( fileinfo.completeBaseName() ).toLower() );
if ( ext.isEmpty() )
{
writePkiMessage( lePkiPathsMsg, tr( "Certificate file has no extension" ), Invalid );

View File

@ -297,7 +297,7 @@ void QgsAuthCertUtils::appendDirSegment_( QStringList &dirname,
{
if ( !value.isEmpty() )
{
dirname.append( segment + "=" + value.replace( ",", "\\," ) );
dirname.append( segment + '=' + value.replace( ',', "\\," ) );
}
}

View File

@ -232,7 +232,7 @@ QString QgsAuthMethodRegistry::pluginList( bool asHtml ) const
}
else
{
list += "\n";
list += '\n';
}
++it;

View File

@ -317,8 +317,8 @@ void QgsComposerLabel::replaceDateText( QString& text ) const
{
//check if there is a bracket just after $CURRENT_DATE
QString formatText;
int openingBracketPos = text.indexOf( "(", currentDatePos );
int closingBracketPos = text.indexOf( ")", openingBracketPos + 1 );
int openingBracketPos = text.indexOf( '(', currentDatePos );
int closingBracketPos = text.indexOf( ')', openingBracketPos + 1 );
if ( openingBracketPos != -1 &&
closingBracketPos != -1 &&
( closingBracketPos - openingBracketPos ) > 1 &&

View File

@ -563,7 +563,7 @@ QStringList QgsComposerMap::layersToRender( const QgsExpressionContext* context
{
renderLayerSet.clear();
QStringList layerNames = exprVal.toString().split( "|" );
QStringList layerNames = exprVal.toString().split( '|' );
//need to convert layer names to layer ids
Q_FOREACH ( const QString& name, layerNames )
{

View File

@ -1549,7 +1549,7 @@ QString QgsComposerMapGrid::gridAnnotationString( double value, QgsComposerMapGr
annotationString = p.toDegreesMinutesSeconds( mGridAnnotationPrecision, true, true );
}
QStringList split = annotationString.split( "," );
QStringList split = annotationString.split( ',' );
if ( coord == QgsComposerMapGrid::Longitude )
{
return split.at( 0 );

View File

@ -940,7 +940,7 @@ bool QgsComposerTableV2::calculateMaxColumnWidths()
if ( mColumns.at( col )->width() <= 0 )
{
//column width set to automatic, so check content size
QStringList multiLineSplit = ( *colIt ).toString().split( "\n" );
QStringList multiLineSplit = ( *colIt ).toString().split( '\n' );
currentCellTextWidth = 0;
Q_FOREACH ( const QString& line, multiLineSplit )
{
@ -1166,7 +1166,7 @@ bool QgsComposerTableV2::textRequiresWrapping( const QString& text, double colum
if ( columnWidth == 0 || mWrapBehaviour != WrapText )
return false;
QStringList multiLineSplit = text.split( "\n" );
QStringList multiLineSplit = text.split( '\n' );
double currentTextWidth = 0;
Q_FOREACH ( const QString& line, multiLineSplit )
{
@ -1178,14 +1178,14 @@ bool QgsComposerTableV2::textRequiresWrapping( const QString& text, double colum
QString QgsComposerTableV2::wrappedText( const QString &value, double columnWidth, const QFont &font ) const
{
QStringList lines = value.split( "\n" );
QStringList lines = value.split( '\n' );
QStringList outLines;
Q_FOREACH ( const QString& line, lines )
{
if ( textRequiresWrapping( line, columnWidth, font ) )
{
//first step is to identify words which must be on their own line (too long to fit)
QStringList words = line.split( " " );
QStringList words = line.split( ' ' );
QStringList linesToProcess;
QString wordsInCurrentLine;
Q_FOREACH ( const QString& word, words )
@ -1201,7 +1201,7 @@ QString QgsComposerTableV2::wrappedText( const QString &value, double columnWidt
else
{
if ( !wordsInCurrentLine.isEmpty() )
wordsInCurrentLine.append( " " );
wordsInCurrentLine.append( ' ' );
wordsInCurrentLine.append( word );
}
}
@ -1211,7 +1211,7 @@ QString QgsComposerTableV2::wrappedText( const QString &value, double columnWidt
Q_FOREACH ( const QString& line, linesToProcess )
{
QString remainingText = line;
int lastPos = remainingText.lastIndexOf( " " );
int lastPos = remainingText.lastIndexOf( ' ' );
while ( lastPos > -1 )
{
if ( !textRequiresWrapping( remainingText.left( lastPos ), columnWidth, font ) )
@ -1220,7 +1220,7 @@ QString QgsComposerTableV2::wrappedText( const QString &value, double columnWidt
remainingText = remainingText.mid( lastPos + 1 );
lastPos = 0;
}
lastPos = remainingText.lastIndexOf( " ", lastPos - 1 );
lastPos = remainingText.lastIndexOf( ' ', lastPos - 1 );
}
outLines << remainingText;
}

View File

@ -483,7 +483,7 @@ double QgsComposerUtils::textWidthMM( const QFont &font, const QString &text )
double QgsComposerUtils::textHeightMM( const QFont &font, const QString &text, double multiLineHeight )
{
QStringList multiLineSplit = text.split( "\n" );
QStringList multiLineSplit = text.split( '\n' );
int lines = multiLineSplit.size();
//upscale using FONT_WORKAROUND_SCALE

View File

@ -1092,7 +1092,7 @@ bool QgsComposition::loadFromTemplate( const QDomDocument& doc, QMap<QString, QS
QMap<QString, QString>::const_iterator sIt = substitutionMap->constBegin();
for ( ; sIt != substitutionMap->constEnd(); ++sIt )
{
xmlString = xmlString.replace( "[" + sIt.key() + "]", encodeStringForXML( sIt.value() ) );
xmlString = xmlString.replace( '[' + sIt.key() + ']', encodeStringForXML( sIt.value() ) );
}
QString errorMsg;
@ -2997,11 +2997,11 @@ void QgsComposition::renderRect( QPainter* p, const QRectF& rect )
QString QgsComposition::encodeStringForXML( const QString& str )
{
QString modifiedStr( str );
modifiedStr.replace( "&", "&amp;" );
modifiedStr.replace( "\"", "&quot;" );
modifiedStr.replace( "'", "&apos;" );
modifiedStr.replace( "<", "&lt;" );
modifiedStr.replace( ">", "&gt;" );
modifiedStr.replace( '&', "&amp;" );
modifiedStr.replace( '\"', "&quot;" );
modifiedStr.replace( '\'', "&apos;" );
modifiedStr.replace( '<', "&lt;" );
modifiedStr.replace( '>', "&gt;" );
return modifiedStr;
}

View File

@ -96,7 +96,7 @@ void QgsScaleBarStyle::drawLabels( QPainter* p ) const
{
currentNumericLabel = QString::number( currentLabelNumber / mScaleBar->numMapUnitsPerScaleBarUnit() );
QgsComposerUtils::drawText( p, QPointF( segmentInfo.last().first + mScaleBar->segmentMillimeters() - QgsComposerUtils::textWidthMM( mScaleBar->font(), currentNumericLabel ) / 2 + xOffset, QgsComposerUtils::fontAscentMM( mScaleBar->font() ) + mScaleBar->boxContentSpace() ),
currentNumericLabel + " " + mScaleBar->unitLabeling(), mScaleBar->font(), mScaleBar->fontColor() );
currentNumericLabel + ' ' + mScaleBar->unitLabeling(), mScaleBar->font(), mScaleBar->fontColor() );
}
p->restore();
@ -116,7 +116,7 @@ QRectF QgsScaleBarStyle::calculateBoxSize() const
double largestLabelNumber = mScaleBar->numSegments() * mScaleBar->numUnitsPerSegment() / mScaleBar->numMapUnitsPerScaleBarUnit();
QString largestNumberLabel = QString::number( largestLabelNumber );
QString largestLabel = QString::number( largestLabelNumber ) + " " + mScaleBar->unitLabeling();
QString largestLabel = QString::number( largestLabelNumber ) + ' ' + mScaleBar->unitLabeling();
double largestLabelWidth = QgsComposerUtils::textWidthMM( mScaleBar->font(), largestLabel ) - QgsComposerUtils::textWidthMM( mScaleBar->font(), largestNumberLabel ) / 2;
double totalBarLength = 0.0;

View File

@ -455,14 +455,14 @@ void QgsDxfExport::writeInt( int i )
void QgsDxfExport::writeDouble( double d )
{
QString s( qgsDoubleToString( d ) );
if ( !s.contains( "." ) )
if ( !s.contains( '.' ) )
s += ".0";
mTextStream << s << "\n";
mTextStream << s << '\n';
}
void QgsDxfExport::writeString( const QString& s )
{
mTextStream << s << "\n";
mTextStream << s << '\n';
}
int QgsDxfExport::writeToFile( QIODevice* d, const QString& encoding )
@ -4085,18 +4085,18 @@ QString QgsDxfExport::dxfLayerName( const QString& name )
// replaced restricted characters with underscore
// < > / \ " : ; ? * | = '
// See http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%202010%20User%20Documentation/index.html?url=WS1a9193826455f5ffa23ce210c4a30acaf-7345.htm,topicNumber=d0e41665
layerName.replace( "<", "_" );
layerName.replace( ">", "_" );
layerName.replace( "/", "_" );
layerName.replace( "\\", "_" );
layerName.replace( "\"", "_" );
layerName.replace( ":", "_" );
layerName.replace( ";", "_" );
layerName.replace( "?", "_" );
layerName.replace( "*", "_" );
layerName.replace( "|", "_" );
layerName.replace( "=", "_" );
layerName.replace( "\'", "_" );
layerName.replace( '<', '_' );
layerName.replace( '>', '_' );
layerName.replace( '/', '_' );
layerName.replace( '\\', '_' );
layerName.replace( '\"', '_' );
layerName.replace( ':', '_' );
layerName.replace( ';', '_' );
layerName.replace( '?', '_' );
layerName.replace( '*', '_' );
layerName.replace( '|', '_' );
layerName.replace( '=', '_' );
layerName.replace( '\'', '_' );
return layerName;
}

View File

@ -153,9 +153,9 @@ QString QgsAbstractGeometryV2::wktTypeStr() const
{
QString wkt = geometryType();
if ( is3D() )
wkt += "Z";
wkt += 'Z';
if ( isMeasure() )
wkt += "M";
wkt += 'M';
return wkt;
}

View File

@ -269,7 +269,7 @@ unsigned char* QgsCircularStringV2::asWkb( int& binarySize ) const
QString QgsCircularStringV2::asWkt( int precision ) const
{
QString wkt = wktTypeStr() + " ";
QString wkt = wktTypeStr() + ' ';
QList<QgsPointV2> pts;
points( pts );
wkt += QgsGeometryUtils::pointsToWKT( pts, precision, is3D(), isMeasure() );

View File

@ -219,15 +219,15 @@ QString QgsCompoundCurveV2::asWkt( int precision ) const
if ( dynamic_cast<const QgsLineStringV2*>( curve ) )
{
// Type names of linear geometries are omitted
childWkt = childWkt.mid( childWkt.indexOf( "(" ) );
childWkt = childWkt.mid( childWkt.indexOf( '(' ) );
}
wkt += childWkt + ",";
wkt += childWkt + ',';
}
if ( wkt.endsWith( "," ) )
if ( wkt.endsWith( ',' ) )
{
wkt.chop( 1 );
}
wkt += ")";
wkt += ')';
return wkt;
}

View File

@ -257,9 +257,9 @@ QString QgsCurvePolygonV2::asWkt( int precision ) const
if ( dynamic_cast<QgsLineStringV2*>( mExteriorRing ) )
{
// Type names of linear geometries are omitted
childWkt = childWkt.mid( childWkt.indexOf( "(" ) );
childWkt = childWkt.mid( childWkt.indexOf( '(' ) );
}
wkt += childWkt + ",";
wkt += childWkt + ',';
}
Q_FOREACH ( const QgsCurveV2* curve, mInteriorRings )
{
@ -267,15 +267,15 @@ QString QgsCurvePolygonV2::asWkt( int precision ) const
if ( dynamic_cast<const QgsLineStringV2*>( curve ) )
{
// Type names of linear geometries are omitted
childWkt = childWkt.mid( childWkt.indexOf( "(" ) );
childWkt = childWkt.mid( childWkt.indexOf( '(' ) );
}
wkt += childWkt + ",";
wkt += childWkt + ',';
}
if ( wkt.endsWith( "," ) )
if ( wkt.endsWith( ',' ) )
{
wkt.chop( 1 ); // Remove last ","
wkt.chop( 1 ); // Remove last ','
}
wkt += ")";
wkt += ')';
return wkt;
}

View File

@ -266,15 +266,15 @@ QString QgsGeometryCollectionV2::asWkt( int precision ) const
QString childWkt = geom->asWkt( precision );
if ( wktOmitChildType() )
{
childWkt = childWkt.mid( childWkt.indexOf( "(" ) );
childWkt = childWkt.mid( childWkt.indexOf( '(' ) );
}
wkt += childWkt + ",";
wkt += childWkt + ',';
}
if ( wkt.endsWith( "," ) )
if ( wkt.endsWith( ',' ) )
{
wkt.chop( 1 ); // Remove last ","
wkt.chop( 1 ); // Remove last ','
}
wkt += ")";
wkt += ')';
return wkt;
}

View File

@ -464,14 +464,14 @@ QList<QgsPointV2> QgsGeometryUtils::pointsFromWKT( const QString &wktCoordinateL
{
int dim = 2 + is3D + isMeasure;
QList<QgsPointV2> points;
QStringList coordList = wktCoordinateList.split( ",", QString::SkipEmptyParts );
QStringList coordList = wktCoordinateList.split( ',', QString::SkipEmptyParts );
//first scan through for extra unexpected dimensions
bool foundZ = false;
bool foundM = false;
Q_FOREACH ( const QString& pointCoordinates, coordList )
{
QStringList coordinates = pointCoordinates.split( " ", QString::SkipEmptyParts );
QStringList coordinates = pointCoordinates.split( ' ', QString::SkipEmptyParts );
if ( coordinates.size() == 3 && !foundZ && !foundM && !is3D && !isMeasure )
{
// 3 dimensional coordinates, but not specifically marked as such. We allow this
@ -489,7 +489,7 @@ QList<QgsPointV2> QgsGeometryUtils::pointsFromWKT( const QString &wktCoordinateL
Q_FOREACH ( const QString& pointCoordinates, coordList )
{
QStringList coordinates = pointCoordinates.split( " ", QString::SkipEmptyParts );
QStringList coordinates = pointCoordinates.split( ' ', QString::SkipEmptyParts );
if ( coordinates.size() < dim )
continue;
@ -550,16 +550,16 @@ QString QgsGeometryUtils::pointsToWKT( const QList<QgsPointV2>& points, int prec
Q_FOREACH ( const QgsPointV2& p, points )
{
wkt += qgsDoubleToString( p.x(), precision );
wkt += " " + qgsDoubleToString( p.y(), precision );
wkt += ' ' + qgsDoubleToString( p.y(), precision );
if ( is3D )
wkt += " " + qgsDoubleToString( p.z(), precision );
wkt += ' ' + qgsDoubleToString( p.z(), precision );
if ( isMeasure )
wkt += " " + qgsDoubleToString( p.m(), precision );
wkt += ' ' + qgsDoubleToString( p.m(), precision );
wkt += ", ";
}
if ( wkt.endsWith( ", " ) )
wkt.chop( 2 ); // Remove last ", "
wkt += ")";
wkt += ')';
return wkt;
}
@ -570,9 +570,9 @@ QDomElement QgsGeometryUtils::pointsToGML2( const QList<QgsPointV2>& points, QDo
QString strCoordinates;
Q_FOREACH ( const QgsPointV2& p, points )
strCoordinates += qgsDoubleToString( p.x(), precision ) + "," + qgsDoubleToString( p.y(), precision ) + " ";
strCoordinates += qgsDoubleToString( p.x(), precision ) + ',' + qgsDoubleToString( p.y(), precision ) + ' ';
if ( strCoordinates.endsWith( " " ) )
if ( strCoordinates.endsWith( ' ' ) )
strCoordinates.chop( 1 ); // Remove trailing space
elemCoordinates.appendChild( doc.createTextNode( strCoordinates ) );
@ -587,11 +587,11 @@ QDomElement QgsGeometryUtils::pointsToGML3( const QList<QgsPointV2>& points, QDo
QString strCoordinates;
Q_FOREACH ( const QgsPointV2& p, points )
{
strCoordinates += qgsDoubleToString( p.x(), precision ) + " " + qgsDoubleToString( p.y(), precision ) + " ";
strCoordinates += qgsDoubleToString( p.x(), precision ) + ' ' + qgsDoubleToString( p.y(), precision ) + ' ';
if ( is3D )
strCoordinates += qgsDoubleToString( p.z(), precision ) + " ";
strCoordinates += qgsDoubleToString( p.z(), precision ) + ' ';
}
if ( strCoordinates.endsWith( " " ) )
if ( strCoordinates.endsWith( ' ' ) )
strCoordinates.chop( 1 ); // Remove trailing space
elemPosList.appendChild( doc.createTextNode( strCoordinates ) );
@ -603,13 +603,13 @@ QString QgsGeometryUtils::pointsToJSON( const QList<QgsPointV2>& points, int pre
QString json = "[ ";
Q_FOREACH ( const QgsPointV2& p, points )
{
json += "[" + qgsDoubleToString( p.x(), precision ) + ", " + qgsDoubleToString( p.y(), precision ) + "], ";
json += '[' + qgsDoubleToString( p.x(), precision ) + ", " + qgsDoubleToString( p.y(), precision ) + "], ";
}
if ( json.endsWith( ", " ) )
{
json.chop( 2 ); // Remove last ", "
}
json += "]";
json += ']';
return json;
}
@ -636,8 +636,8 @@ QStringList QgsGeometryUtils::wktGetChildBlocks( const QString &wkt, const QStri
{
if ( !block.isEmpty() )
{
if ( block.startsWith( "(" ) && !defaultType.isEmpty() )
block.prepend( defaultType + " " );
if ( block.startsWith( '(' ) && !defaultType.isEmpty() )
block.prepend( defaultType + ' ' );
blocks.append( block );
}
block.clear();
@ -651,8 +651,8 @@ QStringList QgsGeometryUtils::wktGetChildBlocks( const QString &wkt, const QStri
}
if ( !block.isEmpty() )
{
if ( block.startsWith( "(" ) && !defaultType.isEmpty() )
block.prepend( defaultType + " " );
if ( block.startsWith( '(' ) && !defaultType.isEmpty() )
block.prepend( defaultType + ' ' );
blocks.append( block );
}
return blocks;

View File

@ -105,7 +105,7 @@ unsigned char* QgsLineStringV2::asWkb( int& binarySize ) const
QString QgsLineStringV2::asWkt( int precision ) const
{
QString wkt = wktTypeStr() + " ";
QString wkt = wktTypeStr() + ' ';
QList<QgsPointV2> pts;
points( pts );
wkt += QgsGeometryUtils::pointsToWKT( pts, precision, is3D(), isMeasure() );
@ -143,7 +143,7 @@ QString QgsLineStringV2::asJSON( int precision ) const
QList<QgsPointV2> pts;
points( pts );
return "{\"type\": \"LineString\", \"coordinates\": " + QgsGeometryUtils::pointsToJSON( pts, precision ) + "}";
return "{\"type\": \"LineString\", \"coordinates\": " + QgsGeometryUtils::pointsToJSON( pts, precision ) + '}';
}
double QgsLineStringV2::length() const

View File

@ -33,7 +33,7 @@ bool QgsMultiPointV2::fromWkt( const QString& wkt )
if ( regex.indexIn( collectionWkt ) >= 0 )
{
//alternate style without extra brackets, upgrade to standard
collectionWkt.replace( "(", "((" ).replace( ")", "))" ).replace( ",", "),(" );
collectionWkt.replace( '(', "((" ).replace( ')', "))" ).replace( ',', "),(" );
}
return fromCollectionWkt( collectionWkt, QList<QgsAbstractGeometryV2*>() << new QgsPointV2, "Point" );

View File

@ -72,7 +72,7 @@ QString QgsMultiPolygonV2::asJSON( int precision ) const
{
if ( dynamic_cast<const QgsPolygonV2*>( geom ) )
{
json += "[";
json += '[';
const QgsPolygonV2* polygon = static_cast<const QgsPolygonV2*>( geom );

View File

@ -79,7 +79,7 @@ QString QgsMultiSurfaceV2::asJSON( int precision ) const
{
if ( dynamic_cast<const QgsSurfaceV2*>( geom ) )
{
json += "[";
json += '[';
QgsPolygonV2* polygon = static_cast<const QgsSurfaceV2*>( geom )->surfaceToPolygon();

View File

@ -88,7 +88,7 @@ bool QgsPointV2::fromWkt( const QString& wkt )
return false;
mWkbType = parts.first;
QStringList coordinates = parts.second.split( " ", QString::SkipEmptyParts );
QStringList coordinates = parts.second.split( ' ', QString::SkipEmptyParts );
if ( coordinates.size() < 2 + is3D() + isMeasure() )
{
clear();
@ -148,12 +148,12 @@ unsigned char* QgsPointV2::asWkb( int& binarySize ) const
QString QgsPointV2::asWkt( int precision ) const
{
QString wkt = wktTypeStr() + " (";
wkt += qgsDoubleToString( mX, precision ) + " " + qgsDoubleToString( mY, precision );
wkt += qgsDoubleToString( mX, precision ) + ' ' + qgsDoubleToString( mY, precision );
if ( is3D() )
wkt += " " + qgsDoubleToString( mZ, precision );
wkt += ' ' + qgsDoubleToString( mZ, precision );
if ( isMeasure() )
wkt += " " + qgsDoubleToString( mM, precision );
wkt += ")";
wkt += ' ' + qgsDoubleToString( mM, precision );
wkt += ')';
return wkt;
}
@ -161,7 +161,7 @@ QDomElement QgsPointV2::asGML2( QDomDocument& doc, int precision, const QString&
{
QDomElement elemPoint = doc.createElementNS( ns, "Point" );
QDomElement elemCoordinates = doc.createElementNS( ns, "coordinates" );
QString strCoordinates = qgsDoubleToString( mX, precision ) + "," + qgsDoubleToString( mY, precision );
QString strCoordinates = qgsDoubleToString( mX, precision ) + ',' + qgsDoubleToString( mY, precision );
elemCoordinates.appendChild( doc.createTextNode( strCoordinates ) );
elemPoint.appendChild( elemCoordinates );
return elemPoint;
@ -172,9 +172,9 @@ QDomElement QgsPointV2::asGML3( QDomDocument& doc, int precision, const QString&
QDomElement elemPoint = doc.createElementNS( ns, "Point" );
QDomElement elemPosList = doc.createElementNS( ns, "posList" );
elemPosList.setAttribute( "srsDimension", is3D() ? 3 : 2 );
QString strCoordinates = qgsDoubleToString( mX, precision ) + " " + qgsDoubleToString( mY, precision );
QString strCoordinates = qgsDoubleToString( mX, precision ) + ' ' + qgsDoubleToString( mY, precision );
if ( is3D() )
strCoordinates += " " + qgsDoubleToString( mZ, precision );
strCoordinates += ' ' + qgsDoubleToString( mZ, precision );
elemPosList.appendChild( doc.createTextNode( strCoordinates ) );
elemPoint.appendChild( elemPosList );

View File

@ -55,7 +55,7 @@ QgsWKBTypes::Type QgsWKBTypes::flatType( Type type )
QgsWKBTypes::Type QgsWKBTypes::parseType( const QString &wktStr )
{
QString typestr = wktStr.left( wktStr.indexOf( '(' ) ).simplified().replace( " ", "" );
QString typestr = wktStr.left( wktStr.indexOf( '(' ) ).simplified().remove( ' ' );
Q_FOREACH ( const Type& type, entries()->keys() )
{
QMap< Type, wkbEntry >::const_iterator it = entries()->constFind( type );

View File

@ -166,7 +166,7 @@ QextSerialEnumerator::~QextSerialEnumerator( )
{
PDEV_BROADCAST_DEVICEINTERFACE pDevInf = (PDEV_BROADCAST_DEVICEINTERFACE)pHdr;
// delimiters are different across APIs...change to backslash. ugh.
QString deviceID = TCHARToQString(pDevInf->dbcc_name).toUpper().replace("#", "\\");
QString deviceID = TCHARToQString(pDevInf->dbcc_name).toUpper().replace('#', "\\");
matchAndDispatchChangedDevice(deviceID, GUID_DEVCLASS_PORTS, wParam);
}

View File

@ -144,11 +144,11 @@ void QgsGPSDetector::advance()
return;
}
if ( mPortList[ mPortIndex ].first.contains( ":" ) )
if ( mPortList[ mPortIndex ].first.contains( ':' ) )
{
mBaudIndex = mBaudList.size() - 1;
QStringList gpsParams = mPortList[ mPortIndex ].first.split( ":" );
QStringList gpsParams = mPortList[ mPortIndex ].first.split( ':' );
Q_ASSERT( gpsParams.size() >= 3 );

View File

@ -305,7 +305,7 @@ QString QgsLayerTreeGroup::dump() const
QString header = QString( "GROUP: %1 visible=%2 expanded=%3\n" ).arg( name() ).arg( mChecked ).arg( mExpanded );
QStringList childrenDump;
Q_FOREACH ( QgsLayerTreeNode* node, mChildren )
childrenDump << node->dump().split( "\n" );
childrenDump << node->dump().split( '\n' );
for ( int i = 0; i < childrenDump.count(); ++i )
childrenDump[i].prepend( " " );
return header + childrenDump.join( "\n" );

View File

@ -132,7 +132,7 @@ void QgsApplication::init( QString customConfigPath )
qDebug( "- source directory: %s", ABISYM( mBuildSourcePath ).toUtf8().data() );
qDebug( "- output directory of the build: %s", ABISYM( mBuildOutputPath ).toUtf8().data() );
#ifdef _MSC_VER
ABISYM( mCfgIntDir ) = prefixPath.split( "/", QString::SkipEmptyParts ).last();
ABISYM( mCfgIntDir ) = prefixPath.split( '/', QString::SkipEmptyParts ).last();
qDebug( "- cfg: %s", ABISYM( mCfgIntDir ).toUtf8().data() );
#endif
}
@ -142,16 +142,16 @@ void QgsApplication::init( QString customConfigPath )
// we run from source directory - not installed to destination (specified prefix)
ABISYM( mPrefixPath ) = QString(); // set invalid path
#if defined(_MSC_VER) && !defined(USING_NMAKE)
setPluginPath( ABISYM( mBuildOutputPath ) + "/" + QString( QGIS_PLUGIN_SUBDIR ) + "/" + ABISYM( mCfgIntDir ) );
setPluginPath( ABISYM( mBuildOutputPath ) + '/' + QString( QGIS_PLUGIN_SUBDIR ) + '/' + ABISYM( mCfgIntDir ) );
#else
setPluginPath( ABISYM( mBuildOutputPath ) + "/" + QString( QGIS_PLUGIN_SUBDIR ) );
setPluginPath( ABISYM( mBuildOutputPath ) + '/' + QString( QGIS_PLUGIN_SUBDIR ) );
#endif
setPkgDataPath( ABISYM( mBuildSourcePath ) ); // directly source path - used for: doc, resources, svg
ABISYM( mLibraryPath ) = ABISYM( mBuildOutputPath ) + "/" + QGIS_LIB_SUBDIR + "/";
ABISYM( mLibraryPath ) = ABISYM( mBuildOutputPath ) + '/' + QGIS_LIB_SUBDIR + '/';
#if defined(_MSC_VER) && !defined(USING_NMAKE)
ABISYM( mLibexecPath ) = ABISYM( mBuildOutputPath ) + "/" + QGIS_LIBEXEC_SUBDIR + "/" + ABISYM( mCfgIntDir ) + "/";
ABISYM( mLibexecPath ) = ABISYM( mBuildOutputPath ) + '/' + QGIS_LIBEXEC_SUBDIR + '/' + ABISYM( mCfgIntDir ) + '/';
#else
ABISYM( mLibexecPath ) = ABISYM( mBuildOutputPath ) + "/" + QGIS_LIBEXEC_SUBDIR + "/";
ABISYM( mLibexecPath ) = ABISYM( mBuildOutputPath ) + '/' + QGIS_LIBEXEC_SUBDIR + '/';
#endif
}
else
@ -182,7 +182,7 @@ void QgsApplication::init( QString customConfigPath )
if ( !customConfigPath.isEmpty() )
{
ABISYM( mConfigPath ) = customConfigPath + "/"; // make sure trailing slash is included
ABISYM( mConfigPath ) = customConfigPath + '/'; // make sure trailing slash is included
}
ABISYM( mDefaultSvgPaths ) << qgisSettingsDirPath() + QLatin1String( "svg/" );
@ -318,11 +318,11 @@ void QgsApplication::setPrefixPath( const QString &thePrefixPath, bool useDefaul
#endif
if ( useDefaultPaths && !ABISYM( mRunningFromBuildDir ) )
{
setPluginPath( ABISYM( mPrefixPath ) + "/" + QString( QGIS_PLUGIN_SUBDIR ) );
setPkgDataPath( ABISYM( mPrefixPath ) + "/" + QString( QGIS_DATA_SUBDIR ) );
setPluginPath( ABISYM( mPrefixPath ) + '/' + QString( QGIS_PLUGIN_SUBDIR ) );
setPkgDataPath( ABISYM( mPrefixPath ) + '/' + QString( QGIS_DATA_SUBDIR ) );
}
ABISYM( mLibraryPath ) = ABISYM( mPrefixPath ) + "/" + QGIS_LIB_SUBDIR + "/";
ABISYM( mLibexecPath ) = ABISYM( mPrefixPath ) + "/" + QGIS_LIBEXEC_SUBDIR + "/";
ABISYM( mLibraryPath ) = ABISYM( mPrefixPath ) + '/' + QGIS_LIB_SUBDIR + '/';
ABISYM( mLibexecPath ) = ABISYM( mPrefixPath ) + '/' + QGIS_LIBEXEC_SUBDIR + '/';
}
void QgsApplication::setPluginPath( const QString &thePluginPath )
@ -478,9 +478,9 @@ void QgsApplication::setUITheme( const QString &themeName )
{
QString line = in.readLine();
// This is is a variable
if ( line.startsWith( "@" ) )
if ( line.startsWith( '@' ) )
{
int index = line.indexOf( ":" );
int index = line.indexOf( ':' );
QString name = line.mid( 0, index );
QString value = line.mid( index + 1, line.length() );
styledata.replace( name, value );
@ -683,7 +683,7 @@ QStringList QgsApplication::svgPaths()
QString myPaths = settings.value( "svg/searchPathsForSVG", "" ).toString();
if ( !myPaths.isEmpty() )
{
myPathList = myPaths.split( "|" );
myPathList = myPaths.split( '|' );
}
myPathList << ABISYM( mDefaultSvgPaths );
@ -903,14 +903,14 @@ QString QgsApplication::absolutePathToRelativePath( const QString& aPath, const
#if defined( Q_OS_WIN )
const Qt::CaseSensitivity cs = Qt::CaseInsensitive;
aPathUrl.replace( "\\", "/" );
aPathUrl.replace( '\\', '/' );
if ( aPathUrl.startsWith( "//" ) )
{
// keep UNC prefix
aPathUrl = "\\\\" + aPathUrl.mid( 2 );
}
tPathUrl.replace( "\\", "/" );
tPathUrl.replace( '\\', '/' );
if ( tPathUrl.startsWith( "//" ) )
{
// keep UNC prefix
@ -920,8 +920,8 @@ QString QgsApplication::absolutePathToRelativePath( const QString& aPath, const
const Qt::CaseSensitivity cs = Qt::CaseSensitive;
#endif
QStringList targetElems = tPathUrl.split( "/", QString::SkipEmptyParts );
QStringList aPathElems = aPathUrl.split( "/", QString::SkipEmptyParts );
QStringList targetElems = tPathUrl.split( '/', QString::SkipEmptyParts );
QStringList aPathElems = aPathUrl.split( '/', QString::SkipEmptyParts );
targetElems.removeAll( "." );
aPathElems.removeAll( "." );
@ -973,14 +973,14 @@ QString QgsApplication::relativePathToAbsolutePath( const QString& rpath, const
QString targetPathUrl = targetPath;
#if defined(Q_OS_WIN)
rPathUrl.replace( "\\", "/" );
targetPathUrl.replace( "\\", "/" );
rPathUrl.replace( '\\', '/' );
targetPathUrl.replace( '\\', '/' );
bool uncPath = targetPathUrl.startsWith( "//" );
#endif
QStringList srcElems = rPathUrl.split( "/", QString::SkipEmptyParts );
QStringList targetElems = targetPathUrl.split( "/", QString::SkipEmptyParts );
QStringList srcElems = rPathUrl.split( '/', QString::SkipEmptyParts );
QStringList targetElems = targetPathUrl.split( '/', QString::SkipEmptyParts );
#if defined(Q_OS_WIN)
if ( uncPath )

View File

@ -175,10 +175,10 @@ QString QgsAttributeAction::expandAction( QString action, const QgsAttributeMap
QString to_replace;
switch ( i )
{
case 0: to_replace = "[%" + fields[attrIdx].name() + "]"; break;
case 1: to_replace = "[%" + mLayer->attributeDisplayName( attrIdx ) + "]"; break;
case 2: to_replace = "%" + fields[attrIdx].name(); break;
case 3: to_replace = "%" + mLayer->attributeDisplayName( attrIdx ); break;
case 0: to_replace = "[%" + fields[attrIdx].name() + ']'; break;
case 1: to_replace = "[%" + mLayer->attributeDisplayName( attrIdx ) + ']'; break;
case 2: to_replace = '%' + fields[attrIdx].name(); break;
case 3: to_replace = '%' + mLayer->attributeDisplayName( attrIdx ); break;
}
expanded_action = expanded_action.replace( to_replace, it.value().toString() );

View File

@ -305,7 +305,7 @@ QModelIndex QgsBrowserModel::findPath( QAbstractItemModel *model, const QString&
}
// paths are slash separated identifier
if ( path.startsWith( itemPath + "/" ) )
if ( path.startsWith( itemPath + '/' ) )
{
foundChild = true;
theIndex = idx;

View File

@ -213,7 +213,7 @@ bool QgsCoordinateReferenceSystem::createFromOgcWmsCrs( QString theCrs )
QRegExp re( "urn:ogc:def:crs:([^:]+).+([^:]+)", Qt::CaseInsensitive );
if ( re.exactMatch( theCrs ) )
{
theCrs = re.cap( 1 ) + ":" + re.cap( 2 );
theCrs = re.cap( 1 ) + ':' + re.cap( 2 );
}
else
{
@ -357,7 +357,7 @@ bool QgsCoordinateReferenceSystem::loadFromDb( const QString& db, const QString&
QString mySql = "select srs_id,description,projection_acronym,"
"ellipsoid_acronym,parameters,srid,auth_name||':'||auth_id,is_geo "
"from tbl_srs where " + expression + "=" + quotedValue( value ) + " order by deprecated";
"from tbl_srs where " + expression + '=' + quotedValue( value ) + " order by deprecated";
myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(),
mySql.toUtf8().length(),
&myPreparedStatement, &myTail );
@ -1475,19 +1475,19 @@ bool QgsCoordinateReferenceSystem::saveAsUserCRS( const QString& name )
{
mySql = "insert into tbl_srs (srs_id,description,projection_acronym,ellipsoid_acronym,parameters,is_geo) values ("
+ QString::number( USER_CRS_START_ID )
+ "," + quotedValue( name )
+ "," + quotedValue( projectionAcronym() )
+ "," + quotedValue( ellipsoidAcronym() )
+ "," + quotedValue( toProj4() )
+ ',' + quotedValue( name )
+ ',' + quotedValue( projectionAcronym() )
+ ',' + quotedValue( ellipsoidAcronym() )
+ ',' + quotedValue( toProj4() )
+ ",0)"; // <-- is_geo shamelessly hard coded for now
}
else
{
mySql = "insert into tbl_srs (description,projection_acronym,ellipsoid_acronym,parameters,is_geo) values ("
+ quotedValue( name )
+ "," + quotedValue( projectionAcronym() )
+ "," + quotedValue( ellipsoidAcronym() )
+ "," + quotedValue( toProj4() )
+ ',' + quotedValue( projectionAcronym() )
+ ',' + quotedValue( ellipsoidAcronym() )
+ ',' + quotedValue( toProj4() )
+ ",0)"; // <-- is_geo shamelessly hard coded for now
}
sqlite3 *myDatabase;
@ -1566,8 +1566,8 @@ long QgsCoordinateReferenceSystem::getRecordCount()
QString QgsCoordinateReferenceSystem::quotedValue( QString value )
{
value.replace( "'", "''" );
return value.prepend( "'" ).append( "'" );
value.replace( '\'', "''" );
return value.prepend( '\'' ).append( '\'' );
}
// adapted from gdal/ogr/ogr_srs_dict.cpp
@ -1601,7 +1601,7 @@ bool QgsCoordinateReferenceSystem::loadWkts( QHash<int, QString> &wkts, const ch
}
else
{
int pos = line.indexOf( "," );
int pos = line.indexOf( ',' );
if ( pos < 0 )
return false;
@ -1642,7 +1642,7 @@ bool QgsCoordinateReferenceSystem::loadIDs( QHash<int, QString> &wkts )
if ( line.isNull() )
break;
int pos = line.indexOf( "," );
int pos = line.indexOf( ',' );
if ( pos < 0 )
continue;
@ -1840,7 +1840,7 @@ int QgsCoordinateReferenceSystem::syncDb()
Q_FOREACH ( int i, wkts.keys() )
{
sql += delim + QString::number( i );
delim = ",";
delim = ',';
}
sql += ") AND NOT noupdate";
@ -2027,8 +2027,8 @@ bool QgsCoordinateReferenceSystem::syncDatumTransform( const QString& dbPath )
if ( i > 0 )
{
insert += ",";
values += ",";
insert += ',';
values += ',';
if ( last )
{
@ -2036,7 +2036,7 @@ bool QgsCoordinateReferenceSystem::syncDatumTransform( const QString& dbPath )
}
else
{
update += ",";
update += ',';
}
}
@ -2046,7 +2046,7 @@ bool QgsCoordinateReferenceSystem::syncDatumTransform( const QString& dbPath )
values += QString( "%%1" ).arg( i + 1 );
}
insert = "INSERT INTO tbl_datum_transform(" + insert + ") VALUES (" + values + ")";
insert = "INSERT INTO tbl_datum_transform(" + insert + ") VALUES (" + values + ')';
QgsDebugMsgLevel( QString( "insert:%1" ).arg( insert ), 4 );
QgsDebugMsgLevel( QString( "update:%1" ).arg( update ), 4 );
@ -2101,9 +2101,9 @@ bool QgsCoordinateReferenceSystem::syncDatumTransform( const QString& dbPath )
if ( v.at( idxmcode ).compare( QLatin1String( "'9607'" ) ) == 0 )
{
v[ idxmcode ] = "'9606'";
v[ idxrx ] = "'" + qgsDoubleToString( -( v[ idxrx ].remove( "'" ).toDouble() ) ) + "'";
v[ idxry ] = "'" + qgsDoubleToString( -( v[ idxry ].remove( "'" ).toDouble() ) ) + "'";
v[ idxrz ] = "'" + qgsDoubleToString( -( v[ idxrz ].remove( "'" ).toDouble() ) ) + "'";
v[ idxrx ] = '\'' + qgsDoubleToString( -( v[ idxrx ].remove( '\'' ).toDouble() ) ) + '\'';
v[ idxry ] = '\'' + qgsDoubleToString( -( v[ idxry ].remove( '\'' ).toDouble() ) ) + '\'';
v[ idxrz ] = '\'' + qgsDoubleToString( -( v[ idxrz ].remove( '\'' ).toDouble() ) ) + '\'';
}
//entry already in db?

View File

@ -190,7 +190,7 @@ void QgsCoordinateTransform::initialise()
}
if ( mSourceDatumTransform != -1 )
{
sourceProjString += ( " " + datumTransformString( mSourceDatumTransform ) );
sourceProjString += ( ' ' + datumTransformString( mSourceDatumTransform ) );
}
pj_free( mDestinationProjection );
@ -201,7 +201,7 @@ void QgsCoordinateTransform::initialise()
}
if ( mDestinationDatumTransform != -1 )
{
destProjString += ( " " + datumTransformString( mDestinationDatumTransform ) );
destProjString += ( ' ' + datumTransformString( mDestinationDatumTransform ) );
}
if ( !useDefaultDatumTransform )
@ -823,8 +823,8 @@ QList< QList< int > > QgsCoordinateTransform::datumTransformations( const QgsCoo
return transformations;
}
QStringList srcSplit = srcGeoId.split( ":" );
QStringList destSplit = destGeoId.split( ":" );
QStringList srcSplit = srcGeoId.split( ':' );
QStringList destSplit = destGeoId.split( ':' );
if ( srcSplit.size() < 2 || destSplit.size() < 2 )
{
@ -881,7 +881,7 @@ QList< QList< int > > QgsCoordinateTransform::datumTransformations( const QgsCoo
QString QgsCoordinateTransform::stripDatumTransform( const QString& proj4 )
{
QStringList parameterSplit = proj4.split( "+", QString::SkipEmptyParts );
QStringList parameterSplit = proj4.split( '+', QString::SkipEmptyParts );
QString currentParameter;
QString newProjString;
@ -891,9 +891,9 @@ QString QgsCoordinateTransform::stripDatumTransform( const QString& proj4 )
if ( !currentParameter.startsWith( "towgs84", Qt::CaseInsensitive )
&& !currentParameter.startsWith( "nadgrids", Qt::CaseInsensitive ) )
{
newProjString.append( "+" );
newProjString.append( '+' );
newProjString.append( currentParameter );
newProjString.append( " " );
newProjString.append( ' ' );
}
}
return newProjString;

View File

@ -42,7 +42,7 @@ const QString QgsDartMeasurement::toString() const
void QgsDartMeasurement::send() const
{
qDebug() << toString() + "\n";
qDebug() << toString() + '\n';
}
const QString QgsDartMeasurement::typeToString( QgsDartMeasurement::Type type )

View File

@ -306,7 +306,7 @@ QIcon QgsDataItem::icon()
if ( !mIconMap.contains( mIconName ) )
{
mIconMap.insert( mIconName, mIconName.startsWith( ":" ) ? QIcon( mIconName ) : QgsApplication::getThemeIcon( mIconName ) );
mIconMap.insert( mIconName, mIconName.startsWith( ':' ) ? QIcon( mIconName ) : QgsApplication::getThemeIcon( mIconName ) );
}
return mIconMap.value( mIconName );
@ -790,7 +790,7 @@ QVector<QgsDataItem*> QgsDirectoryItem::createChildren()
QString subdirPath = dir.absoluteFilePath( subdir );
QgsDebugMsgLevel( QString( "creating subdir: %1" ).arg( subdirPath ), 2 );
QString path = mPath + "/" + subdir; // may differ from subdirPath
QString path = mPath + '/' + subdir; // may differ from subdirPath
QgsDirectoryItem *item = new QgsDirectoryItem( this, subdir, subdirPath, path );
// propagate signals up to top
@ -812,7 +812,7 @@ QVector<QgsDataItem*> QgsDirectoryItem::createChildren()
// vsizip support was added to GDAL/OGR 1.6 but GDAL_VERSION_NUM not available here
// so we assume it's available anyway
{
QgsDataItem * item = QgsZipItem::itemFromPath( this, path, name, mPath + "/" + name );
QgsDataItem * item = QgsZipItem::itemFromPath( this, path, name, mPath + '/' + name );
if ( item )
{
children.append( item );
@ -1088,7 +1088,7 @@ QVector<QgsDataItem*> QgsFavouritesItem::createChildren()
Q_FOREACH ( const QString& favDir, favDirs )
{
QString pathName = pathComponent( favDir );
QgsDataItem *item = new QgsDirectoryItem( this, favDir, favDir, mPath + "/" + pathName );
QgsDataItem *item = new QgsDirectoryItem( this, favDir, favDir, mPath + '/' + pathName );
if ( item )
{
children.append( item );
@ -1108,7 +1108,7 @@ void QgsFavouritesItem::addDirectory( const QString& favDir )
if ( state() == Populated )
{
QString pathName = pathComponent( favDir );
addChildItem( new QgsDirectoryItem( this, favDir, favDir, mPath + "/" + pathName ), true );
addChildItem( new QgsDirectoryItem( this, favDir, favDir, mPath + '/' + pathName ), true );
}
}
@ -1308,7 +1308,7 @@ QVector<QgsDataItem*> QgsZipItem::createChildren()
Q_FOREACH ( const QString& fileName, mZipFileList )
{
QFileInfo info( fileName );
tmpPath = mVsiPrefix + mFilePath + "/" + fileName;
tmpPath = mVsiPrefix + mFilePath + '/' + fileName;
QgsDebugMsgLevel( "tmpPath = " + tmpPath, 3 );
// Q_FOREACH( dataItem_t *dataItem, mDataItemPtr )

View File

@ -252,8 +252,8 @@ QString QgsDataSourceURI::removePassword( const QString& aUri )
}
else if ( aUri.contains( "SDE:" ) )
{
QStringList strlist = aUri.split( "," );
safeName = strlist[0] + "," + strlist[1] + "," + strlist[2] + "," + strlist[3];
QStringList strlist = aUri.split( ',' );
safeName = strlist[0] + ',' + strlist[1] + ',' + strlist[2] + ',' + strlist[3];
}
return safeName;
}
@ -378,7 +378,7 @@ QString QgsDataSourceURI::escape( const QString &theVal, QChar delim = '\'' ) co
{
QString val = theVal;
val.replace( "\\", "\\\\" );
val.replace( '\\', "\\\\" );
val.replace( delim, QString( "\\%1" ).arg( delim ) );
return val;
@ -464,12 +464,12 @@ QString QgsDataSourceURI::connectionInfo( bool expandAuthConfig ) const
if ( mDatabase != "" )
{
connectionItems << "dbname='" + escape( mDatabase ) + "'";
connectionItems << "dbname='" + escape( mDatabase ) + '\'';
}
if ( mService != "" )
{
connectionItems << "service='" + escape( mService ) + "'";
connectionItems << "service='" + escape( mService ) + '\'';
}
else if ( mHost != "" )
{
@ -484,11 +484,11 @@ QString QgsDataSourceURI::connectionInfo( bool expandAuthConfig ) const
if ( mUsername != "" )
{
connectionItems << "user='" + escape( mUsername ) + "'";
connectionItems << "user='" + escape( mUsername ) + '\'';
if ( mPassword != "" )
{
connectionItems << "password='" + escape( mPassword ) + "'";
connectionItems << "password='" + escape( mPassword ) + '\'';
}
}
@ -553,18 +553,18 @@ QString QgsDataSourceURI::uri( bool expandAuthConfig ) const
for ( QMap<QString, QString>::const_iterator it = mParams.begin(); it != mParams.end(); ++it )
{
if ( it.key().contains( "=" ) || it.key().contains( " " ) )
if ( it.key().contains( '=' ) || it.key().contains( ' ' ) )
{
QgsDebugMsg( QString( "invalid uri parameter %1 skipped" ).arg( it.key() ) );
continue;
}
theUri += " " + it.key() + "='" + escape( it.value() ) + "'";
theUri += ' ' + it.key() + "='" + escape( it.value() ) + '\'';
}
QString columnName( mGeometryColumn );
columnName.replace( "\\", "\\\\" );
columnName.replace( ")", "\\)" );
columnName.replace( '\\', "\\\\" );
columnName.replace( ')', "\\)" );
theUri += QString( " table=%1%2 sql=%3" )
.arg( quotedTablename(),

View File

@ -182,7 +182,7 @@ void QgsDiagramSettings::readXML( const QDomElement& elem, const QgsVectorLayer*
{
// Restore old format attributes and colors
QStringList colorList = elem.attribute( "colors" ).split( "/" );
QStringList colorList = elem.attribute( "colors" ).split( '/' );
QStringList::const_iterator colorIt = colorList.constBegin();
for ( ; colorIt != colorList.constEnd(); ++colorIt )
{
@ -193,7 +193,7 @@ void QgsDiagramSettings::readXML( const QDomElement& elem, const QgsVectorLayer*
//attribute indices
categoryAttributes.clear();
QStringList catList = elem.attribute( "categories" ).split( "/" );
QStringList catList = elem.attribute( "categories" ).split( '/' );
QStringList::const_iterator catIt = catList.constBegin();
for ( ; catIt != catList.constEnd(); ++catIt )
{

View File

@ -141,7 +141,7 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid )
// Distances in meters. Flattening is calculated.
if ( ellipsoid.startsWith( "PARAMETER" ) )
{
QStringList paramList = ellipsoid.split( ":" );
QStringList paramList = ellipsoid.split( ':' );
bool semiMajorOk, semiMinorOk;
double semiMajor = paramList[1].toDouble( & semiMajorOk );
double semiMinor = paramList[2].toDouble( & semiMinorOk );
@ -167,7 +167,7 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid )
return false;
}
// Set up the query to retrieve the projection information needed to populate the ELLIPSOID list
QString mySql = "select radius, parameter2 from tbl_ellipsoid where acronym='" + ellipsoid + "'";
QString mySql = "select radius, parameter2 from tbl_ellipsoid where acronym='" + ellipsoid + '\'';
myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(), mySql.toUtf8().length(), &myPreparedStatement, &myTail );
// XXX Need to free memory from the error msg if one is set
if ( myResult == SQLITE_OK )

View File

@ -80,11 +80,11 @@ QString QgsError::message( QgsErrorMessage::Format theFormat ) const
{
if ( !str.isEmpty() )
{
str += "\n"; // new message
str += '\n'; // new message
}
if ( !m.tag().isEmpty() )
{
str += m.tag() + " ";
str += m.tag() + ' ';
}
str += m.message();
#ifdef QGISDEBUG

View File

@ -72,13 +72,13 @@ QgsExpression::Interval QgsExpression::Interval::fromString( const QString& stri
}
QMap<int, QStringList> map;
map.insert( 1, QStringList() << "second" << "seconds" << tr( "second|seconds", "list of words separated by | which reference years" ).split( "|" ) );
map.insert( 0 + MINUTE, QStringList() << "minute" << "minutes" << tr( "minute|minutes", "list of words separated by | which reference minutes" ).split( "|" ) );
map.insert( 0 + HOUR, QStringList() << "hour" << "hours" << tr( "hour|hours", "list of words separated by | which reference minutes hours" ).split( "|" ) );
map.insert( 0 + DAY, QStringList() << "day" << "days" << tr( "day|days", "list of words separated by | which reference days" ).split( "|" ) );
map.insert( 0 + WEEKS, QStringList() << "week" << "weeks" << tr( "week|weeks", "wordlist separated by | which reference weeks" ).split( "|" ) );
map.insert( 0 + MONTHS, QStringList() << "month" << "months" << tr( "month|months", "list of words separated by | which reference months" ).split( "|" ) );
map.insert( 0 + YEARS, QStringList() << "year" << "years" << tr( "year|years", "list of words separated by | which reference years" ).split( "|" ) );
map.insert( 1, QStringList() << "second" << "seconds" << tr( "second|seconds", "list of words separated by | which reference years" ).split( '|' ) );
map.insert( 0 + MINUTE, QStringList() << "minute" << "minutes" << tr( "minute|minutes", "list of words separated by | which reference minutes" ).split( '|' ) );
map.insert( 0 + HOUR, QStringList() << "hour" << "hours" << tr( "hour|hours", "list of words separated by | which reference minutes hours" ).split( '|' ) );
map.insert( 0 + DAY, QStringList() << "day" << "days" << tr( "day|days", "list of words separated by | which reference days" ).split( '|' ) );
map.insert( 0 + WEEKS, QStringList() << "week" << "weeks" << tr( "week|weeks", "wordlist separated by | which reference weeks" ).split( '|' ) );
map.insert( 0 + MONTHS, QStringList() << "month" << "months" << tr( "month|months", "list of words separated by | which reference months" ).split( '|' ) );
map.insert( 0 + YEARS, QStringList() << "year" << "years" << tr( "year|years", "list of words separated by | which reference years" ).split( '|' ) );
Q_FOREACH ( const QString& match, list )
{
@ -667,7 +667,7 @@ static QVariant fcnUpper( const QVariantList& values, const QgsExpressionContext
static QVariant fcnTitle( const QVariantList& values, const QgsExpressionContext*, QgsExpression* parent )
{
QString str = getStringValue( values.at( 0 ), parent );
QStringList elems = str.split( " " );
QStringList elems = str.split( ' ' );
for ( int i = 0; i < elems.size(); i++ )
{
if ( elems[i].size() > 1 )
@ -722,10 +722,10 @@ static QVariant fcnWordwrap( const QVariantList& values, const QgsExpressionCont
QString newstr;
QString delimiterstr;
if ( values.length() == 3 ) delimiterstr = getStringValue( values.at( 2 ), parent );
if ( delimiterstr.isEmpty() ) delimiterstr = " ";
if ( delimiterstr.isEmpty() ) delimiterstr = ' ';
int delimiterlength = delimiterstr.length();
QStringList lines = str.split( "\n" );
QStringList lines = str.split( '\n' );
int strlength, strcurrent, strhit, lasthit;
for ( int i = 0; i < lines.size(); i++ )
@ -757,7 +757,7 @@ static QVariant fcnWordwrap( const QVariantList& values, const QgsExpressionCont
if ( strhit > -1 )
{
newstr.append( lines[i].midRef( strcurrent, strhit - strcurrent ) );
newstr.append( "\n" );
newstr.append( '\n' );
strcurrent = strhit + delimiterlength;
}
else
@ -766,7 +766,7 @@ static QVariant fcnWordwrap( const QVariantList& values, const QgsExpressionCont
strcurrent = strlength;
}
}
if ( i < lines.size() - 1 ) newstr.append( "\n" );
if ( i < lines.size() - 1 ) newstr.append( '\n' );
}
return QVariant( newstr );
@ -2444,12 +2444,12 @@ QList<QgsExpression::Function*> QgsExpression::specialColumns()
QString QgsExpression::quotedColumnRef( QString name )
{
return QString( "\"%1\"" ).arg( name.replace( "\"", "\"\"" ) );
return QString( "\"%1\"" ).arg( name.replace( '\"', "\"\"" ) );
}
QString QgsExpression::quotedString( QString text )
{
text.replace( "'", "''" );
text.replace( '\'', "''" );
text.replace( '\\', "\\\\" );
text.replace( '\n', "\\n" );
text.replace( '\t', "\\t" );
@ -2977,8 +2977,8 @@ QVariant QgsExpression::NodeBinaryOperator::eval( QgsExpression *parent, const Q
{
QString esc_regexp = QRegExp::escape( regexp );
// XXX escape % and _ ???
esc_regexp.replace( "%", ".*" );
esc_regexp.replace( "_", "." );
esc_regexp.replace( '%', ".*" );
esc_regexp.replace( '_', '.' );
matches = QRegExp( esc_regexp, mOp == boLike || mOp == boNotLike ? Qt::CaseSensitive : Qt::CaseInsensitive ).exactMatch( str );
}
else
@ -3359,7 +3359,7 @@ QVariant QgsExpression::NodeColumnRef::eval( QgsExpression *parent, const QgsExp
else
return feature.attribute( mName );
}
return QVariant( "[" + mName + "]" );
return QVariant( '[' + mName + ']' );
}
bool QgsExpression::NodeColumnRef::prepare( QgsExpression *parent, const QgsExpressionContext *context )
@ -3526,7 +3526,7 @@ QString QgsExpression::helptext( QString name )
if ( f.mType == tr( "function" ) && ( f.mName[0] != '$' || v.mArguments.size() > 0 || v.mVariableLenArguments ) )
{
helpContents += "(";
helpContents += '(';
QString delim;
Q_FOREACH ( const HelpArg &a, v.mArguments )
@ -3542,7 +3542,7 @@ QString QgsExpression::helptext( QString name )
helpContents += "...";
}
helpContents += ")";
helpContents += ')';
}
helpContents += "</code>";

View File

@ -147,7 +147,7 @@ QStringList QgsExpressionContextScope::filteredVariableNames() const
QStringList filtered;
Q_FOREACH ( const QString& variable, allVariables )
{
if ( variable.startsWith( "_" ) )
if ( variable.startsWith( '_' ) )
continue;
filtered << variable;
@ -317,7 +317,7 @@ QStringList QgsExpressionContext::filteredVariableNames() const
QStringList filtered;
Q_FOREACH ( const QString& variable, allVariables )
{
if ( variable.startsWith( "_" ) )
if ( variable.startsWith( '_' ) )
continue;
filtered << variable;

View File

@ -375,7 +375,7 @@ static QMap<QString, QString> createTranslatedStyleMap()
QString QgsFontUtils::translateNamedStyle( const QString& namedStyle )
{
QStringList words = namedStyle.split( " ", QString::SkipEmptyParts );
QStringList words = namedStyle.split( ' ', QString::SkipEmptyParts );
for ( int i = 0, n = words.length(); i < n; ++i )
{
words[i] = QCoreApplication::translate( "QFontDatabase", words[i].toUtf8(), 0, QCoreApplication::UnicodeUTF8 );
@ -386,7 +386,7 @@ QString QgsFontUtils::translateNamedStyle( const QString& namedStyle )
QString QgsFontUtils::untranslateNamedStyle( const QString& namedStyle )
{
static QMap<QString, QString> translatedStyleMap = createTranslatedStyleMap();
QStringList words = namedStyle.split( " ", QString::SkipEmptyParts );
QStringList words = namedStyle.split( ' ', QString::SkipEmptyParts );
for ( int i = 0, n = words.length(); i < n; ++i )
{
if ( translatedStyleMap.contains( words[i] ) )

View File

@ -59,7 +59,7 @@ QgsGml::QgsGml(
mEndian = QgsApplication::endian();
int index = mTypeName.indexOf( ":" );
int index = mTypeName.indexOf( ':' );
if ( index != -1 && index < mTypeName.length() )
{
mTypeName = mTypeName.mid( index + 1 );
@ -234,12 +234,12 @@ void QgsGml::startElement( const XML_Char* el, const XML_Char** attr )
mCoordinateSeparator = readAttribute( "cs", attr );
if ( mCoordinateSeparator.isEmpty() )
{
mCoordinateSeparator = ",";
mCoordinateSeparator = ',';
}
mTupleSeparator = readAttribute( "ts", attr );
if ( mTupleSeparator.isEmpty() )
{
mTupleSeparator = " ";
mTupleSeparator = ' ';
}
}
if ( elementName == GML_NAMESPACE + NS_SEPARATOR + "pos"
@ -601,11 +601,11 @@ int QgsGml::readEpsgFromAttribute( int& epsgNr, const XML_Char** attr ) const
QString epsgNrString;
if ( epsgString.startsWith( "http" ) ) //e.g. geoserver: "http://www.opengis.net/gml/srs/epsg.xml#4326"
{
epsgNrString = epsgString.section( "#", 1, 1 );
epsgNrString = epsgString.section( '#', 1, 1 );
}
else //e.g. umn mapserver: "EPSG:4326">
{
epsgNrString = epsgString.section( ":", 1, 1 );
epsgNrString = epsgString.section( ':', 1, 1 );
}
bool conversionOk;
int eNr = epsgNrString.toInt( &conversionOk );
@ -687,7 +687,7 @@ int QgsGml::pointsFromCoordinateString( QList<QgsPoint>& points, const QString&
int QgsGml::pointsFromPosListString( QList<QgsPoint>& points, const QString& coordString, int dimension ) const
{
// coordinates separated by spaces
QStringList coordinates = coordString.split( " ", QString::SkipEmptyParts );
QStringList coordinates = coordString.split( ' ', QString::SkipEmptyParts );
if ( coordinates.size() % dimension != 0 )
{

View File

@ -271,14 +271,14 @@ QString QgsGmlSchema::xsdComplexTypeGmlBaseType( const QDomElement &element, con
QString QgsGmlSchema::stripNS( const QString & name )
{
return name.contains( ":" ) ? name.section( ':', 1 ) : name;
return name.contains( ':' ) ? name.section( ':', 1 ) : name;
}
QList<QDomElement> QgsGmlSchema::domElements( const QDomElement &element, const QString & path )
{
QList<QDomElement> list;
QStringList names = path.split( "." );
QStringList names = path.split( '.' );
if ( names.size() == 0 ) return list;
QString name = names.value( 0 );
names.removeFirst();

View File

@ -97,7 +97,7 @@ bool QgsHttpTransaction::getSynchronously( QByteArray &respondedContent, int red
QgsDebugMsg( "Entered." );
QgsDebugMsg( "Using '" + httpurl + "'." );
QgsDebugMsg( "Creds: " + mUserName + "/" + mPassword );
QgsDebugMsg( "Creds: " + mUserName + '/' + mPassword );
int httpport;
@ -196,7 +196,7 @@ bool QgsHttpTransaction::getSynchronously( QByteArray &respondedContent, int red
mWatchdogTimer->setSingleShot( true );
mWatchdogTimer->start( mNetworkTimeoutMsec );
QgsDebugMsg( "Starting get with id " + QString::number( httpid ) + "." );
QgsDebugMsg( "Starting get with id " + QString::number( httpid ) + '.' );
QgsDebugMsg( "Setting httpactive = true" );
httpactive = true;
@ -261,7 +261,7 @@ QString QgsHttpTransaction::responseContentType()
void QgsHttpTransaction::dataStarted( int id )
{
Q_UNUSED( id );
QgsDebugMsg( "ID=" + QString::number( id ) + "." );
QgsDebugMsg( "ID=" + QString::number( id ) + '.' );
}
@ -343,7 +343,7 @@ void QgsHttpTransaction::dataProgress( int done, int total )
void QgsHttpTransaction::dataFinished( int id, bool error )
{
#ifdef QGISDEBUG
QgsDebugMsg( "ID=" + QString::number( id ) + "." );
QgsDebugMsg( "ID=" + QString::number( id ) + '.' );
// The signal that this slot is connected to, QHttp::requestFinished,
// appears to get called at the destruction of the QHttp if it is
@ -436,7 +436,7 @@ void QgsHttpTransaction::transactionFinished( bool error )
void QgsHttpTransaction::dataStateChanged( int state )
{
QgsDebugMsg( "state " + QString::number( state ) + "." );
QgsDebugMsg( "state " + QString::number( state ) + '.' );
// We saw something come back, therefore restart the watchdog timer
mWatchdogTimer->start( mNetworkTimeoutMsec );
@ -519,7 +519,7 @@ bool QgsHttpTransaction::applyProxySettings( QHttp& http, const QString& url )
QString proxyExcludedURLs = settings.value( "proxy/proxyExcludedUrls", "" ).toString();
if ( !proxyExcludedURLs.isEmpty() )
{
QStringList excludedURLs = proxyExcludedURLs.split( "|" );
QStringList excludedURLs = proxyExcludedURLs.split( '|' );
QStringList::const_iterator exclIt = excludedURLs.constBegin();
for ( ; exclIt != excludedURLs.constEnd(); ++exclIt )
{

View File

@ -228,7 +228,7 @@ void QgsLabel::renderLabel( QgsRenderContext &renderContext,
if ( mLabelAttributes->multilineEnabled() )
{
QStringList texts = text.split( "\n" );
QStringList texts = text.split( '\n' );
width = 0;
for ( int i = 0; i < texts.size(); i++ )

View File

@ -63,9 +63,9 @@ QgsMapLayer::QgsMapLayer( QgsMapLayer::LayerType type,
mCRS = new QgsCoordinateReferenceSystem();
// Set the display name = internal name
QgsDebugMsg( "original name: '" + mLayerOrigName + "'" );
QgsDebugMsg( "original name: '" + mLayerOrigName + '\'' );
mLayerName = capitaliseLayerName( mLayerOrigName );
QgsDebugMsg( "display name: '" + mLayerName + "'" );
QgsDebugMsg( "display name: '" + mLayerName + '\'' );
// Generate the unique ID of this layer
QDateTime dt = QDateTime::currentDateTime();
@ -105,9 +105,9 @@ QString QgsMapLayer::id() const
/** Write property of QString layerName. */
void QgsMapLayer::setLayerName( const QString & name )
{
QgsDebugMsg( "new original name: '" + name + "'" );
QgsDebugMsg( "new original name: '" + name + '\'' );
QString newName = capitaliseLayerName( name );
QgsDebugMsg( "new display name: '" + name + "'" );
QgsDebugMsg( "new display name: '" + name + '\'' );
if ( name == mLayerOrigName && newName == mLayerName ) return;
mLayerOrigName = name; // store the new original name
mLayerName = newName;
@ -117,7 +117,7 @@ void QgsMapLayer::setLayerName( const QString & name )
/** Read property of QString layerName. */
QString QgsMapLayer::name() const
{
QgsDebugMsgLevel( "returning name '" + mLayerName + "'", 4 );
QgsDebugMsgLevel( "returning name '" + mLayerName + '\'', 4 );
return mLayerName;
}
@ -201,13 +201,13 @@ bool QgsMapLayer::readLayerXML( const QDomElement& layerElement )
}
else if ( provider == "ogr" )
{
QStringList theURIParts = mDataSource.split( "|" );
QStringList theURIParts = mDataSource.split( '|' );
theURIParts[0] = QgsProject::instance()->readPath( theURIParts[0] );
mDataSource = theURIParts.join( "|" );
}
else if ( provider == "gpx" )
{
QStringList theURIParts = mDataSource.split( "?" );
QStringList theURIParts = mDataSource.split( '?' );
theURIParts[0] = QgsProject::instance()->readPath( theURIParts[0] );
mDataSource = theURIParts.join( "?" );
}
@ -217,7 +217,7 @@ bool QgsMapLayer::readLayerXML( const QDomElement& layerElement )
if ( !mDataSource.startsWith( "file:" ) )
{
QUrl file = QUrl::fromLocalFile( mDataSource.left( mDataSource.indexOf( "?" ) ) );
QUrl file = QUrl::fromLocalFile( mDataSource.left( mDataSource.indexOf( '?' ) ) );
urlSource.setScheme( "file" );
urlSource.setPath( file.path() );
}
@ -245,7 +245,7 @@ bool QgsMapLayer::readLayerXML( const QDomElement& layerElement )
QgsDataSourceURI uri;
if ( !mDataSource.startsWith( "http:" ) )
{
QStringList parts = mDataSource.split( "," );
QStringList parts = mDataSource.split( ',' );
QStringListIterator iter( parts );
while ( iter.hasNext() )
{
@ -264,7 +264,7 @@ bool QgsMapLayer::readLayerXML( const QDomElement& layerElement )
// tiled=width;height - non tiled mode, specifies max width and max height
// tiled=width;height;resolutions-1;resolution2;... - tile mode
QStringList params = item.mid( 6 ).split( ";" );
QStringList params = item.mid( 6 ).split( ';' );
if ( params.size() == 2 ) // non tiled mode
{
@ -288,7 +288,7 @@ bool QgsMapLayer::readLayerXML( const QDomElement& layerElement )
}
else if ( item.startsWith( "ignoreUrl=" ) )
{
uri.setParam( "ignoreUrl", item.mid( 10 ).split( ";" ) );
uri.setParam( "ignoreUrl", item.mid( 10 ).split( ';' ) );
}
}
}
@ -357,7 +357,7 @@ bool QgsMapLayer::readLayerXML( const QDomElement& layerElement )
QRegExp r( "([^:]+):([^:]+):(.+)" );
if ( r.exactMatch( mDataSource ) )
{
mDataSource = r.cap( 1 ) + ":" + r.cap( 2 ) + ":" + QgsProject::instance()->readPath( r.cap( 3 ) );
mDataSource = r.cap( 1 ) + ':' + r.cap( 2 ) + ':' + QgsProject::instance()->readPath( r.cap( 3 ) );
handled = true;
}
}
@ -542,13 +542,13 @@ bool QgsMapLayer::writeLayerXML( QDomElement& layerElement, QDomDocument& docume
}
else if ( vlayer && vlayer->providerType() == "ogr" )
{
QStringList theURIParts = src.split( "|" );
QStringList theURIParts = src.split( '|' );
theURIParts[0] = QgsProject::instance()->writePath( theURIParts[0], relativeBasePath );
src = theURIParts.join( "|" );
}
else if ( vlayer && vlayer->providerType() == "gpx" )
{
QStringList theURIParts = src.split( "?" );
QStringList theURIParts = src.split( '?' );
theURIParts[0] = QgsProject::instance()->writePath( theURIParts[0], relativeBasePath );
src = theURIParts.join( "?" );
}
@ -618,7 +618,7 @@ bool QgsMapLayer::writeLayerXML( QDomElement& layerElement, QDomDocument& docume
QRegExp r( "([^:]+):([^:]+):(.+)" );
if ( r.exactMatch( src ) )
{
src = r.cap( 1 ) + ":" + r.cap( 2 ) + ":" + QgsProject::instance()->writePath( r.cap( 3 ), relativeBasePath );
src = r.cap( 1 ) + ':' + r.cap( 2 ) + ':' + QgsProject::instance()->writePath( r.cap( 3 ), relativeBasePath );
handled = true;
}
}
@ -655,7 +655,7 @@ bool QgsMapLayer::writeLayerXML( QDomElement& layerElement, QDomDocument& docume
layerElement.appendChild( layerAbstract );
// layer keyword list
QStringList keywordStringList = keywordList().split( "," );
QStringList keywordStringList = keywordList().split( ',' );
if ( keywordStringList.size() > 0 )
{
QDomElement layerKeywordList = document.createElement( "keywordList" );
@ -1242,12 +1242,12 @@ QString QgsMapLayer::saveNamedStyle( const QString &theURI, bool &theResultFlag
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( this );
if ( vlayer && vlayer->providerType() == "ogr" )
{
QStringList theURIParts = theURI.split( "|" );
QStringList theURIParts = theURI.split( '|' );
filename = theURIParts[0];
}
else if ( vlayer && vlayer->providerType() == "gpx" )
{
QStringList theURIParts = theURI.split( "?" );
QStringList theURIParts = theURI.split( '?' );
filename = theURIParts[0];
}
else if ( vlayer && vlayer->providerType() == "delimitedtext" )
@ -1426,12 +1426,12 @@ QString QgsMapLayer::saveSldStyle( const QString &theURI, bool &theResultFlag )
QString filename;
if ( vlayer->providerType() == "ogr" )
{
QStringList theURIParts = theURI.split( "|" );
QStringList theURIParts = theURI.split( '|' );
filename = theURIParts[0];
}
else if ( vlayer->providerType() == "gpx" )
{
QStringList theURIParts = theURI.split( "?" );
QStringList theURIParts = theURI.split( '?' );
filename = theURIParts[0];
}
else if ( vlayer->providerType() == "delimitedtext" )

View File

@ -98,7 +98,7 @@ QList<int> QgsMapLayerLegendUtils::legendNodeOrder( QgsLayerTreeLayer* nodeLayer
int numNodes = _originalLegendNodeCount( nodeLayer );
QList<int> lst;
Q_FOREACH ( const QString& item, orderStr.split( "," ) )
Q_FOREACH ( const QString& item, orderStr.split( ',' ) )
{
bool ok;
int id = item.toInt( &ok );

View File

@ -454,7 +454,7 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale )
mRenderContext.painter()->device()->height(), QImage::Format_ARGB32 );
if ( mypFlattenedImage->isNull() )
{
QgsDebugMsg( "insufficient memory for image " + QString::number( mRenderContext.painter()->device()->width() ) + "x" + QString::number( mRenderContext.painter()->device()->height() ) );
QgsDebugMsg( "insufficient memory for image " + QString::number( mRenderContext.painter()->device()->width() ) + 'x' + QString::number( mRenderContext.painter()->device()->height() ) );
emit drawError( ml );
painter->end(); // drawError is not caught by anyone, so we end painting to notify caller
return;

View File

@ -288,9 +288,9 @@ QString QgsMapToPixel::showParameters() const
{
QString rep;
QTextStream( &rep ) << "Map units/pixel: " << mMapUnitsPerPixel
<< " center: " << xCenter << "," << yCenter
<< " center: " << xCenter << ',' << yCenter
<< " rotation: " << mRotation
<< " size: " << mWidth << "x" << mHeight;
<< " size: " << mWidth << 'x' << mHeight;
return rep;
}

View File

@ -120,9 +120,9 @@ QString QgsMimeDataUtils::encode( const QStringList& items )
Q_FOREACH ( const QString& item, items )
{
QString str = item;
str.replace( "\\", "\\\\" );
str.replace( ":", "\\:" );
encoded += str + ":";
str.replace( '\\', "\\\\" );
str.replace( ':', "\\:" );
encoded += str + ':';
}
return encoded.left( encoded.length() - 1 );
}

View File

@ -165,7 +165,7 @@ QNetworkReply *QgsNetworkAccessManager::createRequest( QNetworkAccessManager::Op
QString userAgent = s.value( "/qgis/networkAndProxy/userAgent", "Mozilla/5.0" ).toString();
if ( !userAgent.isEmpty() )
userAgent += " ";
userAgent += ' ';
userAgent += QString( "QGIS/%1" ).arg( QGis::QGIS_VERSION );
pReq->setRawHeader( "User-Agent", userAgent.toUtf8() );
@ -306,7 +306,7 @@ void QgsNetworkAccessManager::setupDefaultProxyAndCache()
bool proxyEnabled = settings.value( "proxy/proxyEnabled", false ).toBool();
if ( proxyEnabled )
{
excludes = settings.value( "proxy/proxyExcludedUrls", "" ).toString().split( "|", QString::SkipEmptyParts );
excludes = settings.value( "proxy/proxyExcludedUrls", "" ).toString().split( '|', QString::SkipEmptyParts );
//read type, host, port, user, passw from settings
QString proxyHost = settings.value( "proxy/proxyHost", "" ).toString();

View File

@ -109,7 +109,7 @@ bool QgsOfflineEditing::convertToOfflineProject( const QString& offlineDataPath,
QgsVectorLayer* vl = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer(( *it ).joinLayerId ) );
if ( vl )
( *it ).prefix = vl->name() + "_";
( *it ).prefix = vl->name() + '_';
}
++it;
}
@ -334,10 +334,10 @@ void QgsOfflineEditing::initializeSpatialMetadata( sqlite3 *sqlite_handle )
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 ) );
}
}
@ -488,9 +488,9 @@ QgsVectorLayer* QgsOfflineEditing::copyVectorLayer( QgsVectorLayer* layer, sqlit
}
sql += delim + QString( "'%1' %2" ).arg( fields[idx].name(), dataType );
delim = ",";
delim = ',';
}
sql += ")";
sql += ')';
int rc = sqlExec( db, sql );

View File

@ -874,7 +874,7 @@ bool QgsOgcUtils::readGMLPositions( QgsPolyline &coords, const QDomElement &elem
coords.clear();
QStringList pos = elem.text().split( " ", QString::SkipEmptyParts );
QStringList pos = elem.text().split( ' ', QString::SkipEmptyParts );
double x, y;
bool conversionSuccess;
int posSize = pos.size();
@ -953,10 +953,10 @@ QgsRectangle QgsOgcUtils::rectangleFromGMLEnvelope( const QDomNode& envelopeNode
}
QString bString = elem.text();
double xmin = bString.section( " ", 0, 0 ).toDouble( &conversionSuccess );
double xmin = bString.section( ' ', 0, 0 ).toDouble( &conversionSuccess );
if ( !conversionSuccess )
return rect;
double ymin = bString.section( " ", 1, 1 ).toDouble( &conversionSuccess );
double ymin = bString.section( ' ', 1, 1 ).toDouble( &conversionSuccess );
if ( !conversionSuccess )
return rect;
@ -981,10 +981,10 @@ QgsRectangle QgsOgcUtils::rectangleFromGMLEnvelope( const QDomNode& envelopeNode
Q_UNUSED( srsDimension );
bString = elem.text();
double xmax = bString.section( " ", 0, 0 ).toDouble( &conversionSuccess );
double xmax = bString.section( ' ', 0, 0 ).toDouble( &conversionSuccess );
if ( !conversionSuccess )
return rect;
double ymax = bString.section( " ", 1, 1 ).toDouble( &conversionSuccess );
double ymax = bString.section( ' ', 1, 1 ).toDouble( &conversionSuccess );
if ( !conversionSuccess )
return rect;
@ -1008,11 +1008,11 @@ QDomElement QgsOgcUtils::rectangleToGMLBox( QgsRectangle* box, QDomDocument& doc
QString coordString;
coordString += qgsDoubleToString( box->xMinimum(), precision );
coordString += ",";
coordString += ',';
coordString += qgsDoubleToString( box->yMinimum(), precision );
coordString += " ";
coordString += ' ';
coordString += qgsDoubleToString( box->xMaximum(), precision );
coordString += ",";
coordString += ',';
coordString += qgsDoubleToString( box->yMaximum(), precision );
QDomText coordText = doc.createTextNode( coordString );
@ -1034,7 +1034,7 @@ QDomElement QgsOgcUtils::rectangleToGMLEnvelope( QgsRectangle* env, QDomDocument
QDomElement lowerCornerElem = doc.createElement( "gml:lowerCorner" );
posList = qgsDoubleToString( env->xMinimum(), precision );
posList += " ";
posList += ' ';
posList += qgsDoubleToString( env->yMinimum(), precision );
QDomText lowerCornerText = doc.createTextNode( posList );
lowerCornerElem.appendChild( lowerCornerText );
@ -1042,7 +1042,7 @@ QDomElement QgsOgcUtils::rectangleToGMLEnvelope( QgsRectangle* env, QDomDocument
QDomElement upperCornerElem = doc.createElement( "gml:upperCorner" );
posList = qgsDoubleToString( env->xMaximum(), precision );
posList += " ";
posList += ' ';
posList += qgsDoubleToString( env->yMaximum(), precision );
QDomText upperCornerText = doc.createTextNode( posList );
upperCornerElem.appendChild( upperCornerText );
@ -1082,7 +1082,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry* geometry, QDomDocumen
break;
}
baseCoordElem.setAttribute( "srsDimension", "2" );
cs = " ";
cs = ' ';
}
else
{
@ -1362,10 +1362,10 @@ QDomElement QgsOgcUtils::createGMLCoordinates( const QgsPolyline &points, QDomDo
{
if ( pointIt != points.constBegin() )
{
coordString += " ";
coordString += ' ';
}
coordString += qgsDoubleToString( pointIt->x() );
coordString += ",";
coordString += ',';
coordString += qgsDoubleToString( pointIt->y() );
}
@ -1387,10 +1387,10 @@ QDomElement QgsOgcUtils::createGMLPositions( const QgsPolyline &points, QDomDocu
{
if ( pointIt != points.constBegin() )
{
coordString += " ";
coordString += ' ';
}
coordString += qgsDoubleToString( pointIt->x() );
coordString += " ";
coordString += ' ';
coordString += qgsDoubleToString( pointIt->y() );
}
@ -1658,7 +1658,7 @@ QgsExpression::NodeFunction* QgsOgcUtils::nodeSpatialOperatorFromOgcFilter( QDom
}
if ( !gml2Str.isEmpty() )
{
gml2Args->append( new QgsExpression::NodeLiteral( QVariant( gml2Str.remove( "\n" ) ) ) );
gml2Args->append( new QgsExpression::NodeLiteral( QVariant( gml2Str.remove( '\n' ) ) ) );
}
else
{

View File

@ -43,8 +43,8 @@ QgsOWSConnection::QgsOWSConnection( const QString & theService, const QString &
QSettings settings;
QString key = "/Qgis/connections-" + mService.toLower() + "/" + mConnName;
QString credentialsKey = "/Qgis/" + mService + "/" + mConnName;
QString key = "/Qgis/connections-" + mService.toLower() + '/' + mConnName;
QString credentialsKey = "/Qgis/" + mService + '/' + mConnName;
QStringList connStringParts;
@ -129,6 +129,6 @@ void QgsOWSConnection::setSelectedConnection( const QString & theService, const
void QgsOWSConnection::deleteConnection( const QString & theService, const QString & name )
{
QSettings settings;
settings.remove( "/Qgis/connections-" + theService.toLower() + "/" + name );
settings.remove( "/Qgis/" + theService + "/" + name );
settings.remove( "/Qgis/connections-" + theService.toLower() + '/' + name );
settings.remove( "/Qgis/" + theService + '/' + name );
}

View File

@ -516,20 +516,20 @@ QgsExpression* QgsPalLayerSettings::getLabelExpression()
static QColor _readColor( QgsVectorLayer* layer, const QString& property, const QColor& defaultColor = Qt::black, bool withAlpha = true )
{
int r = layer->customProperty( property + "R", QVariant( defaultColor.red() ) ).toInt();
int g = layer->customProperty( property + "G", QVariant( defaultColor.green() ) ).toInt();
int b = layer->customProperty( property + "B", QVariant( defaultColor.blue() ) ).toInt();
int a = withAlpha ? layer->customProperty( property + "A", QVariant( defaultColor.alpha() ) ).toInt() : 255;
int r = layer->customProperty( property + 'R', QVariant( defaultColor.red() ) ).toInt();
int g = layer->customProperty( property + 'G', QVariant( defaultColor.green() ) ).toInt();
int b = layer->customProperty( property + 'B', QVariant( defaultColor.blue() ) ).toInt();
int a = withAlpha ? layer->customProperty( property + 'A', QVariant( defaultColor.alpha() ) ).toInt() : 255;
return QColor( r, g, b, a );
}
static void _writeColor( QgsVectorLayer* layer, const QString& property, const QColor& color, bool withAlpha = true )
{
layer->setCustomProperty( property + "R", color.red() );
layer->setCustomProperty( property + "G", color.green() );
layer->setCustomProperty( property + "B", color.blue() );
layer->setCustomProperty( property + 'R', color.red() );
layer->setCustomProperty( property + 'G', color.green() );
layer->setCustomProperty( property + 'B', color.blue() );
if ( withAlpha )
layer->setCustomProperty( property + "A", color.alpha() );
layer->setCustomProperty( property + 'A', color.alpha() );
}
static QgsPalLayerSettings::SizeUnit _decodeUnits( const QString& str )
@ -2154,7 +2154,7 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont
QString numberFormat;
if ( d > 0 && signPlus )
{
numberFormat.append( "+" );
numberFormat.append( '+' );
}
numberFormat.append( "%1" );
labelText = numberFormat.arg( d, 0, 'f', decimalPlaces );
@ -3736,12 +3736,12 @@ QStringList QgsPalLabeling::splitToLines( const QString &text, const QString &wr
//wrap on both the wrapchr and new line characters
Q_FOREACH ( const QString& line, text.split( wrapCharacter ) )
{
multiLineSplit.append( line.split( QString( "\n" ) ) );
multiLineSplit.append( line.split( '\n' ) );
}
}
else
{
multiLineSplit = text.split( "\n" );
multiLineSplit = text.split( '\n' );
}
return multiLineSplit;

View File

@ -245,7 +245,7 @@ QString QgsPoint::toDegreesMinutesSeconds( int thePrecision, const bool useSuffi
QString rep = myXSign + QString::number( myDegreesX ) + QChar( 176 ) +
myMinutesX + QChar( 0x2032 ) +
myStrSecondsX + QChar( 0x2033 ) +
myXHemisphere + QLatin1String( "," ) +
myXHemisphere + ',' +
myYSign + QString::number( myDegreesY ) + QChar( 176 ) +
myMinutesY + QChar( 0x2032 ) +
myStrSecondsY + QChar( 0x2033 ) +
@ -330,7 +330,7 @@ QString QgsPoint::toDegreesMinutes( int thePrecision, const bool useSuffix, cons
QString rep = myXSign + QString::number( myDegreesX ) + QChar( 176 ) +
myStrMinutesX + QChar( 0x2032 ) +
myXHemisphere + QLatin1String( "," ) +
myXHemisphere + ',' +
myYSign + QString::number( myDegreesY ) + QChar( 176 ) +
myStrMinutesY + QChar( 0x2032 ) +
myYHemisphere;

View File

@ -980,7 +980,7 @@ bool QgsProject::write()
// Create backup file
if ( QFile::exists( fileName() ) )
{
QString backup = fileName() + "~";
QString backup = fileName() + '~';
if ( QFile::exists( backup ) )
QFile::remove( backup );
QFile::rename( fileName(), backup );
@ -1416,7 +1416,7 @@ QString QgsProject::readPath( QString src ) const
if ( home.isNull() )
return vsiPrefix + src;
QFileInfo fi( home + "/" + src );
QFileInfo fi( home + '/' + src );
if ( !fi.exists() )
{
@ -1437,14 +1437,14 @@ QString QgsProject::readPath( QString src ) const
}
#if defined(Q_OS_WIN)
srcPath.replace( "\\", "/" );
projPath.replace( "\\", "/" );
srcPath.replace( '\\', '/' );
projPath.replace( '\\', '/' );
bool uncPath = projPath.startsWith( "//" );
#endif
QStringList srcElems = srcPath.split( "/", QString::SkipEmptyParts );
QStringList projElems = projPath.split( "/", QString::SkipEmptyParts );
QStringList srcElems = srcPath.split( '/', QString::SkipEmptyParts );
QStringList projElems = projPath.split( '/', QString::SkipEmptyParts );
#if defined(Q_OS_WIN)
if ( uncPath )
@ -1511,7 +1511,7 @@ QString QgsProject::writePath( const QString& src, const QString& relativeBasePa
#if defined( Q_OS_WIN )
const Qt::CaseSensitivity cs = Qt::CaseInsensitive;
srcPath.replace( "\\", "/" );
srcPath.replace( '\\', '/' );
if ( srcPath.startsWith( "//" ) )
{
@ -1519,7 +1519,7 @@ QString QgsProject::writePath( const QString& src, const QString& relativeBasePa
srcPath = "\\\\" + srcPath.mid( 2 );
}
projPath.replace( "\\", "/" );
projPath.replace( '\\', '/' );
if ( projPath.startsWith( "//" ) )
{
// keep UNC prefix
@ -1529,8 +1529,8 @@ QString QgsProject::writePath( const QString& src, const QString& relativeBasePa
const Qt::CaseSensitivity cs = Qt::CaseSensitive;
#endif
QStringList projElems = projPath.split( "/", QString::SkipEmptyParts );
QStringList srcElems = srcPath.split( "/", QString::SkipEmptyParts );
QStringList projElems = projPath.split( '/', QString::SkipEmptyParts );
QStringList srcElems = srcPath.split( '/', QString::SkipEmptyParts );
// remove project file element
projElems.removeLast();
@ -1675,7 +1675,7 @@ bool QgsProject::createEmbeddedLayer( const QString &layerId, const QString &pro
if ( provider == "spatialite" )
{
QgsDataSourceURI uri( datasource );
QFileInfo absoluteDs( QFileInfo( projectFilePath ).absolutePath() + "/" + uri.database() );
QFileInfo absoluteDs( QFileInfo( projectFilePath ).absolutePath() + '/' + uri.database() );
if ( absoluteDs.exists() )
{
uri.setDatabase( absoluteDs.absoluteFilePath() );
@ -1684,8 +1684,8 @@ bool QgsProject::createEmbeddedLayer( const QString &layerId, const QString &pro
}
else if ( provider == "ogr" )
{
QStringList theURIParts( datasource.split( "|" ) );
QFileInfo absoluteDs( QFileInfo( projectFilePath ).absolutePath() + "/" + theURIParts[0] );
QStringList theURIParts( datasource.split( '|' ) );
QFileInfo absoluteDs( QFileInfo( projectFilePath ).absolutePath() + '/' + theURIParts[0] );
if ( absoluteDs.exists() )
{
theURIParts[0] = absoluteDs.absoluteFilePath();
@ -1694,8 +1694,8 @@ bool QgsProject::createEmbeddedLayer( const QString &layerId, const QString &pro
}
else if ( provider == "gpx" )
{
QStringList theURIParts( datasource.split( "?" ) );
QFileInfo absoluteDs( QFileInfo( projectFilePath ).absolutePath() + "/" + theURIParts[0] );
QStringList theURIParts( datasource.split( '?' ) );
QFileInfo absoluteDs( QFileInfo( projectFilePath ).absolutePath() + '/' + theURIParts[0] );
if ( absoluteDs.exists() )
{
theURIParts[0] = absoluteDs.absoluteFilePath();
@ -1708,12 +1708,12 @@ bool QgsProject::createEmbeddedLayer( const QString &layerId, const QString &pro
if ( !datasource.startsWith( "file:" ) )
{
QUrl file( QUrl::fromLocalFile( datasource.left( datasource.indexOf( "?" ) ) ) );
QUrl file( QUrl::fromLocalFile( datasource.left( datasource.indexOf( '?' ) ) ) );
urlSource.setScheme( "file" );
urlSource.setPath( file.path() );
}
QFileInfo absoluteDs( QFileInfo( projectFilePath ).absolutePath() + "/" + urlSource.toLocalFile() );
QFileInfo absoluteDs( QFileInfo( projectFilePath ).absolutePath() + '/' + urlSource.toLocalFile() );
if ( absoluteDs.exists() )
{
QUrl urlDest = QUrl::fromLocalFile( absoluteDs.absoluteFilePath() );
@ -1723,7 +1723,7 @@ bool QgsProject::createEmbeddedLayer( const QString &layerId, const QString &pro
}
else
{
QFileInfo absoluteDs( QFileInfo( projectFilePath ).absolutePath() + "/" + datasource );
QFileInfo absoluteDs( QFileInfo( projectFilePath ).absolutePath() + '/' + datasource );
if ( absoluteDs.exists() )
{
datasource = absoluteDs.absoluteFilePath();

Some files were not shown because too many files have changed in this diff Show More