diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-05-19 01:10:11 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-05-19 01:10:11 (GMT) |
commit | e007505d8f35c1194caf80ffc4f1e46561ff7be3 (patch) | |
tree | dfae4e3fb14dce556826a91c8ddef18a3b2c6483 | |
parent | 2108142dcd0a2dbb639443b594eb2c1c24e480cc (diff) | |
download | Qt-e007505d8f35c1194caf80ffc4f1e46561ff7be3.zip Qt-e007505d8f35c1194caf80ffc4f1e46561ff7be3.tar.gz Qt-e007505d8f35c1194caf80ffc4f1e46561ff7be3.tar.bz2 |
When changing Loader source, remove old item from scene immediately.
This ensures focus is restored to the correct item.
Task-number: QTBUG-10787
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeloader.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 94983c4..4995baf 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -81,8 +81,12 @@ void QDeclarativeLoaderPrivate::clear() // We can't delete immediately because our item may have triggered // the Loader to load a different item. - item->setVisible(false); - item->setParentItem(0); + if (item->scene()) { + item->scene()->removeItem(item); + } else { + item->setParentItem(0); + item->setVisible(false); + } item->deleteLater(); item = 0; } |