summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qwidget.cpp6
-rw-r--r--tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp15
2 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 20d1d30..60f38f2 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -6232,6 +6232,12 @@ void QWidget::setFocus(Qt::FocusReason reason)
QApplication::sendEvent(that->style(), &event);
}
if (!isHidden()) {
+#ifndef QT_NO_GRAPHICSVIEW
+ // Update proxy state
+ if (QWExtra *topData = window()->d_func()->extra)
+ if (topData->proxyWidget && topData->proxyWidget->hasFocus())
+ topData->proxyWidget->d_func()->updateProxyInputMethodAcceptanceFromWidget();
+#endif
// Send event to self
QFocusEvent event(QEvent::FocusIn, reason);
QPointer<QWidget> that = f;
diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index d5f63d3..6cea834 100644
--- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -3436,6 +3436,21 @@ void tst_QGraphicsProxyWidget::inputMethod()
qApp->sendEvent(proxy, &event);
QCOMPARE(lineEdit->inputMethodEvents, i);
}
+
+ scene.clear();
+ QGraphicsView view(&scene);
+ QWidget *w = new QWidget;
+ w->setLayout(new QVBoxLayout(w));
+ QLineEdit *lineEdit = new QLineEdit;
+ lineEdit->setEchoMode(QLineEdit::Password);
+ w->layout()->addWidget(lineEdit);
+ lineEdit->setAttribute(Qt::WA_InputMethodEnabled, true);
+ QGraphicsProxyWidget *proxy = scene.addWidget(w);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ QTRY_VERIFY(!(proxy->flags() & QGraphicsItem::ItemAcceptsInputMethod));
+ lineEdit->setFocus();
+ QVERIFY((proxy->flags() & QGraphicsItem::ItemAcceptsInputMethod));
}
void tst_QGraphicsProxyWidget::clickFocus()