Skip to content
Permalink
Browse files

Replace use of deprecated QString::fromAscii

  • Loading branch information
nyalldawson committed Sep 5, 2017
1 parent b0f71e5 commit 25a18b9ca1a6f02024904bafcab95c3cf87a8b38
@@ -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 );
}
@@ -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
@@ -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() );
}
@@ -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;
@@ -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" ) )
{
@@ -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" ) )
{
@@ -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 ( ... )
{
@@ -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 ( ... )
{
@@ -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 ( ... )
{
@@ -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;
@@ -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();
}
}
@@ -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()
@@ -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();

0 comments on commit 25a18b9

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