aboutsummaryrefslogtreecommitdiffstats
path: root/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp')
-rw-r--r--src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp b/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp
index a7c0aad9..385be912 100644
--- a/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp
+++ b/src/virtualkeyboard/qvirtualkeyboardinputcontext_p.cpp
@@ -505,6 +505,7 @@ bool QVirtualKeyboardInputContextPrivate::filterEvent(const QEvent *event)
QEvent::Type type = event->type();
if (type == QEvent::KeyPress || type == QEvent::KeyRelease) {
const QKeyEvent *keyEvent = static_cast<const QKeyEvent *>(event);
+ const int key = keyEvent->key();
// Keep track of pressed keys update key event state
if (type == QEvent::KeyPress)
@@ -518,7 +519,6 @@ bool QVirtualKeyboardInputContextPrivate::filterEvent(const QEvent *event)
setState(State::KeyEvent);
#ifdef QT_VIRTUALKEYBOARD_ARROW_KEY_NAVIGATION
- int key = keyEvent->key();
if ((key >= Qt::Key_Left && key <= Qt::Key_Down) || key == Qt::Key_Return) {
if (type == QEvent::KeyPress && platformInputContext->isInputPanelVisible()) {
activeNavigationKeys += key;
@@ -533,8 +533,16 @@ bool QVirtualKeyboardInputContextPrivate::filterEvent(const QEvent *event)
#endif
// Break composing text since the virtual keyboard does not support hard keyboard events
- if (!preeditText.isEmpty())
- commit();
+ if (!preeditText.isEmpty()) {
+ if (type == QEvent::KeyPress && (key == Qt::Key_Delete || key == Qt::Key_Backspace)) {
+ reset();
+ Q_Q(QVirtualKeyboardInputContext);
+ q->clear();
+ return true;
+ } else {
+ commit();
+ }
+ }
}
#ifdef QT_VIRTUALKEYBOARD_ARROW_KEY_NAVIGATION
else if (type == QEvent::ShortcutOverride) {