diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2015-12-03 23:36:48 -0800 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-09-14 17:59:25 +0000 |
commit | a361e62a9fedabc7bd4c57d933bf78468fdc6795 (patch) | |
tree | 2f89965ae8d5d385c9ad28889ce50562a18f86b8 | |
parent | 8369efcbc3c90e1712aba1ca167cac29f9c2ba97 (diff) |
Use the qEnvironmentVariable function from QtCore
This corrects the encoding of QML2_IMPORT_PATH environment variable,
since it contains paths. For the other cases, it's just improving the
code.
Task-number: QTBUG-62328
Change-Id: I0f2ce894387048f78465ffff141ca50208f6845a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/qml/qml/qqmlimport.cpp | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontextplugin.cpp | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index 7c9dcb1826..66c0be41da 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -1699,13 +1699,13 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e) // env import paths if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) { - const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH"); + const QString envImportPath = qEnvironmentVariable("QML2_IMPORT_PATH"); #if defined(Q_OS_WIN) QLatin1Char pathSep(';'); #else QLatin1Char pathSep(':'); #endif - QStringList paths = QString::fromLatin1(envImportPath).split(pathSep, QString::SkipEmptyParts); + QStringList paths = envImportPath.split(pathSep, QString::SkipEmptyParts); for (int ii = paths.count() - 1; ii >= 0; --ii) addImportPath(paths.at(ii)); } diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp index bd311d3b46..6583883d0c 100644 --- a/src/quick/scenegraph/qsgcontextplugin.cpp +++ b/src/quick/scenegraph/qsgcontextplugin.cpp @@ -122,14 +122,14 @@ QSGAdaptationBackendData *contextFactory() } } - if (requestedBackend.isEmpty() && qEnvironmentVariableIsSet("QMLSCENE_DEVICE")) - requestedBackend = QString::fromLocal8Bit(qgetenv("QMLSCENE_DEVICE")); + if (requestedBackend.isEmpty()) + requestedBackend = qEnvironmentVariable("QMLSCENE_DEVICE"); // A modern alternative. Scenegraph adaptations can represent backends // for different graphics APIs as well, instead of being specific to // some device or platform. - if (requestedBackend.isEmpty() && qEnvironmentVariableIsSet("QT_QUICK_BACKEND")) - requestedBackend = QString::fromLocal8Bit(qgetenv("QT_QUICK_BACKEND")); + if (requestedBackend.isEmpty()) + requestedBackend = qEnvironmentVariable("QT_QUICK_BACKEND"); // If this platform does not support OpenGL, and no backend has been set // default to the software renderer |