diff options
author | Jan Arve Sæther <jan-arve.saether@theqtcompany.com> | 2015-11-26 10:40:21 +0100 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@theqtcompany.com> | 2016-04-14 07:29:10 +0000 |
commit | 6bf790e27d437631d2241942062e16b3c8191095 (patch) | |
tree | 331992cad40a485ba95a29450452f845007993ed /src/quick/items/qquicktextedit.cpp | |
parent | 2eb69af40a1ab29f10fe92c9d3667b00407b2f81 (diff) |
Add support for input method selection handles
QQuickTextInput needs to report back Qt::ImhAnchorRectangle, and
make it possible to query the cursor position of any given point
with inputMethodQuery(Qt::ImCursorPosition, point)
Change-Id: Iabe1946e7a8642b51c4601b51e2a13763bdbbd0c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Diffstat (limited to 'src/quick/items/qquicktextedit.cpp')
-rw-r--r-- | src/quick/items/qquicktextedit.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index f2e9f63fa9..d9c0e428a4 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -508,7 +508,7 @@ void QQuickTextEdit::setFont(const QFont &font) updateSize(); updateWholeDocument(); #ifndef QT_NO_IM - updateInputMethod(Qt::ImCursorRectangle | Qt::ImFont); + updateInputMethod(Qt::ImCursorRectangle | Qt::ImAnchorRectangle | Qt::ImFont); #endif } emit fontChanged(d->sourceFont); @@ -1670,6 +1670,7 @@ void QQuickTextEdit::select(int start, int end) // QTBUG-11100 updateSelection(); + updateInputMethod(); } /*! @@ -1842,7 +1843,11 @@ QVariant QQuickTextEdit::inputMethodQuery(Qt::InputMethodQuery property, QVarian v = (int)d->effectiveInputMethodHints(); break; default: + if (property == Qt::ImCursorPosition && !argument.isNull()) + argument = QVariant(argument.toPointF() - QPointF(d->xoff, d->yoff)); v = d->control->inputMethodQuery(property, argument); + if (property == Qt::ImCursorRectangle || property == Qt::ImAnchorRectangle) + v = QVariant(v.toRectF().translated(d->xoff, d->yoff)); break; } return v; |