summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/network/network-chat/peermanager.cpp16
-rw-r--r--examples/network/network.pro3
2 files changed, 7 insertions, 12 deletions
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 \