summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-01-11 09:25:47 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-01-15 00:13:26 +0000
commita45a02539bc935edc4ae392ff36c4a8020717788 (patch)
treeda1d6a90cd4ff63f305b8161c96b26198bf2d0ee
parentad9b7833b0cd9b2bd728712a30684b692cb065c0 (diff)
downloadqtapplicationmanager-a45a02539bc935edc4ae392ff36c4a8020717788.tar.gz
Port from qAsConst to std::as_const
QT_NO_AS_CONST is now globally enabled in qtbase. Change-Id: Ifc2eab1c902e75f5dbfc38ef9a62b29b5c91bc61 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 1544f245bb22194a22c6eeb75d3b99b82cee15c1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--examples/applicationmanager/softwarecontainer-plugin/softwarecontainer.cpp4
-rw-r--r--src/common-lib/configcache.cpp4
-rw-r--r--src/common-lib/unixsignalhandler.cpp10
-rw-r--r--src/common-lib/utilities.cpp2
-rw-r--r--src/intent-server-lib/intentserver.cpp2
-rw-r--r--src/main-lib/main.cpp16
-rw-r--r--src/manager-lib/applicationmanager.cpp20
-rw-r--r--src/manager-lib/intentaminterface.cpp4
-rw-r--r--src/manager-lib/packagemanager.cpp8
-rw-r--r--src/manager-lib/processcontainer.cpp2
-rw-r--r--src/manager-lib/quicklauncher.cpp2
-rw-r--r--src/monitor-lib/systemreader.cpp2
-rw-r--r--src/package-lib/packagecreator.cpp4
-rw-r--r--src/tools/controller/controller.cpp2
-rw-r--r--src/tools/dumpqmltypes/dumpqmltypes.cpp2
-rw-r--r--src/tools/launcher-qml/launcher-qml.cpp10
-rw-r--r--src/tools/packager/packagingjob.cpp2
-rw-r--r--src/window-lib/windowmanager.cpp2
-rw-r--r--tests/auto/configuration/tst_configuration.cpp2
-rw-r--r--tests/auto/debugwrapper/tst_debugwrapper.cpp8
-rw-r--r--tests/auto/packagecreator/tst_packagecreator.cpp2
21 files changed, 55 insertions, 55 deletions
diff --git a/examples/applicationmanager/softwarecontainer-plugin/softwarecontainer.cpp b/examples/applicationmanager/softwarecontainer-plugin/softwarecontainer.cpp
index a9c8ebe0..2b9700cb 100644
--- a/examples/applicationmanager/softwarecontainer-plugin/softwarecontainer.cpp
+++ b/examples/applicationmanager/softwarecontainer-plugin/softwarecontainer.cpp
@@ -362,7 +362,7 @@ bool SoftwareContainer::sendBindMounts()
bindMountResults << iface->asyncCall(QStringLiteral("BindMount"), m_id, std::get<0>(*it),
std::get<1>(*it), std::get<2>(*it));
- for (const auto &pending : qAsConst(bindMountResults))
+ for (const auto &pending : std::as_const(bindMountResults))
QDBusPendingCallWatcher(pending).waitForFinished();
for (int i = 0; i < bindMounts.size(); ++i) {
@@ -457,7 +457,7 @@ bool SoftwareContainer::start(const QStringList &arguments, const QMap<QString,
// SC expects a plain string instead of individual args
QString cmdLine;
- for (const auto &part : qAsConst(command)) {
+ for (const auto &part : std::as_const(command)) {
if (!cmdLine.isEmpty())
cmdLine.append(QLatin1Char(' '));
cmdLine.append(QLatin1Char('\"'));
diff --git a/src/common-lib/configcache.cpp b/src/common-lib/configcache.cpp
index d9dbce1c..8bbdc388 100644
--- a/src/common-lib/configcache.cpp
+++ b/src/common-lib/configcache.cpp
@@ -133,7 +133,7 @@ void AbstractConfigCache::parse()
// normalize all yaml file names
QStringList rawFilePaths;
- for (const auto &rawFile : qAsConst(d->rawFiles)) {
+ for (const auto &rawFile : std::as_const(d->rawFiles)) {
const auto path = QFileInfo(rawFile).canonicalFilePath();
if (path.isEmpty())
throw Exception("file %1 does not exist").arg(rawFile);
@@ -389,7 +389,7 @@ void AbstractConfigCache::parse()
void AbstractConfigCache::clear()
{
- for (auto &ce : qAsConst(d->cache))
+ for (auto &ce : std::as_const(d->cache))
destruct(ce.content);
d->cache.clear();
d->cacheIndex.clear();
diff --git a/src/common-lib/unixsignalhandler.cpp b/src/common-lib/unixsignalhandler.cpp
index 550c0364..0602d6c6 100644
--- a/src/common-lib/unixsignalhandler.cpp
+++ b/src/common-lib/unixsignalhandler.cpp
@@ -99,7 +99,7 @@ bool UnixSignalHandler::install(Type handlerType, const std::initializer_list<in
auto that = UnixSignalHandler::instance();
that->m_currentSignal = sig;
- for (const auto &h : qAsConst(that->m_handlers)) {
+ for (const auto &h : std::as_const(that->m_handlers)) {
if ((h.m_signal == sig) && !h.m_disabled) {
if (!h.m_qt) {
h.m_handler(sig);
@@ -122,7 +122,7 @@ bool UnixSignalHandler::install(Type handlerType, const std::initializer_list<in
// We can not remove the entries in the list, because that would (a) allocate and (b)
// step on code that might be iterating over the list in the "Forwarded" handler.
- for (const auto &h : qAsConst(that->m_handlers)) {
+ for (const auto &h : std::as_const(that->m_handlers)) {
if (that->m_resetSignalMask & am_sigmask(h.m_signal))
h.m_disabled = true;
}
@@ -152,7 +152,7 @@ bool UnixSignalHandler::install(Type handlerType, const std::initializer_list<in
return;
}
- for (const auto &h : qAsConst(m_handlers)) {
+ for (const auto &h : std::as_const(m_handlers)) {
if (h.m_qt && (h.m_signal == sig) && !h.m_disabled)
h.m_handler(sig);
}
@@ -165,8 +165,8 @@ bool UnixSignalHandler::install(Type handlerType, const std::initializer_list<in
connect(m_winEvent, &QWinEventNotifier::activated, qApp, [this]() {
// this lambda is the "signal handler" multiplexer within the Qt event loop
m_winLock.lock();
- for (const int &sig : qAsConst(m_signalsForEventLoop)) {
- for (const auto &h : qAsConst(m_handlers)) {
+ for (const int &sig : std::as_const(m_signalsForEventLoop)) {
+ for (const auto &h : std::as_const(m_handlers)) {
if (h.m_qt && (h.m_signal == sig) && !h.m_disabled)
h.m_handler(sig);
}
diff --git a/src/common-lib/utilities.cpp b/src/common-lib/utilities.cpp
index fcea9a24..91645647 100644
--- a/src/common-lib/utilities.cpp
+++ b/src/common-lib/utilities.cpp
@@ -310,7 +310,7 @@ void loadResource(const QString &resource) Q_DECL_NOEXCEPT_EXPR(false)
void closeAndClearFileDescriptors(QVector<int> &fdList)
{
- for (int fd : qAsConst(fdList)) {
+ for (int fd : std::as_const(fdList)) {
if (fd >= 0)
QT_CLOSE(fd);
}
diff --git a/src/intent-server-lib/intentserver.cpp b/src/intent-server-lib/intentserver.cpp
index 476e0c77..56a12f8a 100644
--- a/src/intent-server-lib/intentserver.cpp
+++ b/src/intent-server-lib/intentserver.cpp
@@ -803,7 +803,7 @@ IntentServerRequest *IntentServer::requestToSystem(const QString &requestingAppl
}
if (broadcast) {
- for (auto intent : qAsConst(intents)) {
+ for (auto intent : std::as_const(intents)) {
auto isr = new IntentServerRequest(requestingApplicationId, intentId, { intent }, parameters, broadcast);
enqueueRequest(isr);
}
diff --git a/src/main-lib/main.cpp b/src/main-lib/main.cpp
index 0ee799b2..6c2e7e67 100644
--- a/src/main-lib/main.cpp
+++ b/src/main-lib/main.cpp
@@ -325,7 +325,7 @@ void Main::parseSystemProperties(const QVariantMap &rawSystemProperties)
for (auto it = pri.cbegin(); it != pri.cend(); ++it)
m_systemProperties[SP_SystemUi].insert(it.key(), it.value());
- for (auto iface : qAsConst(m_startupPlugins))
+ for (auto iface : std::as_const(m_startupPlugins))
iface->initialize(m_systemProperties.at(SP_SystemUi));
}
@@ -377,10 +377,10 @@ void Main::setupRuntimesAndContainers(const QVariantMap &runtimeConfigurations,
ContainerFactory::instance()->registerContainer(new ProcessContainerManager());
#endif
auto containerPlugins = loadPlugins<ContainerManagerInterface>("container", containerPluginPaths);
- for (auto iface : qAsConst(containerPlugins))
+ for (auto iface : std::as_const(containerPlugins))
ContainerFactory::instance()->registerContainer(new PluginContainerManager(iface));
}
- for (auto iface : qAsConst(m_startupPlugins))
+ for (auto iface : std::as_const(m_startupPlugins))
iface->afterRuntimeRegistration();
ContainerFactory::instance()->setConfiguration(containerConfigurations);
@@ -710,7 +710,7 @@ void Main::setupWindowManager(const QString &waylandSocketName, const QVariantLi
void Main::loadQml(bool loadDummyData) Q_DECL_NOEXCEPT_EXPR(false)
{
- for (auto iface : qAsConst(m_startupPlugins))
+ for (auto iface : std::as_const(m_startupPlugins))
iface->beforeQmlEngineLoad(m_engine);
// protect our namespace from this point onward
@@ -732,7 +732,7 @@ void Main::loadQml(bool loadDummyData) Q_DECL_NOEXCEPT_EXPR(false)
if (Q_UNLIKELY(m_engine->rootObjects().isEmpty()))
throw Exception("Qml scene does not have a root object");
- for (auto iface : qAsConst(m_startupPlugins))
+ for (auto iface : std::as_const(m_startupPlugins))
iface->afterQmlEngineLoad(m_engine);
StartupTimer::instance()->checkpoint("after loading main QML file");
@@ -763,7 +763,7 @@ void Main::showWindow(bool showFullscreen)
m_engine->setIncubationController(window->incubationController());
}
- for (auto iface : qAsConst(m_startupPlugins))
+ for (auto iface : std::as_const(m_startupPlugins))
iface->beforeWindowShow(window);
if (!window) {
@@ -802,7 +802,7 @@ void Main::showWindow(bool showFullscreen)
// now check the surface format, in case we had requested a specific GL version/profile
checkOpenGLFormat("main window", window->format());
- for (auto iface : qAsConst(m_startupPlugins))
+ for (auto iface : std::as_const(m_startupPlugins))
iface->afterWindowShow(window);
StartupTimer::instance()->checkpoint("after window show");
@@ -891,7 +891,7 @@ void Main::registerDBusObject(QDBusAbstractAdaptor *adaptor, QString dbusName, c
static QStringList filesToDelete;
if (filesToDelete.isEmpty())
- atexit([]() { for (const QString &ftd : qAsConst(filesToDelete)) QFile::remove(ftd); });
+ atexit([]() { for (const QString &ftd : std::as_const(filesToDelete)) QFile::remove(ftd); });
filesToDelete << f.fileName();
}
}
diff --git a/src/manager-lib/applicationmanager.cpp b/src/manager-lib/applicationmanager.cpp
index c64e4761..2b345f57 100644
--- a/src/manager-lib/applicationmanager.cpp
+++ b/src/manager-lib/applicationmanager.cpp
@@ -344,7 +344,7 @@ ApplicationManagerPrivate::ApplicationManagerPrivate()
ApplicationManagerPrivate::~ApplicationManagerPrivate()
{
- for (const QString &scheme : qAsConst(registeredMimeSchemes))
+ for (const QString &scheme : std::as_const(registeredMimeSchemes))
QDesktopServices::unsetUrlHandler(scheme);
qDeleteAll(apps);
}
@@ -570,7 +570,7 @@ void ApplicationManager::registerMimeTypes()
QSet<QString> schemes;
schemes << qSL("file") << qSL("http") << qSL("https");
- for (Application *app : qAsConst(d->apps)) {
+ for (Application *app : std::as_const(d->apps)) {
const auto mimeTypes = app->supportedMimeTypes();
for (const QString &mime : mimeTypes) {
int pos = mime.indexOf(QLatin1Char('/'));
@@ -584,9 +584,9 @@ void ApplicationManager::registerMimeTypes()
QSet<QString> unregisterSchemes = d->registeredMimeSchemes;
unregisterSchemes.subtract(schemes);
- for (const QString &scheme : qAsConst(unregisterSchemes))
+ for (const QString &scheme : std::as_const(unregisterSchemes))
QDesktopServices::unsetUrlHandler(scheme);
- for (const QString &scheme : qAsConst(registerSchemes))
+ for (const QString &scheme : std::as_const(registerSchemes))
QDesktopServices::setUrlHandler(scheme, this, "openUrlRelay");
d->registeredMimeSchemes = schemes;
@@ -687,7 +687,7 @@ bool ApplicationManager::startApplicationInternal(const QString &appId, const QS
containerId = qSL("process");
} else {
// check config file
- for (const auto &it : qAsConst(d->containerSelectionConfig)) {
+ for (const auto &it : std::as_const(d->containerSelectionConfig)) {
const QString &key = it.first;
const QString &value = it.second;
bool hasAsterisk = key.contains(qL1C('*'));
@@ -945,7 +945,7 @@ void ApplicationManager::stopApplication(const QString &id, bool forceKill)
*/
void ApplicationManager::stopAllApplications(bool forceKill)
{
- for (Application *app : qAsConst(d->apps)) {
+ for (Application *app : std::as_const(d->apps)) {
AbstractRuntime *rt = app->currentRuntime();
if (rt)
rt->stop(forceKill);
@@ -1038,7 +1038,7 @@ bool ApplicationManager::openUrl(const QString &urlStr)
mimeTypeName,
QStringList()
};
- for (const auto &app : qAsConst(apps))
+ for (const auto &app : std::as_const(apps))
req.possibleAppIds << app->id();
d->openUrlRequests << req;
@@ -1179,7 +1179,7 @@ void ApplicationManager::shutDown()
auto shutdownHelper = [this]() {
bool activeRuntime = false;
- for (Application *app : qAsConst(d->apps)) {
+ for (Application *app : std::as_const(d->apps)) {
AbstractRuntime *rt = app->currentRuntime();
if (rt) {
activeRuntime = true;
@@ -1190,7 +1190,7 @@ void ApplicationManager::shutDown()
emit shutDownFinished();
};
- for (Application *app : qAsConst(d->apps)) {
+ for (Application *app : std::as_const(d->apps)) {
AbstractRuntime *rt = app->currentRuntime();
if (rt) {
connect(rt, &AbstractRuntime::destroyed,
@@ -1428,7 +1428,7 @@ void ApplicationManager::addApplication(ApplicationInfo *appInfo, Package *packa
{
// check for id clashes outside of the package (the scanner made sure the package itself is
// consistent and doesn't have duplicates already)
- for (Application *checkApp : qAsConst(d->apps)) {
+ for (Application *checkApp : std::as_const(d->apps)) {
if ((checkApp->id() == appInfo->id()) && (checkApp->package() != package)) {
throw Exception("found an application with the same id in package %1")
.arg(checkApp->packageInfo()->id());
diff --git a/src/manager-lib/intentaminterface.cpp b/src/manager-lib/intentaminterface.cpp
index 28bc19ae..267a6be9 100644
--- a/src/manager-lib/intentaminterface.cpp
+++ b/src/manager-lib/intentaminterface.cpp
@@ -340,7 +340,7 @@ void IntentServerIpcConnection::setReady(Application *application)
IntentServerIpcConnection *IntentServerIpcConnection::find(const QString &appId)
{
- for (auto ipcConnection : qAsConst(s_ipcConnections)) {
+ for (auto ipcConnection : std::as_const(s_ipcConnections)) {
if (ipcConnection->applicationId() == appId)
return ipcConnection;
}
@@ -457,7 +457,7 @@ IntentServerDBusIpcConnection *IntentServerDBusIpcConnection::find(QDBusConnecti
{
QString connectionName = connection.name();
- for (auto ipcConnection : qAsConst(s_ipcConnections)) {
+ for (auto ipcConnection : std::as_const(s_ipcConnections)) {
if (ipcConnection->isInProcess())
continue;
auto dbusIpcConnection = static_cast<IntentServerDBusIpcConnection *>(ipcConnection);
diff --git a/src/manager-lib/packagemanager.cpp b/src/manager-lib/packagemanager.cpp
index 4d5f05a3..8fba0c71 100644
--- a/src/manager-lib/packagemanager.cpp
+++ b/src/manager-lib/packagemanager.cpp
@@ -829,7 +829,7 @@ QVariantMap PackageManager::documentLocation() const
bool PackageManager::isPackageInstallationActive(const QString &packageId) const
{
- for (const auto *t : qAsConst(d->installationTaskList)) {
+ for (const auto *t : std::as_const(d->installationTaskList)) {
if (t->packageId() == packageId)
return true;
}
@@ -865,7 +865,7 @@ void PackageManager::cleanupBrokenInstallations() Q_DECL_NOEXCEPT_EXPR(false)
checkFiles << pkgDir + qSL("/.installation-report.yaml");
checkDirs << pkgDir;
- for (const QString &checkFile : qAsConst(checkFiles)) {
+ for (const QString &checkFile : std::as_const(checkFiles)) {
QFileInfo fi(checkFile);
if (!fi.exists() || !fi.isFile() || !fi.isReadable()) {
valid = false;
@@ -1201,7 +1201,7 @@ bool PackageManager::cancelTask(const QString &taskId)
#if !defined(AM_DISABLE_INSTALLER)
if (!d->disableInstaller) {
// incoming tasks can be forcefully canceled right away
- for (AsynchronousTask *task : qAsConst(d->incomingTaskList)) {
+ for (AsynchronousTask *task : std::as_const(d->incomingTaskList)) {
if (task->id() == taskId) {
task->forceCancel();
task->deleteLater();
@@ -1219,7 +1219,7 @@ bool PackageManager::cancelTask(const QString &taskId)
if (d->activeTask && d->activeTask->id() == taskId)
return d->activeTask->cancel();
- for (AsynchronousTask *task : qAsConst(d->installationTaskList)) {
+ for (AsynchronousTask *task : std::as_const(d->installationTaskList)) {
if (task->id() == taskId)
return task->cancel();
}
diff --git a/src/manager-lib/processcontainer.cpp b/src/manager-lib/processcontainer.cpp
index 7041b7ac..b0d53dd8 100644
--- a/src/manager-lib/processcontainer.cpp
+++ b/src/manager-lib/processcontainer.cpp
@@ -120,7 +120,7 @@ void HostProcess::setStdioRedirections(QVector<int> &&stdioRedirections)
#if defined(Q_OS_UNIX)
// make sure that the redirection fds do not have a close-on-exec flag, since we need them
// in the child process.
- for (int fd : qAsConst(m_stdioRedirections)) {
+ for (int fd : std::as_const(m_stdioRedirections)) {
if (fd < 0)
continue;
int flags = fcntl(fd, F_GETFD);
diff --git a/src/manager-lib/quicklauncher.cpp b/src/manager-lib/quicklauncher.cpp
index 97e6aa26..50a13921 100644
--- a/src/manager-lib/quicklauncher.cpp
+++ b/src/manager-lib/quicklauncher.cpp
@@ -222,7 +222,7 @@ void QuickLauncher::shutDown()
bool waitForRemove = false;
for (auto entry = m_quickLaunchPool.begin(); entry != m_quickLaunchPool.end(); ++entry) {
- for (const auto &car : qAsConst(entry->m_containersAndRuntimes)) {
+ for (const auto &car : std::as_const(entry->m_containersAndRuntimes)) {
if (car.second)
car.second->stop();
else if (car.first)
diff --git a/src/monitor-lib/systemreader.cpp b/src/monitor-lib/systemreader.cpp
index 23f2d9e7..6db7891b 100644
--- a/src/monitor-lib/systemreader.cpp
+++ b/src/monitor-lib/systemreader.cpp
@@ -446,7 +446,7 @@ bool MemoryThreshold::setEnabled(bool enabled, const QString &groupPath, MemoryR
if (m_controlFd >= 0) {
bool registerOk = true;
- for (qreal percent : qAsConst(m_thresholds)) {
+ for (qreal percent : std::as_const(m_thresholds)) {
quint64 mem = quint64(limit * percent) / 100;
registerOk = registerOk && (dprintf(m_controlFd, "%d %d %llu", m_eventFd, m_usageFd, mem) > 0);
}
diff --git a/src/package-lib/packagecreator.cpp b/src/package-lib/packagecreator.cpp
index c9257970..2125b131 100644
--- a/src/package-lib/packagecreator.cpp
+++ b/src/package-lib/packagecreator.cpp
@@ -197,7 +197,7 @@ bool PackageCreatorPrivate::create()
// Calculate the total size first, so we can report progress later on
qint64 allFilesSize = 0;
- for (const QString &file : qAsConst(allFiles)) {
+ for (const QString &file : std::as_const(allFiles)) {
QFileInfo fi(m_sourcePath + file);
if (!fi.exists())
@@ -210,7 +210,7 @@ bool PackageCreatorPrivate::create()
// Iterate over all files in the report
- for (const QString &file : qAsConst(allFiles)) {
+ for (const QString &file : std::as_const(allFiles)) {
if (q->wasCanceled())
throw Exception(Error::Canceled);
diff --git a/src/tools/controller/controller.cpp b/src/tools/controller/controller.cpp
index 72a820fc..f915e5ec 100644
--- a/src/tools/controller/controller.cpp
+++ b/src/tools/controller/controller.cpp
@@ -889,7 +889,7 @@ void cancelInstallationTask(bool all, const QString &taskId) Q_DECL_NOEXCEPT_EXP
}
});
- for (const auto &cancelTaskId : qAsConst(cancelTaskIds)) {
+ for (const auto &cancelTaskId : std::as_const(cancelTaskIds)) {
fprintf(stdout, "Canceling installation task %s...\n", qPrintable(cancelTaskId));
// cancel the task
diff --git a/src/tools/dumpqmltypes/dumpqmltypes.cpp b/src/tools/dumpqmltypes/dumpqmltypes.cpp
index 80b0a28d..e8ec8e0e 100644
--- a/src/tools/dumpqmltypes/dumpqmltypes.cpp
+++ b/src/tools/dumpqmltypes/dumpqmltypes.cpp
@@ -385,7 +385,7 @@ int main(int argc, char **argv)
QByteArray::number(QLibraryInfo::version().minorVersion()));
auto mos = imports.values(*it);
- for (const auto &mo : qAsConst(mos))
+ for (const auto &mo : std::as_const(mos))
typesOut << qmlTypeForMetaObect(mo, 1, true);
typesOut << footer;
diff --git a/src/tools/launcher-qml/launcher-qml.cpp b/src/tools/launcher-qml/launcher-qml.cpp
index e7eaf1bf..351ec7f8 100644
--- a/src/tools/launcher-qml/launcher-qml.cpp
+++ b/src/tools/launcher-qml/launcher-qml.cpp
@@ -423,7 +423,7 @@ void Controller::startApplication(const QString &baseDir, const QString &qmlFile
QCoreApplication::exit(2);
return;
}
- for (StartupInterface *iface : qAsConst(startupPlugins))
+ for (StartupInterface *iface : std::as_const(startupPlugins))
iface->initialize(m_applicationInterface ? m_applicationInterface->systemProperties() : QVariantMap());
bool loadDummyData = runtimeParameters.value(qSL("loadDummyData")).toBool()
@@ -463,7 +463,7 @@ void Controller::startApplication(const QString &baseDir, const QString &qmlFile
}
qCDebug(LogQmlRuntime) << "Qml import paths:" << m_engine.importPathList();
- for (StartupInterface *iface : qAsConst(startupPlugins))
+ for (StartupInterface *iface : std::as_const(startupPlugins))
iface->beforeQmlEngineLoad(&m_engine);
StartupTimer::instance()->checkpoint("after loading plugins and import paths");
@@ -487,7 +487,7 @@ void Controller::startApplication(const QString &baseDir, const QString &qmlFile
return;
}
- for (StartupInterface *iface : qAsConst(startupPlugins))
+ for (StartupInterface *iface : std::as_const(startupPlugins))
iface->afterQmlEngineLoad(&m_engine);
bool createStartupReportNow = true;
@@ -528,7 +528,7 @@ void Controller::startApplication(const QString &baseDir, const QString &qmlFile
st->checkFirstFrame();
st->createAutomaticReport(applicationId);
- for (StartupInterface *iface : qAsConst(startupPlugins))
+ for (StartupInterface *iface : std::as_const(startupPlugins))
iface->afterWindowShow(m_window);
}
});
@@ -542,7 +542,7 @@ void Controller::startApplication(const QString &baseDir, const QString &qmlFile
}
// needed, even though we do not explicitly show() the window any more
- for (StartupInterface *iface : qAsConst(startupPlugins))
+ for (StartupInterface *iface : std::as_const(startupPlugins))
iface->beforeWindowShow(m_window);
qCDebug(LogQmlRuntime) << "component loading and creating complete.";
diff --git a/src/tools/packager/packagingjob.cpp b/src/tools/packager/packagingjob.cpp
index cd312302..3462325c 100644
--- a/src/tools/packager/packagingjob.cpp
+++ b/src/tools/packager/packagingjob.cpp
@@ -240,7 +240,7 @@ void PackagingJob::execute() Q_DECL_NOEXCEPT_EXPR(false)
// read certificates
QList<QByteArray> certificates;
- for (const QString &cert : qAsConst(m_certificateFiles)) {
+ for (const QString &cert : std::as_const(m_certificateFiles)) {
QFile cf(cert);
if (!cf.open(QIODevice::ReadOnly))
throw Exception(cf, "could not open certificate file");
diff --git a/src/window-lib/windowmanager.cpp b/src/window-lib/windowmanager.cpp
index 97edc198..907f314a 100644
--- a/src/window-lib/windowmanager.cpp
+++ b/src/window-lib/windowmanager.cpp
@@ -974,7 +974,7 @@ bool WindowManager::makeScreenshot(const QString &filename, const QString &selec
auto grabbers = new QList<QSharedPointer<const QQuickItemGrabResult>>;
- for (const Window *w : qAsConst(d->windowsInModel)) {
+ for (const Window *w : std::as_const(d->windowsInModel)) {
if (apps.contains(w->application())) {
if (attributeName.isEmpty()
|| (w->windowProperty(attributeName).toString() == attributeValue)) {
diff --git a/tests/auto/configuration/tst_configuration.cpp b/tests/auto/configuration/tst_configuration.cpp
index 2c34c211..56eed174 100644
--- a/tests/auto/configuration/tst_configuration.cpp
+++ b/tests/auto/configuration/tst_configuration.cpp
@@ -423,7 +423,7 @@ void tst_Configuration::commandLineConfig()
<< "main-cl.qml";
QStringList strCommandLine;
- for (const auto &c : qAsConst(commandLine))
+ for (const auto &c : std::as_const(commandLine))
strCommandLine << QString::fromLatin1(c);
c.parseWithArguments(strCommandLine);
diff --git a/tests/auto/debugwrapper/tst_debugwrapper.cpp b/tests/auto/debugwrapper/tst_debugwrapper.cpp
index 7798a748..769ebd3e 100644
--- a/tests/auto/debugwrapper/tst_debugwrapper.cpp
+++ b/tests/auto/debugwrapper/tst_debugwrapper.cpp
@@ -87,7 +87,7 @@ void tst_DebugWrapper::specification()
for (auto it = env.cbegin(); it != env.cend(); ++it)
strEnv.insert(QString::fromLatin1(it.key()), QString::fromLatin1(it.value()));
- for (const auto &c : qAsConst(cmd))
+ for (const auto &c : std::as_const(cmd))
strCmd << QString::fromLatin1(c);
QCOMPARE(DebugWrapper::parseSpecification(spec, resultCmd, resultEnv), valid);
@@ -127,11 +127,11 @@ void tst_DebugWrapper::substitute()
QFETCH(QByteArrayList, result);
QStringList strCmd, strArguments, strResult;
- for (const auto &c : qAsConst(cmd))
+ for (const auto &c : std::as_const(cmd))
strCmd << QString::fromLatin1(c);
- for (const auto &a : qAsConst(arguments))
+ for (const auto &a : std::as_const(arguments))
strArguments << QString::fromLatin1(a);
- for (const auto &r : qAsConst(result))
+ for (const auto &r : std::as_const(result))
strResult << QString::fromLatin1(r);
QCOMPARE(DebugWrapper::substituteCommand(strCmd, program, strArguments), strResult);
diff --git a/tests/auto/packagecreator/tst_packagecreator.cpp b/tests/auto/packagecreator/tst_packagecreator.cpp
index 50eda7f5..304d883e 100644
--- a/tests/auto/packagecreator/tst_packagecreator.cpp
+++ b/tests/auto/packagecreator/tst_packagecreator.cpp
@@ -123,7 +123,7 @@ void tst_PackageCreator::createAndVerify()
// check the contents of the files
- for (const QString &file : qAsConst(files)) {
+ for (const QString &file : std::as_const(files)) {
QFile src(m_baseDir.absoluteFilePath(file));
QVERIFY2(src.open(QFile::ReadOnly), qPrintable(src.errorString()));
QByteArray data = src.readAll();