From 26ede995ae76d2bb94747667493a1f3f4bf3ee35 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 20 Jul 2021 10:32:34 +1000 Subject: [PATCH] Qt5 compilation fix --- .../interpolation/qgsgridfilewriter.cpp | 29 ++++++++++++++++++- src/analysis/raster/qgsrelief.cpp | 4 +++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/analysis/interpolation/qgsgridfilewriter.cpp b/src/analysis/interpolation/qgsgridfilewriter.cpp index c282c32dc74b..a340903d61c9 100644 --- a/src/analysis/interpolation/qgsgridfilewriter.cpp +++ b/src/analysis/interpolation/qgsgridfilewriter.cpp @@ -73,7 +73,11 @@ int QgsGridFileWriter::writeFile( QgsFeedback *feedback ) } currentXValue += mCellSizeX; } +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + outStream << endl; +#else outStream << Qt::endl; +#endif currentYValue -= mCellSizeY; if ( feedback ) @@ -101,7 +105,11 @@ int QgsGridFileWriter::writeFile( QgsFeedback *feedback ) } QTextStream prjStream( &prjFile ); prjStream << crs; +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + prjStream << endl; +#else prjStream << Qt::endl; +#endif prjFile.close(); return 0; @@ -109,20 +117,39 @@ int QgsGridFileWriter::writeFile( QgsFeedback *feedback ) int QgsGridFileWriter::writeHeader( QTextStream &outStream ) { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + outStream << "NCOLS " << mNumColumns << endl; + outStream << "NROWS " << mNumRows << endl; + outStream << "XLLCORNER " << mInterpolationExtent.xMinimum() << endl; + outStream << "YLLCORNER " << mInterpolationExtent.yMinimum() << endl; +#else outStream << "NCOLS " << mNumColumns << Qt::endl; outStream << "NROWS " << mNumRows << Qt::endl; outStream << "XLLCORNER " << mInterpolationExtent.xMinimum() << Qt::endl; outStream << "YLLCORNER " << mInterpolationExtent.yMinimum() << Qt::endl; +#endif if ( mCellSizeX == mCellSizeY ) //standard way { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + outStream << "CELLSIZE " << mCellSizeX << endl; +#else outStream << "CELLSIZE " << mCellSizeX << Qt::endl; +#endif } else //this is supported by GDAL but probably not by other products { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + outStream << "DX " << mCellSizeX << endl; + outStream << "DY " << mCellSizeY << endl; +#else outStream << "DX " << mCellSizeX << Qt::endl; outStream << "DY " << mCellSizeY << Qt::endl; +#endif } +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + outStream << "NODATA_VALUE -9999" << endl; +#else outStream << "NODATA_VALUE -9999" << Qt::endl; - +#endif return 0; } diff --git a/src/analysis/raster/qgsrelief.cpp b/src/analysis/raster/qgsrelief.cpp index 8b11ed7ab7aa..0cd2de9f7260 100644 --- a/src/analysis/raster/qgsrelief.cpp +++ b/src/analysis/raster/qgsrelief.cpp @@ -548,7 +548,11 @@ bool QgsRelief::exportFrequencyDistributionToCsv( const QString &file ) #endif for ( int i = 0; i < 252; ++i ) { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + outstream << QString::number( i ) + ',' + QString::number( frequency[i] ) << endl; +#else outstream << QString::number( i ) + ',' + QString::number( frequency[i] ) << Qt::endl; +#endif } outFile.close(); return true;