diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-03-24 10:10:06 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-03-24 15:18:55 (GMT) |
commit | e18eac95ad4b69ebe53e51c65416f1c94275e10a (patch) | |
tree | 6f5177f283d2e51e3fdf5081d981547b7dbd2bca /tests/auto/qwidget | |
parent | 7f147cf30e8c72ed4c452de31f4b5f853dbe9e4f (diff) | |
download | Qt-e18eac95ad4b69ebe53e51c65416f1c94275e10a.zip Qt-e18eac95ad4b69ebe53e51c65416f1c94275e10a.tar.gz Qt-e18eac95ad4b69ebe53e51c65416f1c94275e10a.tar.bz2 |
Fixes a focusWidget when showing a toplevel that accepts keyboard input.
When a toplevel window is the widget that can accept keyboard input,
it doesn't get focus when shown. The fix is to check if the toplevel
is activated and noone has focus, then give focus to the toplevel
itself.
Reviewed-by: Brad
Task-number: 244607
Diffstat (limited to 'tests/auto/qwidget')
-rw-r--r-- | tests/auto/qwidget/tst_qwidget.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 42f496a..dfd0792 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -343,6 +343,7 @@ private slots: void paintOutsidePaintEvent(); #endif void updateOnDestroyedSignal(); + void toplevelLineEditFocus(); private: bool ensureScreenSize(int width, int height); @@ -8727,5 +8728,18 @@ void tst_QWidget::updateOnDestroyedSignal() QTest::qWait(200); } +void tst_QWidget::toplevelLineEditFocus() +{ + testWidget->hide(); + + QLineEdit w; + w.show(); + qt_x11_wait_for_window_manager(&w); + QTest::qWait(200); + + QCOMPARE(QApplication::activeWindow(), &w); + QCOMPARE(QApplication::focusWidget(), &w); +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" |