From c44402453593cbdf2eafa66f6ee23d17aacf44fd Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Tue, 8 Sep 2009 10:21:29 +0200 Subject: Remove ItemAutoDetectsFocusProxy from QGraphicsItem. This change partially reverts f68fed388dcdba6ab6dad3af4933bcd3aa123cf8, which was an attempt at getting FocusRealms working. Turns out this approach is wrong. The flag behaves badly when reparenting, and the feature conflicts with plain old setting focus. Discussed with Aaron; this change was already reverted in the kinetic-declarativeui branch. Reviewed-by: TrustMe --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 71 -------------------------- 1 file changed, 71 deletions(-) (limited to 'tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp') diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index b8061dae87..cefff80293 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -164,7 +164,6 @@ public slots: void init(); private slots: - void explicitDeleteAutoFocusProxy(); void construction(); void constructionWithParent(); void destruction(); @@ -284,9 +283,7 @@ private slots: void hitTestUntransformableItem(); void hitTestGraphicsEffectItem(); void focusProxy(); - void autoDetectFocusProxy(); void subFocus(); - void reverseCreateAutoFocusProxy(); void focusProxyDeletion(); void negativeZStacksBehindParent(); void setGraphicsEffect(); @@ -7551,31 +7548,6 @@ void tst_QGraphicsItem::focusProxy() QCOMPARE(item3->focusProxy(), (QGraphicsItem *)0); } -void tst_QGraphicsItem::autoDetectFocusProxy() -{ - QGraphicsScene scene; - QGraphicsItem *item = scene.addRect(0, 0, 10, 10); - item->setFlag(QGraphicsItem::ItemIsFocusable); - - QGraphicsItem *item2 = scene.addRect(0, 0, 10, 10); - item2->setParentItem(item); - item2->setFlag(QGraphicsItem::ItemIsFocusable); - - QGraphicsItem *item3 = scene.addRect(0, 0, 10, 10); - item3->setParentItem(item2); - item3->setFlag(QGraphicsItem::ItemIsFocusable); - - item->setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy); - QCOMPARE(item->focusProxy(), (QGraphicsItem *)0); - - item2->setFocus(); - QCOMPARE(item->focusProxy(), item2); - item3->setFocus(); - QCOMPARE(item->focusProxy(), item3); - item3->clearFocus(); - QCOMPARE(item->focusProxy(), item3); -} - void tst_QGraphicsItem::subFocus() { // Construct a text item that's not part of a scene (yet) @@ -7635,49 +7607,6 @@ void tst_QGraphicsItem::subFocus() QVERIFY(text2->hasFocus()); } -void tst_QGraphicsItem::reverseCreateAutoFocusProxy() -{ - QGraphicsTextItem *text = new QGraphicsTextItem; - text->setTextInteractionFlags(Qt::TextEditorInteraction); - text->setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy); - - QGraphicsTextItem *text2 = new QGraphicsTextItem; - text2->setTextInteractionFlags(Qt::TextEditorInteraction); - text2->setFocus(); - QVERIFY(!text2->hasFocus()); - QCOMPARE(text->focusProxy(), (QGraphicsItem *)0); - text2->setParentItem(text); - QCOMPARE(text->focusProxy(), (QGraphicsItem *)text2); - QCOMPARE(text->focusItem(), (QGraphicsItem *)text2); - - QGraphicsScene scene; - scene.addItem(text); - QVERIFY(text2->hasFocus()); -} - -void tst_QGraphicsItem::explicitDeleteAutoFocusProxy() -{ - QGraphicsTextItem *text = new QGraphicsTextItem; - text->setTextInteractionFlags(Qt::TextEditorInteraction); - text->setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy); - - QGraphicsTextItem *text2 = new QGraphicsTextItem; - text2->setTextInteractionFlags(Qt::TextEditorInteraction); - text2->setFocus(); - QVERIFY(!text2->hasFocus()); - QCOMPARE(text->focusProxy(), (QGraphicsItem *)0); - text2->setParentItem(text); - QCOMPARE(text->focusProxy(), (QGraphicsItem *)text2); - QCOMPARE(text->focusItem(), (QGraphicsItem *)text2); - - QGraphicsScene scene; - scene.addItem(text); - QVERIFY(text2->hasFocus()); - - delete text2; - QCOMPARE(text->focusProxy(), (QGraphicsItem *)0); -} - void tst_QGraphicsItem::focusProxyDeletion() { QGraphicsRectItem *rect = new QGraphicsRectItem; -- cgit v1.2.3