diff --git a/src/app/main.cpp b/src/app/main.cpp index 6b671995f92..d2c699dda20 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -1126,7 +1126,7 @@ int main( int argc, char *argv[] ) break; } - coords[i] = QString( myInitialExtent.mid( posOld, pos - posOld ) ).toDouble( &ok ); + coords[i] = myInitialExtent.midRef( posOld, pos - posOld ).toDouble( &ok ); if ( !ok ) break; @@ -1135,7 +1135,7 @@ int main( int argc, char *argv[] ) // parse last coordinate if ( ok ) - coords[3] = QString( myInitialExtent.mid( posOld ) ).toDouble( &ok ); + coords[3] = myInitialExtent.midRef( posOld ).toDouble( &ok ); if ( !ok ) { diff --git a/src/app/qgsprojectproperties.cpp b/src/app/qgsprojectproperties.cpp index ec284d07854..e29170464be 100644 --- a/src/app/qgsprojectproperties.cpp +++ b/src/app/qgsprojectproperties.cpp @@ -1908,14 +1908,14 @@ void QgsProjectProperties::populateEllipsoidList() // Crash if no column? para1 = ( const char * )sqlite3_column_text( myPreparedStatement, 2 ); para2 = ( const char * )sqlite3_column_text( myPreparedStatement, 3 ); - myItem.semiMajor = para1.mid( 2 ).toDouble(); + myItem.semiMajor = para1.midRef( 2 ).toDouble(); if ( para2.left( 2 ) == "b=" ) { - myItem.semiMinor = para2.mid( 2 ).toDouble(); + myItem.semiMinor = para2.midRef( 2 ).toDouble(); } else if ( para2.left( 3 ) == "rf=" ) { - double invFlattening = para2.mid( 3 ).toDouble(); + double invFlattening = para2.midRef( 3 ).toDouble(); if ( invFlattening != 0.0 ) { myItem.semiMinor = myItem.semiMajor - ( myItem.semiMajor / invFlattening ); diff --git a/src/core/qgscolorramp.cpp b/src/core/qgscolorramp.cpp index 8442df2e777..73e9d44e2d3 100644 --- a/src/core/qgscolorramp.cpp +++ b/src/core/qgscolorramp.cpp @@ -72,7 +72,7 @@ QgsColorRamp* QgsGradientColorRamp::create( const QgsStringMap& props ) continue; QColor c = QgsSymbolLayerUtils::decodeColor( stop.mid( i + 1 ) ); - stops.append( QgsGradientStop( stop.left( i ).toDouble(), c ) ); + stops.append( QgsGradientStop( stop.leftRef( i ).toDouble(), c ) ); } } diff --git a/src/core/qgscoordinatereferencesystem.cpp b/src/core/qgscoordinatereferencesystem.cpp index a6822eede8a..dbac9726c63 100644 --- a/src/core/qgscoordinatereferencesystem.cpp +++ b/src/core/qgscoordinatereferencesystem.cpp @@ -500,7 +500,7 @@ bool QgsCoordinateReferenceSystem::hasAxisInverted() const { OGRSpatialReferenceH crs = OSRNewSpatialReference( nullptr ); - if ( OSRImportFromEPSGA( crs, d->mAuthId.mid( 5 ).toInt() ) == OGRERR_NONE ) + if ( OSRImportFromEPSGA( crs, d->mAuthId.midRef( 5 ).toInt() ) == OGRERR_NONE ) { OSRGetAxis( crs, OSRIsGeographic( crs ) ? "GEOGCS" : "PROJCS", 0, &orientation ); } @@ -1750,7 +1750,7 @@ bool QgsCoordinateReferenceSystem::loadWkts( QHash &wkts, const ch return false; bool ok; - int epsg = line.left( pos ).toInt( &ok ); + int epsg = line.leftRef( pos ).toInt( &ok ); if ( !ok ) return false; @@ -1791,7 +1791,7 @@ bool QgsCoordinateReferenceSystem::loadIds( QHash &wkts ) continue; bool ok; - int epsg = line.left( pos ).toInt( &ok ); + int epsg = line.leftRef( pos ).toInt( &ok ); if ( !ok ) continue; diff --git a/src/core/qgsdistancearea.cpp b/src/core/qgsdistancearea.cpp index eb06b082454..6dd88dbf045 100644 --- a/src/core/qgsdistancearea.cpp +++ b/src/core/qgsdistancearea.cpp @@ -191,7 +191,7 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid ) // get major semiaxis if ( radius.left( 2 ) == "a=" ) - mSemiMajor = radius.mid( 2 ).toDouble(); + mSemiMajor = radius.midRef( 2 ).toDouble(); else { QgsDebugMsg( QString( "setEllipsoid: wrong format of radius field: '%1'" ).arg( radius ) ); @@ -203,12 +203,12 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid ) // second one must be computed using formula: invf = a/(a-b) if ( parameter2.left( 2 ) == "b=" ) { - mSemiMinor = parameter2.mid( 2 ).toDouble(); + mSemiMinor = parameter2.midRef( 2 ).toDouble(); mInvFlattening = mSemiMajor / ( mSemiMajor - mSemiMinor ); } else if ( parameter2.left( 3 ) == "rf=" ) { - mInvFlattening = parameter2.mid( 3 ).toDouble(); + mInvFlattening = parameter2.midRef( 3 ).toDouble(); mSemiMinor = mSemiMajor - ( mSemiMajor / mInvFlattening ); } else diff --git a/src/core/qgsogcutils.cpp b/src/core/qgsogcutils.cpp index 693cae80ae0..6b8e69473da 100644 --- a/src/core/qgsogcutils.cpp +++ b/src/core/qgsogcutils.cpp @@ -2910,7 +2910,7 @@ QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement: static QString mapBinarySpatialToOgc( const QString& name ) { QString nameCompare( name ); - if ( name.size() > 3 && name.mid( 0, 3 ).compare( "ST_", Qt::CaseInsensitive ) == 0 ) + if ( name.size() > 3 && name.midRef( 0, 3 ).compare( "ST_", Qt::CaseInsensitive ) == 0 ) nameCompare = name.mid( 3 ); QStringList spatialOps; spatialOps << "BBOX" << "Intersects" << "Contains" << "Crosses" << "Equals" @@ -2926,7 +2926,7 @@ static QString mapBinarySpatialToOgc( const QString& name ) static QString mapTernarySpatialToOgc( const QString& name ) { QString nameCompare( name ); - if ( name.size() > 3 && name.mid( 0, 3 ).compare( "ST_", Qt::CaseInsensitive ) == 0 ) + if ( name.size() > 3 && name.midRef( 0, 3 ).compare( "ST_", Qt::CaseInsensitive ) == 0 ) nameCompare = name.mid( 3 ); if ( nameCompare.compare( "DWithin", Qt::CaseInsensitive ) == 0 ) return "DWithin"; diff --git a/src/plugins/georeferencer/qgsgeorefvalidators.cpp b/src/plugins/georeferencer/qgsgeorefvalidators.cpp index 4202699009a..3cba8a33d1d 100644 --- a/src/plugins/georeferencer/qgsgeorefvalidators.cpp +++ b/src/plugins/georeferencer/qgsgeorefvalidators.cpp @@ -57,7 +57,7 @@ QValidator::State QgsDMSAndDDValidator::validate( QString &input, int &pos ) con rx.setPattern( "-?\\d{1,3}\\s60" ); if ( rx.exactMatch( input ) ) { - int in = input.left( input.indexOf( ' ' ) ).toInt(); + int in = input.leftRef( input.indexOf( ' ' ) ).toInt(); int grad = input.startsWith( '-' ) ? in - 1 : in + 1; if ( grad <= 180 ) input = QString::number( grad ); diff --git a/src/providers/grass/qgsgrassprovider.cpp b/src/providers/grass/qgsgrassprovider.cpp index 31e59309c1e..421811e158e 100644 --- a/src/providers/grass/qgsgrassprovider.cpp +++ b/src/providers/grass/qgsgrassprovider.cpp @@ -525,7 +525,7 @@ int QgsGrassProvider::grassLayer( QString name ) return -1; } - return name.left( pos ).toInt(); + return name.leftRef( pos ).toInt(); } int QgsGrassProvider::grassLayerType( QString name ) diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp index ef01dae574e..f413da09994 100644 --- a/src/providers/postgres/qgspostgresprovider.cpp +++ b/src/providers/postgres/qgspostgresprovider.cpp @@ -3852,7 +3852,7 @@ static QString getNextString( const QString& txt, int& i, const QString& sep ) } i += stringRe.cap( 1 ).length() + 2; jumpSpace( txt, i ); - if ( !txt.mid( i ).startsWith( sep ) && i < txt.length() ) + if ( !txt.midRef( i ).startsWith( sep ) && i < txt.length() ) { QgsLogger::warning( "Cannot find separator: " + txt.mid( i ) ); return QString::null; diff --git a/tests/bench/main.cpp b/tests/bench/main.cpp index 83440169a7a..a1c542a1c75 100644 --- a/tests/bench/main.cpp +++ b/tests/bench/main.cpp @@ -557,7 +557,7 @@ int main( int argc, char *argv[] ) break; } - coords[i] = QString( myInitialExtent.mid( posOld, pos - posOld ) ).toDouble( &ok ); + coords[i] = myInitialExtent.midRef( posOld, pos - posOld ).toDouble( &ok ); if ( !ok ) break; @@ -566,7 +566,7 @@ int main( int argc, char *argv[] ) // parse last coordinate if ( ok ) - coords[3] = QString( myInitialExtent.mid( posOld ) ).toDouble( &ok ); + coords[3] = myInitialExtent.midRef( posOld ).toDouble( &ok ); if ( !ok ) {