diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-02-01 17:03:06 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2010-02-06 08:35:04 (GMT) |
commit | 8e66e40218afccab44f94eb6a26b4295f8b1a746 (patch) | |
tree | 94919876ad29734c938240d186318f415bdedd46 | |
parent | 086461ea7b6953211b340c783d266e4e0da5d7f5 (diff) | |
download | Qt-8e66e40218afccab44f94eb6a26b4295f8b1a746.zip Qt-8e66e40218afccab44f94eb6a26b4295f8b1a746.tar.gz Qt-8e66e40218afccab44f94eb6a26b4295f8b1a746.tar.bz2 |
Assert failure when setting a widget focus proxy as its successor in tab order
Now we check that and skip it from the tab list. Auto-test included.
Reviewed-by: leo
Task-number: QTBUG-7532
(cherry picked from commit 94f5f21ac88de0d940d6ac27d222f1ef8e66d939)
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qwidget/tst_qwidget.cpp | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 73304c8..5c2015a 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -6414,6 +6414,8 @@ void QWidget::setTabOrder(QWidget* first, QWidget *second) first = fp; } + if (fp == second) + return; if (QWidget *sp = second->focusProxy()) second = sp; diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index ea90ae3..1fb323e 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -396,6 +396,8 @@ private slots: void focusProxyAndInputMethods(); void scrollWithoutBackingStore(); + void taskQTBUG_7532_tabOrderWithFocusProxy(); + private: bool ensureScreenSize(int width, int height); QWidget *testWidget; @@ -9783,5 +9785,17 @@ void tst_QWidget::scrollWithoutBackingStore() QCOMPARE(child.pos(),QPoint(25,25)); } +void tst_QWidget::taskQTBUG_7532_tabOrderWithFocusProxy() +{ + QWidget w; + w.setFocusPolicy(Qt::TabFocus); + QWidget *fp = new QWidget(&w); + fp->setFocusPolicy(Qt::TabFocus); + w.setFocusProxy(fp); + QWidget::setTabOrder(&w, fp); + + // No Q_ASSERT, then it's allright. +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" |