Do not allow empty selections
Allowing empty selections leads to strange behavior, it switches from selection handles to cursor handle. Change-Id: Ida69346e2a47b13c92cfd68a555d6b94422bb580 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
6b1ecb1904
commit
626b33dca1
@ -287,6 +287,8 @@ void QPlatformInputContext::setSelectionOnFocusObject(const QPointF &anchorPos,
|
|||||||
if (success) {
|
if (success) {
|
||||||
int cursor = QInputMethod::queryFocusObject(Qt::ImCursorPosition, cursorPos * mapToLocal).toInt(&success);
|
int cursor = QInputMethod::queryFocusObject(Qt::ImCursorPosition, cursorPos * mapToLocal).toInt(&success);
|
||||||
if (success) {
|
if (success) {
|
||||||
|
if (anchor == cursor && anchorPos != cursorPos)
|
||||||
|
return;
|
||||||
QList<QInputMethodEvent::Attribute> imAttributes;
|
QList<QInputMethodEvent::Attribute> imAttributes;
|
||||||
imAttributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, anchor, cursor - anchor, QVariant()));
|
imAttributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, anchor, cursor - anchor, QVariant()));
|
||||||
QInputMethodEvent event(QString(), imAttributes);
|
QInputMethodEvent event(QString(), imAttributes);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user