diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-10-21 18:15:45 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-10-26 09:03:46 +0200 |
commit | a818d49aa58c7ff871f89f7db4b1234402092994 (patch) | |
tree | d2705d2a3ce8536e578e59768129ecf1254f240c /src/quick/items/qquicktextinput.cpp | |
parent | 9e000eab707f29eba65f6e9e1e5993cda51cb566 (diff) |
Propagate ShortcutOverride events up the parent chain
As with key events, ShortcutOverride events have to propagate up the
parent chain so that parent items can override shortcuts with their own
key handling.
For that to work, items that implement shortcutOverride but don't handle
the event must explicitly ignore it, as the events, like all input
events are accepted by default.
This revealed that QQuickTextEdit (via QQuickTextControl) and
QQuickTextInput did not correclty ignore unhandled shortcut overrides,
so fix those implementations. As a drive-by, explicitly capture the
event parameter in the QML test's signal handler.
Task-number: QTBUG-107703
Pick-to: 6.4
Change-Id: If38469c000733f53f5f936de38869b3b6f9fb07a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/quick/items/qquicktextinput.cpp')
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index af440d7bf7..f944cfe7d7 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -1692,8 +1692,10 @@ bool QQuickTextInput::event(QEvent* ev) #if QT_CONFIG(shortcut) Q_D(QQuickTextInput); if (ev->type() == QEvent::ShortcutOverride) { - if (d->m_readOnly) + if (d->m_readOnly) { + ev->ignore(); return false; + } QKeyEvent* ke = static_cast<QKeyEvent*>(ev); if (ke == QKeySequence::Copy || ke == QKeySequence::Paste @@ -1736,6 +1738,7 @@ bool QQuickTextInput::event(QEvent* ev) } } } + ev->ignore(); } #endif |