QNI manual test: Remove unnecessary capturing and wrapping

No need to capture anything by reference, it's a leftover from when
the MainWindow was changed from inside the lambda.

And no need to wrap the argument to QLatin1String.arg() with QStringView
explicitly. This change is made just for brevity and consistency.

Change-Id: Ib8c163bcf5932d35a9d43dd8ce124588c539d5a4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Mårten Nordheim 2021-11-03 14:07:42 +01:00
parent 83ddf49bc7
commit 58b37f5908
2 changed files with 4 additions and 4 deletions

View File

@ -86,7 +86,7 @@ private:
QString str =
QLatin1String("Reachability: %1\nBehind captive portal: %2\nTransport medium: %3"
"\nMetered: %4")
.arg(enumToString(reachability), QStringView(captive ? u"true" : u"false"),
.arg(enumToString(reachability), captive ? u"true" : u"false",
enumToString(transportMedium), metered ? u"true" : u"false");
label->setText(str);
}

View File

@ -58,15 +58,15 @@ int main(int argc, char **argv)
qDebug() << "Now you can make changes to the current network connection. Qt should see the "
"changes and notify about it.";
QObject::connect(info, &QNetworkInformation::reachabilityChanged,
[&](QNetworkInformation::Reachability newStatus) {
[](QNetworkInformation::Reachability newStatus) {
qDebug() << "Updated:" << newStatus;
});
QObject::connect(info, &QNetworkInformation::isBehindCaptivePortalChanged,
[&](bool status) { qDebug() << "Updated, behind captive portal:" << status; });
[](bool status) { qDebug() << "Updated, behind captive portal:" << status; });
QObject::connect(info, &QNetworkInformation::transportMediumChanged,
[&](QNetworkInformation::TransportMedium newMedium) {
[](QNetworkInformation::TransportMedium newMedium) {
qDebug() << "Updated, current transport medium:" << newMedium;
});