Libs: Use qAsConst with non-const Qt containers in range-loops

Change-Id: I00d9f7c1634bbb62191470d58158e1fd150533c0
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Alessandro Portale
2021-02-16 15:01:44 +01:00
parent 72d91dc94a
commit 97a45f7512
13 changed files with 30 additions and 31 deletions

View File

@@ -247,7 +247,7 @@ namespace ADS
// function are invisible to the user now and have no assigned dock area
// They do not belong to any dock container, until the user toggles the
// toggle view action the next time
for (auto dockWidget : m_dockWidgetsMap) {
for (auto dockWidget : qAsConst(m_dockWidgetsMap)) {
if (dockWidget->property(internal::dirtyProperty).toBool()) {
dockWidget->flagAsUnassigned();
emit dockWidget->viewToggled(false);
@@ -264,7 +264,7 @@ namespace ADS
// The dock areas because the previous toggleView() action has changed
// the dock area index
int count = 0;
for (auto dockContainer : m_containers) {
for (auto dockContainer : qAsConst(m_containers)) {
count++;
for (int i = 0; i < dockContainer->dockAreaCount(); ++i) {
DockAreaWidget *dockArea = dockContainer->dockArea(i);
@@ -290,7 +290,7 @@ namespace ADS
{
// Finally we need to send the topLevelChanged() signals for all dock
// widgets if top level changed
for (auto dockContainer : m_containers) {
for (auto dockContainer : qAsConst(m_containers)) {
DockWidget *topLevelDockWidget = dockContainer->topLevelDockWidget();
if (topLevelDockWidget) {
topLevelDockWidget->emitTopLevelChanged(true);
@@ -357,7 +357,7 @@ namespace ADS
save();
saveStartupWorkspace();
for (auto floatingWidget : d->m_floatingWidgets) {
for (auto floatingWidget : qAsConst(d->m_floatingWidgets)) {
/* There have been crashes with partially destructed widgets in
m_floatingWidgets. Those do not have a parent. */
if (floatingWidget && floatingWidget->parent() == this)
@@ -507,7 +507,7 @@ namespace ADS
stream.writeAttribute("version", QString::number(CurrentVersion));
stream.writeAttribute("userVersion", QString::number(version));
stream.writeAttribute("containers", QString::number(d->m_containers.count()));
for (auto container : d->m_containers)
for (auto container : qAsConst(d->m_containers))
container->saveState(stream);
stream.writeEndElement();
@@ -551,7 +551,7 @@ namespace ADS
if (d->m_uninitializedFloatingWidgets.empty())
return;
for (auto floatingWidget : d->m_uninitializedFloatingWidgets)
for (auto floatingWidget : qAsConst(d->m_uninitializedFloatingWidgets))
floatingWidget->show();
d->m_uninitializedFloatingWidgets.clear();