Skip to content

Commit

Permalink
Utf-8 is the default encoding in Qt6 anyway
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn authored and nyalldawson committed Mar 31, 2021
1 parent a135aee commit 666fcda
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/core/symbology/qgsstyle.cpp
Expand Up @@ -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 ) );
Expand Down Expand Up @@ -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 ) );
Expand Down Expand Up @@ -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 ) );
Expand Down Expand Up @@ -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 ) );
Expand Down Expand Up @@ -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 ) );
Expand Down Expand Up @@ -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 ) );
Expand Down Expand Up @@ -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() );
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 666fcda

Please sign in to comment.