CorePlugin: Remove foreach / Q_FOREACH usage

Task-number: QTCREATORBUG-27464
Change-Id: I0d0257bbd46f3eec9b11b386d1987156e83a9dac
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Artem Sokolovskii
2022-05-02 11:22:55 +02:00
parent 71b84417b3
commit 54628488a4
14 changed files with 38 additions and 35 deletions

View File

@@ -351,7 +351,7 @@ Command *ActionContainerPrivate::addSeparator(const Context &context, Id group,
void ActionContainerPrivate::clear()
{
for (Group &group : m_groups) {
foreach (QObject *item, group.items) {
for (QObject *item : qAsConst(group.items)) {
if (auto command = qobject_cast<Command *>(item)) {
removeAction(command);
disconnect(command, &Command::activeStateChanged,
@@ -482,7 +482,7 @@ bool MenuActionContainer::updateInternal()
QList<QAction *> actions = m_menu->actions();
for (const Group &group : qAsConst(m_groups)) {
foreach (QObject *item, group.items) {
for (QObject *item : qAsConst(group.items)) {
if (auto container = qobject_cast<ActionContainerPrivate*>(item)) {
actions.removeAll(container->menu()->menuAction());
if (container == this) {
@@ -512,7 +512,7 @@ bool MenuActionContainer::updateInternal()
}
if (!hasitems) {
// look if there were actions added that we don't control and check if they are enabled
foreach (const QAction *action, actions) {
for (const QAction *action : qAsConst(actions)) {
if (!action->isSeparator() && action->isEnabled()) {
hasitems = true;
break;