diff options
author | axis <qt-info@nokia.com> | 2010-09-01 09:47:09 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-09-01 13:04:40 (GMT) |
commit | f0ec1d2ec229f5a2c47dfa9392a2625da25fc69f (patch) | |
tree | 24c72d0a00f3bf8badaf739b039116c1ea0f62a8 /tests | |
parent | 52cf47565e402dc682038ccaf8d725401802b603 (diff) | |
download | Qt-f0ec1d2ec229f5a2c47dfa9392a2625da25fc69f.zip Qt-f0ec1d2ec229f5a2c47dfa9392a2625da25fc69f.tar.gz Qt-f0ec1d2ec229f5a2c47dfa9392a2625da25fc69f.tar.bz2 |
Fixed a case where a newly created native widget would lose focus.
If a native control was created for a child widget, it would receive
the FocusChanged signal in its QSymbianControl with a value of not-
focused. This would lead the code to deactivate the whole toplevel
window. This was fixed by having Qt traverse the widget chain up to
the toplevel and check if parent widgets are also not focused.
AutoTest: Included and passed
RevBy: Denis Dzyubenko
RevBy: mread
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qinputcontext/tst_qinputcontext.cpp | 1 | ||||
-rw-r--r-- | tests/auto/qwidget/tst_qwidget.cpp | 25 |
2 files changed, 25 insertions, 1 deletions
diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp index 23cfd9e..c90cc5b 100644 --- a/tests/auto/qinputcontext/tst_qinputcontext.cpp +++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp @@ -448,7 +448,6 @@ void tst_QInputContext::focusProxy() QInputContext *gic = qApp->inputContext(); QVERIFY(gic); - qDebug() << gic->focusWidget() << &proxy; QCOMPARE(gic->focusWidget(), &proxy); // then change the focus proxy and check that input context is valid diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index ef05b91..098ce3c 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -402,6 +402,8 @@ private slots: #endif // QT_MAC_USE_COCOA #endif + void nativeChildFocus(); + private: bool ensureScreenSize(int width, int height); QWidget *testWidget; @@ -10531,5 +10533,28 @@ void tst_QWidget::taskQTBUG_11373() #endif // QT_MAC_USE_COCOA #endif +void tst_QWidget::nativeChildFocus() +{ + QWidget w; + QLayout *layout = new QVBoxLayout; + w.setLayout(layout); + QLineEdit *p1 = new QLineEdit; + QLineEdit *p2 = new QLineEdit; + layout->addWidget(p1); + layout->addWidget(p2); + p1->setObjectName("p1"); + p2->setObjectName("p2"); + w.show(); + w.activateWindow(); + p1->setFocus(); + p1->setAttribute(Qt::WA_NativeWindow); + p2->setAttribute(Qt::WA_NativeWindow); + QApplication::processEvents(); + QTest::qWaitForWindowShown(&w); + + QCOMPARE(QApplication::activeWindow(), &w); + QCOMPARE(QApplication::focusWidget(), p1); +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" |