summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-02-01 17:03:06 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-02-01 17:41:15 (GMT)
commit94f5f21ac88de0d940d6ac27d222f1ef8e66d939 (patch)
treeeeb9fb223894bbb646de372cf60e0adc8d40a395
parentafe0f17eb5974adbedd1bc1f2fcd98459d92df47 (diff)
downloadQt-94f5f21ac88de0d940d6ac27d222f1ef8e66d939.zip
Qt-94f5f21ac88de0d940d6ac27d222f1ef8e66d939.tar.gz
Qt-94f5f21ac88de0d940d6ac27d222f1ef8e66d939.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
-rw-r--r--src/gui/kernel/qwidget.cpp2
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp14
2 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index ffad38b..4054d2a 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"