diff --git a/examples/network/network-chat/peermanager.cpp b/examples/network/network-chat/peermanager.cpp index b056d5ed1f..c70cc5e56d 100644 --- a/examples/network/network-chat/peermanager.cpp +++ b/examples/network/network-chat/peermanager.cpp @@ -63,18 +63,14 @@ PeerManager::PeerManager(Client *client) this->client = client; QStringList envVariables; - envVariables << "USERNAME.*" << "USER.*" << "USERDOMAIN.*" - << "HOSTNAME.*" << "DOMAINNAME.*"; + envVariables << "USERNAME" << "USER" << "USERDOMAIN" + << "HOSTNAME" << "DOMAINNAME"; - QStringList environment = QProcess::systemEnvironment(); + QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); foreach (QString string, envVariables) { - int index = environment.indexOf(QRegExp(string)); - if (index != -1) { - QStringList stringList = environment.at(index).split('='); - if (stringList.size() == 2) { - username = stringList.at(1).toUtf8(); - break; - } + if (environment.contains(string)) { + username = environment.value(string).toUtf8(); + break; } } diff --git a/examples/network/network.pro b/examples/network/network.pro index 5ad5f1939f..3a269f16ae 100644 --- a/examples/network/network.pro +++ b/examples/network/network.pro @@ -20,8 +20,7 @@ qtHaveModule(widgets) { multicastsender qtConfig(bearermanagement) { - # no QProcess - !vxworks:!qnx:!winrt:!integrity:!uikit: SUBDIRS += network-chat + qtConfig(processenvironment): SUBDIRS += network-chat SUBDIRS += \ bearermonitor \