diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-20 12:52:15 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-28 00:24:28 +0200 |
commit | 168b18de2d1429dc4f8c8db538c0a2cf3141c694 (patch) | |
tree | c8682182d57880334b1d7aa7ab98daab87e68222 /src/widgets/kernel/qactiongroup.cpp | |
parent | 6007120aa4391fa53acd774a451530c6561a1658 (diff) |
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 <oliver.wolff@qt.io>
Diffstat (limited to 'src/widgets/kernel/qactiongroup.cpp')
-rw-r--r-- | src/widgets/kernel/qactiongroup.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
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<QAction*>(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<QAction*>(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<QAction*>(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<QAction*>::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<QAction*>::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; } } } |