diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2023-02-06 20:03:11 +0200 |
---|---|---|
committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2023-02-08 16:14:49 +0200 |
commit | fb39d842d929a6a8562113dfb4747ad0dc4ec434 (patch) | |
tree | 80cc640e9884b379dbeaae3c4417be61568a6a8d /src/virtualkeyboard/shadowinputcontext.cpp | |
parent | e9c701803dffe52fd9ac65c8657950213d948ebe (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.
Pick-to: 6.5 6.4
Change-Id: Ied653085d8870350ee117f1b6531a3b0d678dd05
Reviewed-by: Inho Lee <inho.lee@qt.io>
Diffstat (limited to 'src/virtualkeyboard/shadowinputcontext.cpp')
-rw-r--r-- | src/virtualkeyboard/shadowinputcontext.cpp | 2 |
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); |