From 9b959c78404dcc1263834f2cfe6a1f199420df30 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 18 Oct 2010 16:52:27 +1000 Subject: Fix recording of visual tests. --- tools/qml/qmlruntime.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 9f9eba0..78bc409 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -1383,6 +1383,8 @@ void QDeclarativeViewer::appAboutToQuit() // avoid crashes if messages are received after app has closed delete loggerWindow; loggerWindow = 0; + delete tester; + tester = 0; } void QDeclarativeViewer::autoStartRecording() -- cgit v0.12 From 197354a4d7668fda7c4dce4704f0143528959938 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 18 Oct 2010 16:55:38 +1000 Subject: Fix visual test. --- .../qdeclarativepositioners/data/repeater.0.png | Bin 2790 -> 0 bytes .../qdeclarativepositioners/data/usingRepeater.0.png | Bin 0 -> 2782 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tests/auto/declarative/qmlvisual/qdeclarativepositioners/data/repeater.0.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativepositioners/data/usingRepeater.0.png diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepositioners/data/repeater.0.png b/tests/auto/declarative/qmlvisual/qdeclarativepositioners/data/repeater.0.png deleted file mode 100644 index f7018fd..0000000 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativepositioners/data/repeater.0.png and /dev/null differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepositioners/data/usingRepeater.0.png b/tests/auto/declarative/qmlvisual/qdeclarativepositioners/data/usingRepeater.0.png new file mode 100644 index 0000000..3234c98 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativepositioners/data/usingRepeater.0.png differ -- cgit v0.12 From ddc7f627d85436d76f5ca881bd6f16efb8962af5 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 20 Oct 2010 09:35:26 +1000 Subject: Further focus scope fixes. Follow-up to e11ee40cefc981fbdcfb10816039d4efb080fb17. Reviewed-by: Yoann Lopes --- src/gui/graphicsview/qgraphicsitem.cpp | 19 ++++++++++++------- .../tst_qdeclarativefocusscope.cpp | 6 ++++++ tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 1 + 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 2b6aaf5..7ab49cb 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -3322,8 +3322,7 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim */ void QGraphicsItem::clearFocus() { - if (hasFocus()) - d_ptr->clearFocusHelper(/* giveFocusToParent = */ true); + d_ptr->clearFocusHelper(/* giveFocusToParent = */ true); } /*! @@ -3337,8 +3336,14 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent) QGraphicsItem *p = parent; while (p) { if (p->flags() & QGraphicsItem::ItemIsFocusScope) { - p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ false, - /* focusFromHide = */ false); + if (p->d_ptr->focusScopeItem == q_ptr) { + p->d_ptr->focusScopeItem = 0; + if (!q_ptr->hasFocus()) //if it has focus, focusScopeItemChange is called elsewhere + focusScopeItemChange(false); + } + if (q_ptr->hasFocus()) + p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ false, + /* focusFromHide = */ false); return; } p = p->d_ptr->parent; @@ -3346,10 +3351,10 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent) } } - // Invisible items with focus must explicitly clear subfocus. - clearSubFocus(q_ptr); - if (q_ptr->hasFocus()) { + // Invisible items with focus must explicitly clear subfocus. + clearSubFocus(q_ptr); + // If this item has the scene's input focus, clear it. scene->setFocusItem(0); } diff --git a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp index 4cafbd9..1645dac 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp +++ b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp @@ -398,6 +398,12 @@ void tst_qdeclarativefocusscope::signalEmission() QCOMPARE(item3->property("color"), blue); QCOMPARE(item4->property("color"), red); + item4->setFocus(false); + QCOMPARE(item1->property("color"), blue); + QCOMPARE(item2->property("color"), red); + QCOMPARE(item3->property("color"), blue); + QCOMPARE(item4->property("color"), blue); + delete view; } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 30199bb..a3bd0b0 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -9068,6 +9068,7 @@ void tst_QGraphicsItem::focusScope() QVERIFY(!scope2->hasFocus()); QVERIFY(scope1->hasFocus()); scope2->setFocus(); + QVERIFY(scope2->hasFocus()); scope3->setFocus(); QVERIFY(scope3->hasFocus()); -- cgit v0.12