Skip to content
Permalink
Browse files

[qt6] Qt6 uses utf-8 by default

for QTextStream and QSettings
  • Loading branch information
m-kuhn authored and nyalldawson committed Mar 27, 2021
1 parent 9f6502e commit 1a59efb177e45c64c699e5660a55692a27430e54
@@ -11,6 +11,7 @@




class QgsNetworkContentFetcher : QObject
{
%Docstring(signature="appended")
@@ -67,7 +67,9 @@ void QgsHtmlAnnotation::setSourceFile( const QString &htmlFile )
else
{
QTextStream in( &file );
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
in.setCodec( "UTF-8" );
#endif
mHtmlSource = in.readAll();
}

@@ -25,6 +25,8 @@

#include "qgis_core.h"

class QTextCodec;

/**
* \class QgsNetworkContentFetcher
* \ingroup core
@@ -98,7 +98,9 @@ bool QgsAbstractGeoPdfExporter::finalize( const QList<ComponentLayerDetail> &com
if ( file.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) )
{
QTextStream out( &file );
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec( "UTF-8" );
#endif
out << composition;
}
else
@@ -411,7 +411,9 @@ bool QgsBookmarkManager::exportToFile( const QString &path, const QList<const Qg
}

QTextStream out( &f );
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec( "UTF-8" );
#endif
doc.save( out, 2 );
f.close();

@@ -486,7 +488,9 @@ void QgsBookmarkManager::store()
doc.appendChild( elem );

QTextStream out( &f );
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec( "UTF-8" );
#endif
doc.save( out, 2 );
f.close();
}
@@ -17,6 +17,7 @@
#include "qgslogger.h"

#include <QTextStream>
#include <QIODevice>

QgsCredentials *QgsCredentials::sInstance = nullptr;

@@ -28,6 +28,8 @@
#include "cpl_string.h"
#include "qgssymbol.h"

class QTextCodec;

namespace gdal
{

@@ -40,7 +40,9 @@ void QgsSettings::init()
if ( ! sGlobalSettingsPath()->isEmpty() )
{
mGlobalSettings = new QSettings( *sGlobalSettingsPath(), QSettings::IniFormat );
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
mGlobalSettings->setIniCodec( "UTF-8" );
#endif
}
}

0 comments on commit 1a59efb

Please sign in to comment.