diff options
author | John Fultz <jfultz@wolfram.com> | 2023-07-15 21:24:54 -0500 |
---|---|---|
committer | John Fultz <jfultz@wolfram.com> | 2023-07-16 09:02:22 -0500 |
commit | e588b3c3a1052dfc063c9c058d361347329e7899 (patch) | |
tree | f2b4df04526b071e7cada64c9e14e66ebb07dd3b /quacker/letterbox.cpp | |
parent | 97b2ebe1b0d2bafb9d870bc9422ee721e08a6657 (diff) |
Make UTF8-encoding of QTextStream work in Qt5 and 6.
QTextStream::setCodec() is no longer a thing in Qt6. Most of
our call are to set the codec to UTF-8, which happens to be the
default encoding in Qt6. So make a macro so this can compile
in both Qt5 and Qt6.
Diffstat (limited to 'quacker/letterbox.cpp')
-rw-r--r-- | quacker/letterbox.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/quacker/letterbox.cpp b/quacker/letterbox.cpp index aeed7af..6921dca 100644 --- a/quacker/letterbox.cpp +++ b/quacker/letterbox.cpp @@ -232,7 +232,7 @@ void Letterbox::loadFile() QTextStream stream(&file); QString line; - stream.setCodec(QTextCodec::codecForName("UTF-8")); + SET_QTEXTSTREAM_TO_UTF8(stream); m_initializationChuu = true; @@ -522,7 +522,7 @@ void Letterbox::outputResults() } QTextStream stream(&file); - stream.setCodec(QTextCodec::codecForName("UTF-8")); + SET_QTEXTSTREAM_TO_UTF8(stream); if (m_numberIterator < m_clueResults.count()) stream << "\" Resume: " << m_numberIterator << "\n"; @@ -558,7 +558,7 @@ void Letterbox::outputResults() } QTextStream stream(&missesFile); - stream.setCodec(QTextCodec::codecForName("UTF-8")); + SET_QTEXTSTREAM_TO_UTF8(stream); for (const auto& it : m_clueResults) { @@ -924,7 +924,7 @@ void Letterbox::print() setModified(wasModified); QTextStream stream(&file); - stream.setCodec(QTextCodec::codecForName("UTF-8")); + SET_QTEXTSTREAM_TO_UTF8(stream); stream << printer.html() << "\n"; file.close(); @@ -955,7 +955,7 @@ void Letterbox::printStudy() jumpTo(m_clueResults.size() - 1); QTextStream stream(&file); - stream.setCodec(QTextCodec::codecForName("UTF-8")); + SET_QTEXTSTREAM_TO_UTF8(stream); stream << generateStudySheet(m_answers.begin(), m_answers.end()) << "\n"; file.close(); |