From 944bf6867f8360e7ec79f542f65b4ea556ecc4e5 Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Sun, 5 Mar 2017 17:28:56 +0100 Subject: Add more information about how to get a QString from qgetenv Change-Id: Ic712654c8d4735a59bf02cf6a7e1c689ca9a886c Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 54df8b1f61..6b3cb502e5 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -3220,12 +3220,16 @@ static QBasicMutex environmentMutex; Returns the value of the environment variable with name \a varName. To get the variable string, use QByteArray::constData(). + To convert the data to a QString use QString::fromLocal8Bit(). \note qgetenv() was introduced because getenv() from the standard C library was deprecated in VC2005 (and later versions). qgetenv() uses the new replacement function in VC, and calls the standard C library's implementation on all other platforms. + \warning Don't use qgetenv on Windows if the content may contain + non-US-ASCII characters, like file paths. + \sa qputenv(), qEnvironmentVariableIsSet(), qEnvironmentVariableIsEmpty() */ QByteArray qgetenv(const char *varName) -- cgit v1.2.3