Skip to content

Commit

Permalink
Replace use of deprecated QString::fromAscii
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 5, 2017
1 parent b0f71e5 commit 25a18b9
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/analysis/raster/qgsalignraster.cpp
Expand Up @@ -568,7 +568,7 @@ QgsAlignRaster::RasterInfo::RasterInfo( const QString &layerpath )
( void ) GDALGetGeoTransform( mDataset, mGeoTransform );

// TODO: may be null or empty string
mCrsWkt = QString::fromAscii( GDALGetProjectionRef( mDataset ) );
mCrsWkt = QString::fromLatin1( GDALGetProjectionRef( mDataset ) );

mBandCnt = GDALGetBandNumber( mDataset );
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgshandlebadlayers.cpp
Expand Up @@ -236,7 +236,7 @@ void QgsHandleBadLayers::setFilename( int row, const QString &filename )
QUrl uriSource = QUrl::fromEncoded( datasource.toLatin1() );
QUrl uriDest = QUrl::fromLocalFile( filename );
uriDest.setQueryItems( uriSource.queryItems() );
datasource = QString::fromAscii( uriDest.toEncoded() );
datasource = QString::fromLatin1( uriDest.toEncoded() );
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsapplication.cpp
Expand Up @@ -318,7 +318,7 @@ bool QgsApplication::notify( QObject *receiver, QEvent *event )
}
catch ( std::exception &e )
{
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromAscii( e.what() ) );
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromLatin1( e.what() ) );
if ( qApp->thread() == QThread::currentThread() )
QMessageBox::critical( activeWindow(), tr( "Exception" ), e.what() );
}
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsexpressionlexer.ll
Expand Up @@ -186,14 +186,14 @@ string "'"{str_char}*"'"
"," { return COMMA; }
{num_float} { yylval->numberFloat = cLocale.toDouble( QString::fromAscii(yytext) ); return NUMBER_FLOAT; }
{num_float} { yylval->numberFloat = cLocale.toDouble( QString::fromLatin1(yytext) ); return NUMBER_FLOAT; }
{num_int} {
bool ok;
yylval->numberInt = cLocale.toInt( QString::fromAscii(yytext), &ok );
yylval->numberInt = cLocale.toInt( QString::fromLatin1(yytext), &ok );
if( ok )
return NUMBER_INT;
yylval->numberFloat = cLocale.toDouble( QString::fromAscii(yytext), &ok );
yylval->numberFloat = cLocale.toDouble( QString::fromLatin1(yytext), &ok );
if( ok )
return NUMBER_FLOAT;
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsmaplayer.cpp
Expand Up @@ -257,7 +257,7 @@ bool QgsMapLayer::readLayerXml( const QDomElement &layerElement, const QgsReadWr

QUrl urlDest = QUrl::fromLocalFile( context.pathResolver().readPath( urlSource.toLocalFile() ) );
urlDest.setQueryItems( urlSource.queryItems() );
mDataSource = QString::fromAscii( urlDest.toEncoded() );
mDataSource = QString::fromLatin1( urlDest.toEncoded() );
}
else if ( provider == QLatin1String( "wms" ) )
{
Expand Down Expand Up @@ -621,7 +621,7 @@ bool QgsMapLayer::writeLayerXml( QDomElement &layerElement, QDomDocument &docume
QUrl urlSource = QUrl::fromEncoded( src.toLatin1() );
QUrl urlDest = QUrl::fromLocalFile( context.pathResolver().writePath( urlSource.toLocalFile() ) );
urlDest.setQueryItems( urlSource.queryItems() );
src = QString::fromAscii( urlDest.toEncoded() );
src = QString::fromLatin1( urlDest.toEncoded() );
}
else if ( vlayer && vlayer->providerType() == QLatin1String( "memory" ) )
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaprenderercustompainterjob.cpp
Expand Up @@ -223,7 +223,7 @@ void QgsMapRendererCustomPainterJob::staticRender( QgsMapRendererCustomPainterJo
catch ( std::exception &e )
{
Q_UNUSED( e );
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromAscii( e.what() ) );
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromLatin1( e.what() ) );
}
catch ( ... )
{
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsmaprendererparalleljob.cpp
Expand Up @@ -263,7 +263,7 @@ void QgsMapRendererParallelJob::renderLayerStatic( LayerRenderJob &job )
catch ( std::exception &e )
{
Q_UNUSED( e );
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromAscii( e.what() ) );
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromLatin1( e.what() ) );
}
catch ( ... )
{
Expand Down Expand Up @@ -307,7 +307,7 @@ void QgsMapRendererParallelJob::renderLabelsStatic( QgsMapRendererParallelJob *s
catch ( std::exception &e )
{
Q_UNUSED( e );
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromAscii( e.what() ) );
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromLatin1( e.what() ) );
}
catch ( ... )
{
Expand Down
8 changes: 4 additions & 4 deletions src/core/qgssqlstatementlexer.ll
Expand Up @@ -164,18 +164,18 @@ string "'"{str_char}*"'"
"," { return COMMA; }
{num_float} { yylval->numberFloat = cLocale.toDouble( QString::fromAscii(yytext) ); return NUMBER_FLOAT; }
{num_float} { yylval->numberFloat = cLocale.toDouble( QString::fromLatin1(yytext) ); return NUMBER_FLOAT; }
{num_int} {
bool ok;
yylval->numberInt = cLocale.toInt( QString::fromAscii(yytext), &ok );
yylval->numberInt = cLocale.toInt( QString::fromLatin1(yytext), &ok );
if( ok )
return NUMBER_INT;
yylval->numberInt64 = cLocale.toLongLong( QString::fromAscii(yytext), &ok );
yylval->numberInt64 = cLocale.toLongLong( QString::fromLatin1(yytext), &ok );
if( ok )
return NUMBER_INT64;
yylval->numberFloat = cLocale.toDouble( QString::fromAscii(yytext), &ok );
yylval->numberFloat = cLocale.toDouble( QString::fromLatin1(yytext), &ok );
if( ok )
return NUMBER_FLOAT;
Expand Down
Expand Up @@ -115,7 +115,7 @@ void eVisDatabaseConnectionGui::drawNewVectorLayer( const QString &layerName, co
url.addQueryItem( QStringLiteral( "delimiterType" ), QStringLiteral( "regexp" ) );
url.addQueryItem( QStringLiteral( "xField" ), xCoordinate );
url.addQueryItem( QStringLiteral( "yField" ), yCoordinate );
emit drawVectorLayer( QString::fromAscii( url.toEncoded() ), layerName, QStringLiteral( "delimitedtext" ) );
emit drawVectorLayer( QString::fromLatin1( url.toEncoded() ), layerName, QStringLiteral( "delimitedtext" ) );
mTempOutputFileList->last()->close();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
Expand Up @@ -1090,7 +1090,7 @@ void QgsDelimitedTextProvider::setUriParameter( const QString &parameter, const
QUrl url = QUrl::fromEncoded( dataSourceUri().toLatin1() );
if ( url.hasQueryItem( parameter ) ) url.removeAllQueryItems( parameter );
if ( ! value.isEmpty() ) url.addQueryItem( parameter, value );
setDataSourceUri( QString::fromAscii( url.toEncoded() ) );
setDataSourceUri( QString::fromLatin1( url.toEncoded() ) );
}

void QgsDelimitedTextProvider::onFileUpdated()
Expand Down
Expand Up @@ -193,7 +193,7 @@ void QgsDelimitedTextSourceSelect::addButtonClicked()


// add the layer to the map
emit addVectorLayer( QString::fromAscii( url.toEncoded() ), txtLayerName->text() );
emit addVectorLayer( QString::fromLatin1( url.toEncoded() ), txtLayerName->text() );
if ( widgetMode() == QgsProviderRegistry::WidgetMode::None )
{
accept();
Expand Down

0 comments on commit 25a18b9

Please sign in to comment.