Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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 1a59efb
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 0 deletions.
Expand Up @@ -11,6 +11,7 @@




class QgsNetworkContentFetcher : QObject
{
%Docstring(signature="appended")
Expand Down
2 changes: 2 additions & 0 deletions src/core/annotations/qgshtmlannotation.cpp
Expand Up @@ -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();
}

Expand Down
2 changes: 2 additions & 0 deletions src/core/network/qgsnetworkcontentfetcher.h
Expand Up @@ -25,6 +25,8 @@

#include "qgis_core.h"

class QTextCodec;

/**
* \class QgsNetworkContentFetcher
* \ingroup core
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgsabstractgeopdfexporter.cpp
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/core/qgsbookmarkmanager.cpp
Expand Up @@ -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();

Expand Down Expand Up @@ -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();
}
Expand Down
1 change: 1 addition & 0 deletions src/core/qgscredentials.cpp
Expand Up @@ -17,6 +17,7 @@
#include "qgslogger.h"

#include <QTextStream>
#include <QIODevice>

QgsCredentials *QgsCredentials::sInstance = nullptr;

Expand Down
2 changes: 2 additions & 0 deletions src/core/qgsogrutils.h
Expand Up @@ -28,6 +28,8 @@
#include "cpl_string.h"
#include "qgssymbol.h"

class QTextCodec;

namespace gdal
{

Expand Down
2 changes: 2 additions & 0 deletions src/core/qgssettings.cpp
Expand Up @@ -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
}
}

Expand Down

0 comments on commit 1a59efb

Please sign in to comment.