summaryrefslogtreecommitdiffstats
path: root/tests/auto/qwidget
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-09-01 09:47:09 (GMT)
committeraxis <qt-info@nokia.com>2010-09-01 13:04:40 (GMT)
commitf0ec1d2ec229f5a2c47dfa9392a2625da25fc69f (patch)
tree24c72d0a00f3bf8badaf739b039116c1ea0f62a8 /tests/auto/qwidget
parent52cf47565e402dc682038ccaf8d725401802b603 (diff)
downloadQt-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/auto/qwidget')
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp25
1 files changed, 25 insertions, 0 deletions
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"