From 168b18de2d1429dc4f8c8db538c0a2cf3141c694 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 20 Jun 2019 12:52:15 +0200 Subject: QtWidgets: Preparatory change for moving out QAction (or parts of it) - Fix some spelling - Use QT_CONFIG for shortcuts - Quick C++ brush up, use member initialization Preemptively fix sanity bot warnings about missing space after flow control keyword, introducing range-based for on this occasion - Remove unused member variable Task-number: QTBUG-69478 Change-Id: I6af21886d5a0b48f4b2d11082991a877bd8d817d Reviewed-by: Oliver Wolff --- src/widgets/kernel/qactiongroup.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/widgets/kernel/qactiongroup.cpp') diff --git a/src/widgets/kernel/qactiongroup.cpp b/src/widgets/kernel/qactiongroup.cpp index ab42b1c7aa..1d9213de0c 100644 --- a/src/widgets/kernel/qactiongroup.cpp +++ b/src/widgets/kernel/qactiongroup.cpp @@ -42,7 +42,6 @@ #ifndef QT_NO_ACTION #include "qaction_p.h" -#include "qapplication.h" #include "qevent.h" #include "qlist.h" @@ -73,7 +72,7 @@ void QActionGroupPrivate::_q_actionChanged() { Q_Q(QActionGroup); QAction *action = qobject_cast(q->sender()); - Q_ASSERT_X(action != 0, "QWidgetGroup::_q_actionChanged", "internal error"); + Q_ASSERT_X(action != nullptr, "QActionGroup::_q_actionChanged", "internal error"); if (exclusionPolicy != QActionGroup::ExclusionPolicy::None) { if (action->isChecked()) { if (action != current) { @@ -91,7 +90,7 @@ void QActionGroupPrivate::_q_actionTriggered() { Q_Q(QActionGroup); QAction *action = qobject_cast(q->sender()); - Q_ASSERT_X(action != 0, "QWidgetGroup::_q_actionTriggered", "internal error"); + Q_ASSERT_X(action != nullptr, "QActionGroup::_q_actionTriggered", "internal error"); emit q->triggered(action); } @@ -99,7 +98,7 @@ void QActionGroupPrivate::_q_actionHovered() { Q_Q(QActionGroup); QAction *action = qobject_cast(q->sender()); - Q_ASSERT_X(action != 0, "QWidgetGroup::_q_actionHovered", "internal error"); + Q_ASSERT_X(action != nullptr, "QActionGroup::_q_actionHovered", "internal error"); emit q->hovered(action); } @@ -363,10 +362,10 @@ void QActionGroup::setEnabled(bool b) { Q_D(QActionGroup); d->enabled = b; - for(QList::const_iterator it = d->actions.constBegin(); it != d->actions.constEnd(); ++it) { - if(!(*it)->d_func()->forceDisabled) { - (*it)->setEnabled(b); - (*it)->d_func()->forceDisabled = false; + for (auto action : qAsConst(d->actions)) { + if (!action->d_func()->forceDisabled) { + action->setEnabled(b); + action->d_func()->forceDisabled = false; } } } @@ -400,10 +399,10 @@ void QActionGroup::setVisible(bool b) { Q_D(QActionGroup); d->visible = b; - for(QList::Iterator it = d->actions.begin(); it != d->actions.end(); ++it) { - if(!(*it)->d_func()->forceInvisible) { - (*it)->setVisible(b); - (*it)->d_func()->forceInvisible = false; + for (auto action : qAsConst(d->actions)) { + if (!action->d_func()->forceInvisible) { + action->setVisible(b); + action->d_func()->forceInvisible = false; } } } -- cgit v1.2.3