summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qaction.cpp
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-06-10 10:54:53 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-06-10 10:55:33 (GMT)
commit8179a9e2cd52b24c70b194106dd170ed1bb677e4 (patch)
tree7284c59d7a89ab54612a4bc098a8929050c3e184 /src/gui/kernel/qaction.cpp
parentf2c4d2fe8a846cfce457512ef1806a7276745590 (diff)
downloadQt-8179a9e2cd52b24c70b194106dd170ed1bb677e4.zip
Qt-8179a9e2cd52b24c70b194106dd170ed1bb677e4.tar.gz
Qt-8179a9e2cd52b24c70b194106dd170ed1bb677e4.tar.bz2
small code cleanup that improves some loops
it uses les foreach
Diffstat (limited to 'src/gui/kernel/qaction.cpp')
-rw-r--r--src/gui/kernel/qaction.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp
index 051b6a6..f44d207 100644
--- a/src/gui/kernel/qaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -136,25 +136,31 @@ void QActionPrivate::redoGrab(QShortcutMap &map)
void QActionPrivate::redoGrabAlternate(QShortcutMap &map)
{
Q_Q(QAction);
- foreach (int id, alternateShortcutIds)
- if (id)
+ for(int i = 0; i < alternateShortcutIds.count(); ++i) {
+ if (const int id = alternateShortcutIds.at(i))
map.removeShortcut(id, q);
+ }
alternateShortcutIds.clear();
if (alternateShortcuts.isEmpty())
return;
- foreach (const QKeySequence& alternate, alternateShortcuts) {
+ for(int i = 0; i < alternateShortcuts.count(); ++i) {
+ const QKeySequence& alternate = alternateShortcuts.at(i);
if (!alternate.isEmpty())
alternateShortcutIds.append(map.addShortcut(q, alternate, shortcutContext));
else
alternateShortcutIds.append(0);
}
if (!enabled) {
- foreach (int id, alternateShortcutIds)
+ for(int i = 0; i < alternateShortcutIds.count(); ++i) {
+ const int id = alternateShortcutIds.at(i);
map.setShortcutEnabled(false, id, q);
+ }
}
if (!autorepeat) {
- foreach (int id, alternateShortcutIds)
+ for(int i = 0; i < alternateShortcutIds.count(); ++i) {
+ const int id = alternateShortcutIds.at(i);
map.setShortcutAutoRepeat(false, id, q);
+ }
}
}
@@ -163,9 +169,10 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
Q_Q(QAction);
if (shortcutId)
map.setShortcutEnabled(enable, shortcutId, q);
- foreach (int id, alternateShortcutIds)
- if (id)
+ for(int i = 0; i < alternateShortcutIds.count(); ++i) {
+ if (const int id = alternateShortcutIds.at(i))
map.setShortcutEnabled(enable, id, q);
+ }
}
#endif // QT_NO_SHORTCUT
@@ -615,8 +622,10 @@ QAction::~QAction()
#ifndef QT_NO_SHORTCUT
if (d->shortcutId && qApp) {
qApp->d_func()->shortcutMap.removeShortcut(d->shortcutId, this);
- foreach (int id, d->alternateShortcutIds)
+ for(int i = 0; i < d->alternateShortcutIds.count(); ++i) {
+ const int id = d->alternateShortcutIds.at(i);
qApp->d_func()->shortcutMap.removeShortcut(id, this);
+ }
}
#endif
}