diff options
author | Paul Olav Tvete <paul.tvete@digia.com> | 2014-01-20 12:30:35 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-15 10:38:35 +0100 |
commit | f8dbed12266c42785c1e4758eed05833ec035f33 (patch) | |
tree | 85067c8722cfc3854d9e22845fcd633f06cb4422 /src/widgets/widgets/qtextedit.cpp | |
parent | 25e7fe16504ad4784ea2d75204ffa855ca6d3e1b (diff) |
Extending the inputMethodQuery API
Currently, inputMethodQuery() only provides information about the
current paragraph. On some platforms, such as Android, the input method
needs information about the global cursor position, and more of the
surrounding text. Some queries need to pass parameters.
The current inputmethodQuery() implementation does not allow parameters to
be passed. Changing this would require new or modified virtual functions, which
is not possible until Qt 6. Therefore, a completely new mechanism is needed.
Change-Id: Ic64fd90198ade70aa0fa6fa5ad3867dfa7ed763c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/widgets/widgets/qtextedit.cpp')
-rw-r--r-- | src/widgets/widgets/qtextedit.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index cc7b44d082..a33ac0817f 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -1717,14 +1717,21 @@ void QTextEdit::scrollContentsBy(int dx, int dy) */ QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const { + return inputMethodQuery(property, QVariant()); +} + +/*!\internal + */ +QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const +{ Q_D(const QTextEdit); QVariant v; - switch (property) { + switch (query) { case Qt::ImHints: - v = QWidget::inputMethodQuery(property); + v = QWidget::inputMethodQuery(query); break; default: - v = d->control->inputMethodQuery(property); + v = d->control->inputMethodQuery(query, argument); const QPoint offset(-d->horizontalOffset(), -d->verticalOffset()); if (v.type() == QVariant::RectF) v = v.toRectF().toRect().translated(offset); |