Skip to content

Commit

Permalink
ConfigObject: guard QTextStream::setCodec behind Qt version check
Browse files Browse the repository at this point in the history
QTextSTream::setCodec was removed in Qt6:
https://bugreports.qt.io/browse/QTBUG-75665
  • Loading branch information
Be-ing committed Oct 13, 2021
1 parent 0a94d35 commit f82eb1c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/preferences/configobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ template <class ValueType> bool ConfigObject<ValueType>::parse() {
int group = 0;
QString groupStr, line;
QTextStream text(&configfile);
// UTF-8 is the default in Qt6.
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
text.setCodec("UTF-8");
#endif

while (!text.atEnd()) {
line = text.readLine().trimmed();
Expand Down Expand Up @@ -213,7 +216,10 @@ bool ConfigObject<ValueType>::save() {
return false;
}
QTextStream stream(&tmpFile);
// UTF-8 is the default in Qt6.
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
stream.setCodec("UTF-8");
#endif

QString group = "";

Expand Down

0 comments on commit f82eb1c

Please sign in to comment.