diff options
author | jasplin <qt-info@nokia.com> | 2009-04-20 12:24:08 (GMT) |
---|---|---|
committer | jasplin <qt-info@nokia.com> | 2009-04-20 13:02:05 (GMT) |
commit | 031adeaf42ddaef8d01338f6c59ba97170be5d53 (patch) | |
tree | e6eb11ed75e2d9015f51000c138399593c6a4af9 /src/gui/kernel/qshortcutmap.cpp | |
parent | beb6912526766edd7e8a9f9876d82272f798dbc3 (diff) | |
download | Qt-031adeaf42ddaef8d01338f6c59ba97170be5d53.zip Qt-031adeaf42ddaef8d01338f6c59ba97170be5d53.tar.gz Qt-031adeaf42ddaef8d01338f6c59ba97170be5d53.tar.bz2 |
Fixed key sequence eating behavior for QShortcut and QAction.
A disabled QShortcut should eat its key sequence even for complex
sequences like "Ctrl-E 1". For example, a line edit with such a
shortcut should not display 1 after typing "Ctrl-E" and then "1".
The patch achieves this essentially by moving more of the
decision making (of whether to eat the key secuence) from
shortcutmap.cpp to qhortcut.cpp.
Moreover, an invisible QAction should not eat any of its key sequences
(primary nor alternates). In the example above, the line edit
would display 1 when typing this sequence for an invisible action.
The patch achieves this by temporarily unregistering all of the
action's shortcuts while the action is invisible.
Reviewed-by: mariusSO
Task-number: 251246
Diffstat (limited to 'src/gui/kernel/qshortcutmap.cpp')
-rw-r--r-- | src/gui/kernel/qshortcutmap.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp index ed9654b..9766a69 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/gui/kernel/qshortcutmap.cpp @@ -370,9 +370,8 @@ bool QShortcutMap::tryShortcutEvent(QObject *o, QKeyEvent *e) default: break; } - // If nextState is QKeySequence::ExactMatch && identicals.count == 0 - // we've only found disabled shortcuts - return identicalMatches > 0 || result == QKeySequence::PartialMatch; + + return true; } /*! \internal @@ -494,9 +493,7 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e) // We don't need partials, if we have identicals if (d->identicals.size()) break; - // We only care about enabled partials, so we don't consume - // key events when all partials are disabled! - partialFound |= (*it).enabled; + partialFound = true; } } ++it; |