Report ImAbsolutePosition for QLineEdit
ImAbsolutePosition was added in f8dbed1226,
based on requirements on Android, but without an implementation for
QLineEdit. It would seem sensible to fall back to the cursor position
in this case, as QLineEdit doesn't support multiple blocks.
Pick-to: 6.2
Change-Id: Iff1255270ceef069f03ce457df633d7b675f1a28
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
parent
7188e65077
commit
61d4f7e228
|
|
@ -1855,6 +1855,7 @@ QVariant QLineEdit::inputMethodQuery(Qt::InputMethodQuery property, QVariant arg
|
|||
return d->adjustedControlRect(d->control->anchorRect());
|
||||
case Qt::ImFont:
|
||||
return font();
|
||||
case Qt::ImAbsolutePosition:
|
||||
case Qt::ImCursorPosition: {
|
||||
const QPointF pt = argument.toPointF();
|
||||
if (!pt.isNull())
|
||||
|
|
|
|||
|
|
@ -2250,6 +2250,11 @@ void tst_QLineEdit::cursorPositionChanged()
|
|||
input.simulate(testWidget);
|
||||
QCOMPARE(lastCursorPos, lastPos);
|
||||
QCOMPARE(newCursorPos, newPos);
|
||||
|
||||
QInputMethodQueryEvent queryEvent(Qt::ImCursorPosition | Qt::ImAbsolutePosition);
|
||||
QApplication::sendEvent(testWidget, &queryEvent);
|
||||
QCOMPARE(queryEvent.value(Qt::ImCursorPosition).toInt(), newPos);
|
||||
QCOMPARE(queryEvent.value(Qt::ImAbsolutePosition).toInt(), newPos);
|
||||
}
|
||||
|
||||
void tst_QLineEdit::selectedText()
|
||||
|
|
|
|||
Loading…
Reference in New Issue