From 58b37f5908be86a478f20cbbe70228009bd3a481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 3 Nov 2021 14:07:42 +0100 Subject: [PATCH] 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 Reviewed-by: Marc Mutz --- tests/manual/qnetworkinformation/mainwindow.h | 2 +- .../manual/qnetworkinformation/tst_qnetworkinformation.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/manual/qnetworkinformation/mainwindow.h b/tests/manual/qnetworkinformation/mainwindow.h index 0426bc37142..eaaeece3582 100644 --- a/tests/manual/qnetworkinformation/mainwindow.h +++ b/tests/manual/qnetworkinformation/mainwindow.h @@ -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); } diff --git a/tests/manual/qnetworkinformation/tst_qnetworkinformation.cpp b/tests/manual/qnetworkinformation/tst_qnetworkinformation.cpp index fc34a36c3cd..32cb84fcf26 100644 --- a/tests/manual/qnetworkinformation/tst_qnetworkinformation.cpp +++ b/tests/manual/qnetworkinformation/tst_qnetworkinformation.cpp @@ -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; });