From 9529225c849ee8e697767350cbb08e5f2845681b Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 23 Mar 2018 08:00:25 +0100 Subject: QQuickStyle: use local 8-bit for paths from env vars We must not assume that paths are Latin-1 strings. Change-Id: I13814bf29c9ebb12b71e5c559843589946a7ecac Reviewed-by: Mitch Curtis --- src/quickcontrols2/qquickstyle.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp index 3831259b..804b53fd 100644 --- a/src/quickcontrols2/qquickstyle.cpp +++ b/src/quickcontrols2/qquickstyle.cpp @@ -110,7 +110,7 @@ static QStringList defaultImportPathList() if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) { const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH"); - importPaths += QString::fromLatin1(envImportPath).split(QDir::listSeparator(), QString::SkipEmptyParts); + importPaths += QString::fromLocal8Bit(envImportPath).split(QDir::listSeparator(), QString::SkipEmptyParts); } importPaths += QStringLiteral("qrc:/qt-project.org/imports"); @@ -175,9 +175,9 @@ struct QQuickStyleSpec if (style.isEmpty()) style = QGuiApplicationPrivate::styleOverride; if (style.isEmpty()) - style = QString::fromLatin1(qgetenv("QT_QUICK_CONTROLS_STYLE")); + style = QString::fromLocal8Bit(qgetenv("QT_QUICK_CONTROLS_STYLE")); if (fallbackStyle.isEmpty()) - setFallbackStyle(QString::fromLatin1(qgetenv("QT_QUICK_CONTROLS_FALLBACK_STYLE")), "QT_QUICK_CONTROLS_FALLBACK_STYLE"); + setFallbackStyle(QString::fromLocal8Bit(qgetenv("QT_QUICK_CONTROLS_FALLBACK_STYLE")), "QT_QUICK_CONTROLS_FALLBACK_STYLE"); #if QT_CONFIG(settings) if (style.isEmpty() || fallbackStyle.isEmpty()) { QSharedPointer settings = QQuickStylePrivate::settings(QStringLiteral("Controls")); @@ -266,7 +266,7 @@ QStringList QQuickStylePrivate::stylePaths() QStringList paths; if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE_PATH"))) { const QByteArray value = qgetenv("QT_QUICK_CONTROLS_STYLE_PATH"); - paths += QString::fromLatin1(value).split(QDir::listSeparator(), QString::SkipEmptyParts); + paths += QString::fromLocal8Bit(value).split(QDir::listSeparator(), QString::SkipEmptyParts); } // built-in import paths -- cgit v1.2.3