summaryrefslogtreecommitdiffstats
path: root/src/widgets/graphicsview
diff options
context:
space:
mode:
authorZhang Hao <zhanghao@uniontech.com>2020-10-29 15:24:26 +0800
committerZhang Hao <zhanghao@uniontech.com>2020-11-04 12:16:48 +0800
commitbf5011815d917e07ae7cf45e5768f1775f70e90d (patch)
tree6a872f74903f06e77801fd6a40baaa05b585c5e3 /src/widgets/graphicsview
parent68f3e37449223466723a1ebc5b4f712634f993ac (diff)
InputMethod should call reset() function when proxywidget lost focus
fix When the preview of input Chinese appears,the proxyWidget lose focus and does not call the reset method of inputMethod. Fixes: QTBUG-88016 Pick-to: 5.15 Change-Id: I82a66207b0d2046d768430ac3e93df86c1ed3681 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/graphicsview')
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
index c79c1e24c1..fcd675aa76 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
@@ -1391,6 +1391,11 @@ void QGraphicsProxyWidget::focusInEvent(QFocusEvent *event)
break;
}
+ // QTBUG-88016
+ if (d->widget && d->widget->focusWidget()
+ && d->widget->focusWidget()->testAttribute(Qt::WA_InputMethodEnabled))
+ QApplication::inputMethod()->reset();
+
d->proxyIsGivingFocus = false;
}
@@ -1406,8 +1411,14 @@ void QGraphicsProxyWidget::focusOutEvent(QFocusEvent *event)
if (d->widget) {
// We need to explicitly remove subfocus from the embedded widget's
// focus widget.
- if (QWidget *focusWidget = d->widget->focusWidget())
+ if (QWidget *focusWidget = d->widget->focusWidget()) {
+ // QTBUG-88016 proxyWidget set QTextEdit(QLineEdit etc.) when input preview text,
+ // inputMethod should be reset when proxyWidget lost focus
+ if (focusWidget && focusWidget->testAttribute(Qt::WA_InputMethodEnabled))
+ QApplication::inputMethod()->reset();
+
d->removeSubFocusHelper(focusWidget, event->reason());
+ }
}
}