summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlcontext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/qmlcontext.cpp')
-rw-r--r--src/declarative/qml/qmlcontext.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp
index e97d2e9..980e1df 100644
--- a/src/declarative/qml/qmlcontext.cpp
+++ b/src/declarative/qml/qmlcontext.cpp
@@ -54,8 +54,8 @@
QT_BEGIN_NAMESPACE
QmlContextPrivate::QmlContextPrivate()
-: parent(0), engine(0), notifyIndex(-1), highPriorityCount(0),
- startLine(-1), endLine(-1)
+: parent(0), engine(0), isInternal(false), notifyIndex(-1),
+ highPriorityCount(0), startLine(-1), endLine(-1)
{
}
@@ -212,7 +212,7 @@ void QmlContextPrivate::addDefaultObject(QObject *object, Priority priority)
*/
/*! \internal */
-QmlContext::QmlContext(QmlEngine *e)
+QmlContext::QmlContext(QmlEngine *e, bool)
: QObject(*(new QmlContextPrivate))
{
Q_D(QmlContext);
@@ -221,6 +221,20 @@ QmlContext::QmlContext(QmlEngine *e)
}
/*!
+ Create a new QmlContext as a child of \a engine's root context, and the
+ QObject \a parent.
+*/
+QmlContext::QmlContext(QmlEngine *engine, QObject *parent)
+: QObject(*(new QmlContextPrivate), parent)
+{
+ Q_D(QmlContext);
+ QmlContext *parentContext = engine?engine->rootContext():0;
+ d->parent = parentContext;
+ d->engine = parentContext->engine();
+ d->init();
+}
+
+/*!
Create a new QmlContext with the given \a parentContext, and the
QObject \a parent.
*/
@@ -234,6 +248,19 @@ QmlContext::QmlContext(QmlContext *parentContext, QObject *parent)
}
/*!
+ \internal
+*/
+QmlContext::QmlContext(QmlContext *parentContext, QObject *parent, bool)
+: QObject(*(new QmlContextPrivate), parent)
+{
+ Q_D(QmlContext);
+ d->parent = parentContext;
+ d->engine = parentContext->engine();
+ d->isInternal = true;
+ d->init();
+}
+
+/*!
Destroys the QmlContext.
Any expressions, or sub-contexts dependent on this context will be