aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2023-02-06 20:03:11 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-02-08 15:44:54 +0000
commitae3b9f7be4e0ff901e65d9202c81686c96e6d7f1 (patch)
treeeeadeee33b5bdf2fb84e9cc11ceec3c32e1a3ceb
parent6d3d55bec41545be6d2be3f09f4482c9d72357aa (diff)
Do not allow empty selections (shadow input control)
The same change was applied to qtbase qplatforminputcontext.cpp in commit 626b33dca1dc0d95e80bf139c197fbb13d740277: Allowing empty selections leads to strange behavior, it switches from selection handles to cursor handle. Change-Id: Ied653085d8870350ee117f1b6531a3b0d678dd05 Reviewed-by: Inho Lee <inho.lee@qt.io> (cherry picked from commit fb39d842d929a6a8562113dfb4747ad0dc4ec434) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/virtualkeyboard/shadowinputcontext.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/virtualkeyboard/shadowinputcontext.cpp b/src/virtualkeyboard/shadowinputcontext.cpp
index 808cb8b0..c7a5387c 100644
--- a/src/virtualkeyboard/shadowinputcontext.cpp
+++ b/src/virtualkeyboard/shadowinputcontext.cpp
@@ -106,6 +106,8 @@ void ShadowInputContext::setSelectionOnFocusObject(const QPointF &anchorPos, con
if (success) {
int cursor = queryFocusObject(Qt::ImCursorPosition, quickItem ? quickItem->mapFromScene(cursorPos) : cursorPos).toInt(&success);
if (success) {
+ if (anchor == cursor && anchorPos != cursorPos)
+ return;
QList<QInputMethodEvent::Attribute> imAttributes;
imAttributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, anchor, cursor - anchor, QVariant()));
QInputMethodEvent event(QString(), imAttributes);