summaryrefslogtreecommitdiffstats
path: root/src/gui/statemachine/qbasickeyeventtransition.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-04-29 08:54:10 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-04-29 08:54:10 (GMT)
commit58b74319a639cb471cdec92c0e8a054fc6d4d5f5 (patch)
tree6d6bd21ff8c53636cc51eb8a1d17eb2fd00ebed9 /src/gui/statemachine/qbasickeyeventtransition.cpp
parentf39a905bc75e7ce95294f3584ea8a400ab383861 (diff)
downloadQt-58b74319a639cb471cdec92c0e8a054fc6d4d5f5.zip
Qt-58b74319a639cb471cdec92c0e8a054fc6d4d5f5.tar.gz
Qt-58b74319a639cb471cdec92c0e8a054fc6d4d5f5.tar.bz2
modifiers --> modifiersMask
Result of API review. A == comparison of the modifiers is not useful. The common case is you want to test if one or more modifiers are set, i.e. a mask check.
Diffstat (limited to 'src/gui/statemachine/qbasickeyeventtransition.cpp')
-rw-r--r--src/gui/statemachine/qbasickeyeventtransition.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/gui/statemachine/qbasickeyeventtransition.cpp b/src/gui/statemachine/qbasickeyeventtransition.cpp
index 2ce428c..4e3fa11 100644
--- a/src/gui/statemachine/qbasickeyeventtransition.cpp
+++ b/src/gui/statemachine/qbasickeyeventtransition.cpp
@@ -39,14 +39,14 @@ public:
QEvent::Type eventType;
int key;
- Qt::KeyboardModifiers modifiers;
+ Qt::KeyboardModifiers modifiersMask;
};
QBasicKeyEventTransitionPrivate::QBasicKeyEventTransitionPrivate()
{
eventType = QEvent::None;
key = 0;
- modifiers = Qt::NoModifier;
+ modifiersMask = Qt::NoModifier;
}
QBasicKeyEventTransitionPrivate *QBasicKeyEventTransitionPrivate::get(QBasicKeyEventTransition *q)
@@ -77,17 +77,17 @@ QBasicKeyEventTransition::QBasicKeyEventTransition(QEvent::Type type, int key,
/*!
Constructs a new event transition for events of the given \a type for the
- given \a key, with the given \a modifiers and \a sourceState.
+ given \a key, with the given \a modifiersMask and \a sourceState.
*/
QBasicKeyEventTransition::QBasicKeyEventTransition(QEvent::Type type, int key,
- Qt::KeyboardModifiers modifiers,
+ Qt::KeyboardModifiers modifiersMask,
QState *sourceState)
: QAbstractTransition(*new QBasicKeyEventTransitionPrivate, sourceState)
{
Q_D(QBasicKeyEventTransition);
d->eventType = type;
d->key = key;
- d->modifiers = modifiers;
+ d->modifiersMask = modifiersMask;
}
/*!
@@ -134,21 +134,23 @@ void QBasicKeyEventTransition::setKey(int key)
}
/*!
- Returns the keyboard modifiers that this key event transition checks for.
+ Returns the keyboard modifiers mask that this key event transition checks
+ for.
*/
-Qt::KeyboardModifiers QBasicKeyEventTransition::modifiers() const
+Qt::KeyboardModifiers QBasicKeyEventTransition::modifiersMask() const
{
Q_D(const QBasicKeyEventTransition);
- return d->modifiers;
+ return d->modifiersMask;
}
/*!
- Sets the keyboard modifiers that this key event transition will check for.
+ Sets the keyboard modifiers mask that this key event transition will check
+ for.
*/
-void QBasicKeyEventTransition::setModifiers(Qt::KeyboardModifiers modifiers)
+void QBasicKeyEventTransition::setModifiersMask(Qt::KeyboardModifiers modifiersMask)
{
Q_D(QBasicKeyEventTransition);
- d->modifiers = modifiers;
+ d->modifiersMask = modifiersMask;
}
/*!
@@ -159,7 +161,8 @@ bool QBasicKeyEventTransition::eventTest(QEvent *event) const
Q_D(const QBasicKeyEventTransition);
if (event->type() == d->eventType) {
QKeyEvent *ke = static_cast<QKeyEvent*>(event);
- return (ke->key() == d->key) && (ke->modifiers() == d->modifiers);
+ return (ke->key() == d->key)
+ && ((ke->modifiers() & d->modifiersMask) == d->modifiersMask);
}
return false;
}