summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativeloader.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-04-20 00:05:39 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-04-20 00:05:39 (GMT)
commit1b80a6bc28cb49b9f6e1a2132d929819924aa604 (patch)
treed0de1b7639a4b9259af5b97488e339f604f83e46 /src/declarative/graphicsitems/qdeclarativeloader.cpp
parent18cbadd8edd233b843d04441a05788264da0a67b (diff)
downloadQt-1b80a6bc28cb49b9f6e1a2132d929819924aa604.zip
Qt-1b80a6bc28cb49b9f6e1a2132d929819924aa604.tar.gz
Qt-1b80a6bc28cb49b9f6e1a2132d929819924aa604.tar.bz2
Allow Loader sourceComponent to be set to undefeined.
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativeloader.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index 3f257b5..bdd2c87 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -132,12 +132,15 @@ void QDeclarativeLoaderPrivate::initResize()
\endcode
If the Loader source is changed, any previous items instantiated
- will be destroyed. Setting \c source to an empty string
+ will be destroyed. Setting \c source to an empty string, or setting
+ sourceComponent to \e undefined
will destroy the currently instantiated items, freeing resources
and leaving the Loader empty. For example:
\code
pageLoader.source = ""
+ or
+ pageLoader.sourceComponent = undefined
\endcode
unloads "Page1.qml" and frees resources consumed by it.
@@ -271,6 +274,11 @@ void QDeclarativeLoader::setSourceComponent(QDeclarativeComponent *comp)
}
}
+void QDeclarativeLoader::resetSourceComponent()
+{
+ setSourceComponent(0);
+}
+
void QDeclarativeLoaderPrivate::_q_sourceLoaded()
{
Q_Q(QDeclarativeLoader);