summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-10-20 00:10:49 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-10-20 00:10:49 (GMT)
commit4d93a4eccb462ce3bee75f0c3961901d60bcae02 (patch)
tree3b7944c49d296ab48ad543843932fe5cbb905c61
parent70f7a6e7ebec1fca9087fde56ce9961f34a52dc5 (diff)
parentddc7f627d85436d76f5ca881bd6f16efb8962af5 (diff)
downloadQt-4d93a4eccb462ce3bee75f0c3961901d60bcae02.zip
Qt-4d93a4eccb462ce3bee75f0c3961901d60bcae02.tar.gz
Qt-4d93a4eccb462ce3bee75f0c3961901d60bcae02.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Further focus scope fixes. Fix visual test. Fix recording of visual tests.
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp19
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp6
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativepositioners/data/repeater.0.pngbin2790 -> 0 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativepositioners/data/usingRepeater.0.pngbin0 -> 2782 bytes
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp1
-rw-r--r--tools/qml/qmlruntime.cpp2
6 files changed, 21 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/declarative/qmlvisual/qdeclarativepositioners/data/repeater.0.png b/tests/auto/declarative/qmlvisual/qdeclarativepositioners/data/repeater.0.png
deleted file mode 100644
index f7018fd..0000000
--- a/tests/auto/declarative/qmlvisual/qdeclarativepositioners/data/repeater.0.png
+++ /dev/null
Binary files 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
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/qdeclarativepositioners/data/usingRepeater.0.png
Binary files differ
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());
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()