diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2018-11-23 09:22:38 +0100 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2018-12-07 15:45:28 +0000 |
commit | 43840350a1597d58116c36137c046ef595c57ed4 (patch) | |
tree | 0a15cb2d7f0ad52878cd98377e1a05d8d5b2c7fd | |
parent | 29cbf8fd44bd2e27db1e3d569c6e3680b6d34f5f (diff) |
Disable text prediction for input
This is a workaround to avoid issues with QtVirtualKeyboard when used
with QtWebEngine.
Task-number: QTBUG-70158
Task-number: QTBUG-71995
Change-Id: I1e6fcd4dceb131dbe781dd7ab3856cb154ac6a18
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 4 | ||||
-rw-r--r-- | tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp | 2 | ||||
-rw-r--r-- | tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 2326dbdf7..99bda12d1 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -754,7 +754,7 @@ void RenderWidgetHostViewQt::OnUpdateTextInputStateCalled(content::TextInputMana } ui::TextInputType type = getTextInputType(); - m_delegate->setInputMethodHints(toQtInputMethodHints(getTextInputType())); + m_delegate->setInputMethodHints(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText); m_surroundingText = QString::fromStdString(state->value); // Remove IME composition text from the surrounding text @@ -1112,7 +1112,7 @@ QVariant RenderWidgetHostViewQt::inputMethodQuery(Qt::InputMethodQuery query) // TODO: Implement this return QVariant(); // No limit. case Qt::ImHints: - return int(toQtInputMethodHints(getTextInputType())); + return int(toQtInputMethodHints(getTextInputType()) | Qt::ImhNoPredictiveText); default: return QVariant(); } diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp index cf08ccd1d..94140cbfe 100644 --- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp +++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp @@ -783,7 +783,7 @@ void tst_QQuickWebEngineView::inputMethodHints() QVERIFY(view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod)); query = QInputMethodQueryEvent(Qt::ImHints); QGuiApplication::sendEvent(input, &query); - QTRY_COMPARE(Qt::InputMethodHints(query.value(Qt::ImHints).toUInt()), Qt::ImhPreferLowercase | Qt::ImhMultiLine); + QTRY_COMPARE(Qt::InputMethodHints(query.value(Qt::ImHints).toUInt()), Qt::ImhPreferLowercase | Qt::ImhNoPredictiveText | Qt::ImhMultiLine); } void tst_QQuickWebEngineView::setZoomFactor() diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index eb340b6f5..03e61fda2 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -48,7 +48,7 @@ #include <QtWidgets/qaction.h> #define VERIFY_INPUTMETHOD_HINTS(actual, expect) \ - QVERIFY(actual == expect); + QVERIFY(actual == (expect | Qt::ImhNoPredictiveText)); #define QTRY_COMPARE_WITH_TIMEOUT_FAIL_BLOCK(__expr, __expected, __timeout, __fail_block) \ do { \ |