Skip to content

Commit

Permalink
Parse tooltip files as utf-8 encoded
Browse files Browse the repository at this point in the history
  • Loading branch information
u-235 committed Oct 3, 2024
1 parent 736a615 commit 03e53eb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gcodeworkshop/src/gcoderdocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#include <QVariant> // for QVariant
#include <QWidget> // for QWidget
#include <Qt> // for CaseInsensitive, CaseSensitive, CaseSensitivity, WA_DeleteOnClose, Custo...
#include <QtGlobal> // for QFlags, QFlags<>::enum_type, qDebug
#include <QtGlobal> // for QFlags, QFlags<>::enum_type, qDebug, QT_VERSION, QT_VERSION_CHECK

class QMenu;

Expand Down Expand Up @@ -639,7 +639,14 @@ void GCoderDocument::loadToolTips(QHash<QString, QString>& tips, const QString&
{
if (QFile::exists(fileName)) {
QSettings settings(fileName, QSettings::IniFormat);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// Qt5: By default QSettings will accept Latin-1 encoded INI files,
// where non-ASCII values are encoded using standard INI escape sequences.
// Qt6: QSettings will assume that values in the INI file are utf-8 encoded.
settings.setIniCodec("utf-8");
#endif
settings.beginGroup(group);

const QStringList& keys = settings.childKeys();

for (const QString& k : keys) {
Expand Down

0 comments on commit 03e53eb

Please sign in to comment.