Skip to content
Permalink
Browse files

Utf-8 is the default encoding in Qt6 anyway

  • Loading branch information
m-kuhn authored and nyalldawson committed Mar 31, 2021
1 parent a135aee commit 666fcda9b87f0412b092146fbe8c1fcdb9e8aff0
Showing with 18 additions and 0 deletions.
  1. +18 −0 src/core/symbology/qgsstyle.cpp
@@ -212,7 +212,9 @@ bool QgsStyle::saveSymbol( const QString &name, QgsSymbol *symbol, bool favorite

QByteArray xmlArray;
QTextStream stream( &xmlArray );
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
stream.setCodec( "UTF-8" );
#endif
symEl.save( stream, 4 );
QString query = qgs_sqlite3_mprintf( "INSERT INTO symbol VALUES (NULL, '%q', '%q', %d);",
name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) );
@@ -411,7 +413,9 @@ bool QgsStyle::saveColorRamp( const QString &name, QgsColorRamp *ramp, bool favo

QByteArray xmlArray;
QTextStream stream( &xmlArray );
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
stream.setCodec( "UTF-8" );
#endif
rampEl.save( stream, 4 );
QString query = qgs_sqlite3_mprintf( "INSERT INTO colorramp VALUES (NULL, '%q', '%q', %d);",
name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) );
@@ -961,7 +965,9 @@ bool QgsStyle::saveTextFormat( const QString &name, const QgsTextFormat &format,

QByteArray xmlArray;
QTextStream stream( &xmlArray );
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
stream.setCodec( "UTF-8" );
#endif
formatElem.save( stream, 4 );
QString query = qgs_sqlite3_mprintf( "INSERT INTO textformat VALUES (NULL, '%q', '%q', %d);",
name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) );
@@ -1035,7 +1041,9 @@ bool QgsStyle::saveLabelSettings( const QString &name, const QgsPalLayerSettings

QByteArray xmlArray;
QTextStream stream( &xmlArray );
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
stream.setCodec( "UTF-8" );
#endif
settingsElem.save( stream, 4 );
QString query = qgs_sqlite3_mprintf( "INSERT INTO labelsettings VALUES (NULL, '%q', '%q', %d);",
name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) );
@@ -1104,7 +1112,9 @@ bool QgsStyle::saveLegendPatchShape( const QString &name, const QgsLegendPatchSh

QByteArray xmlArray;
QTextStream stream( &xmlArray );
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
stream.setCodec( "UTF-8" );
#endif
shapeElem.save( stream, 4 );
QString query = qgs_sqlite3_mprintf( "INSERT INTO legendpatchshapes VALUES (NULL, '%q', '%q', %d);",
name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) );
@@ -1222,7 +1232,9 @@ bool QgsStyle::saveSymbol3D( const QString &name, QgsAbstract3DSymbol *symbol, b

QByteArray xmlArray;
QTextStream stream( &xmlArray );
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
stream.setCodec( "UTF-8" );
#endif
elem.save( stream, 4 );
QString query = qgs_sqlite3_mprintf( "INSERT INTO symbol3d VALUES (NULL, '%q', '%q', %d);",
name.toUtf8().constData(), xmlArray.constData(), ( favorite ? 1 : 0 ) );
@@ -2280,7 +2292,9 @@ int QgsStyle::addSmartgroup( const QString &name, const QString &op, const QStri

QByteArray xmlArray;
QTextStream stream( &xmlArray );
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
stream.setCodec( "UTF-8" );
#endif
smartEl.save( stream, 4 );
QString query = qgs_sqlite3_mprintf( "INSERT INTO smartgroup VALUES (NULL, '%q', '%q')",
name.toUtf8().constData(), xmlArray.constData() );
@@ -2665,7 +2679,9 @@ bool QgsStyle::exportXml( const QString &filename )
}

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

@@ -3038,7 +3054,9 @@ bool QgsStyle::updateSymbol( StyleEntity type, const QString &name )
QDomElement symEl;
QByteArray xmlArray;
QTextStream stream( &xmlArray );
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
stream.setCodec( "UTF-8" );
#endif

QString query;

0 comments on commit 666fcda

Please sign in to comment.