diff options
-rw-r--r-- | src/declarative/fx/qfxitem.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlcomponentjs.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlcontext.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 27 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine_p.h | 3 | ||||
-rw-r--r-- | src/declarative/qml/qmlexpression.cpp | 2 | ||||
-rw-r--r-- | src/declarative/util/qmlscript.cpp | 2 |
8 files changed, 18 insertions, 24 deletions
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 09ae22c..f8ed7b4 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -821,7 +821,7 @@ void QFxItem::qmlLoaded() QFxItem* ret = qobject_cast<QFxItem*>(o); if (ret) { ret->setItemParent(this); - QScriptValue v = QmlEngine::getScriptEngine(qmlEngine(this))->newQObject(ret); + QScriptValue v = QmlEnginePrivate::getScriptEngine(qmlEngine(this))->newQObject(ret); emit newChildCreated(d->_qmlnewloading.at(i).toString(),v); } diff --git a/src/declarative/qml/qmlcomponentjs.cpp b/src/declarative/qml/qmlcomponentjs.cpp index 2552f78..df3e834 100644 --- a/src/declarative/qml/qmlcomponentjs.cpp +++ b/src/declarative/qml/qmlcomponentjs.cpp @@ -84,7 +84,7 @@ QScriptValue QmlComponentJS::createObject() { Q_D(QmlComponentJS); QObject* ret = create(d->ctxt); - return QmlEngine::qmlScriptObject(ret, d->engine); + return QmlEnginePrivate::qmlScriptObject(ret, d->engine); } /*! diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp index bf549d8..dabaa5e 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -106,7 +106,7 @@ void QmlContextPrivate::init() parent->d_func()->childContexts.insert(q); //set scope chain - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QScriptValue scopeObj = scriptEngine->newObject(QmlEnginePrivate::get(engine)->contextClass, scriptEngine->newVariant(QVariant::fromValue((QObject*)q))); if (!parent) diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 0016144..321feb9 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -520,13 +520,6 @@ void QmlInstanceDeclarativeData::destroyed(QObject *object) delete this; } -/*! A way to access the QScriptEngine, so that you can add your own objects. - This function is likely to be removed upon further reflection. -*/ -QScriptEngine *QmlEngine::getScriptEngine(QmlEngine *e) -{ - return &e->d_func()->scriptEngine; -} /*! \internal */ /* QScriptEngine *QmlEngine::scriptEngine() @@ -540,14 +533,14 @@ QScriptEngine *QmlEngine::scriptEngine() Creates a QScriptValue allowing you to use \a object in QML script. \a engine is the QmlEngine it is to be created in. - The QScriptValue returned is a Qml Script Object, not a QtScript QObject, - due to the special needs of QML requiring more functionality than a standard + The QScriptValue returned is a QtScript Object, not a QtScript QObject, due + to the special needs of QML requiring more functionality than a standard QtScript QObject. */ -QScriptValue QmlEngine::qmlScriptObject(QObject* object, +QScriptValue QmlEnginePrivate::qmlScriptObject(QObject* object, QmlEngine* engine) { - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); return scriptEngine->newObject(new QmlObjectScriptClass(engine), scriptEngine->newQObject(object)); } @@ -691,13 +684,13 @@ QScriptValue QmlEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngi if(obj) { obj->setParent(parentArg); obj->setProperty("parent", QVariant::fromValue<QObject*>(parentArg)); - return QmlEngine::qmlScriptObject(obj, activeEngine); + return qmlScriptObject(obj, activeEngine); } return engine->nullValue(); } QmlScriptClass::QmlScriptClass(QmlEngine *bindengine) -: QScriptClass(QmlEngine::getScriptEngine(bindengine)), +: QScriptClass(QmlEnginePrivate::getScriptEngine(bindengine)), engine(bindengine) { } @@ -787,7 +780,7 @@ QScriptValue QmlContextScriptClass::property(const QScriptValue &object, uint basicId = id & QmlScriptClass::ClassIdMask; - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QmlEnginePrivate *ep = QmlEnginePrivate::get(engine); switch (basicId) { @@ -847,7 +840,7 @@ void QmlContextScriptClass::setProperty(QScriptValue &object, int objIdx = (id & QmlScriptClass::ClassIdSelectorMask) >> 24; QObject *obj = bindContext->d_func()->defaultObjects.at(objIdx); - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QScriptValue oldact = scriptEngine->currentContext()->activationObject(); scriptEngine->currentContext()->setActivationObject(scriptEngine->globalObject()); @@ -955,7 +948,7 @@ QmlObjectScriptClass::QmlObjectScriptClass(QmlEngine *bindEngine) : QmlScriptClass(bindEngine) { engine = bindEngine; - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(bindEngine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(bindEngine); prototypeObject = scriptEngine->newObject(); prototypeObject.setProperty(QLatin1String("destroy"), scriptEngine->newFunction(QmlObjectDestroy)); @@ -1027,7 +1020,7 @@ void QmlObjectScriptClass::setProperty(QScriptValue &object, qWarning() << "Set QmlObject Property" << name.toString() << value.toVariant(); #endif - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QScriptValue oldact = scriptEngine->currentContext()->activationObject(); scriptEngine->currentContext()->setActivationObject(scriptEngine->globalObject()); diff --git a/src/declarative/qml/qmlengine.h b/src/declarative/qml/qmlengine.h index a3457f0..6066059 100644 --- a/src/declarative/qml/qmlengine.h +++ b/src/declarative/qml/qmlengine.h @@ -86,8 +86,6 @@ public: static QmlContext *contextForObject(const QObject *); static void setContextForObject(QObject *, QmlContext *); - static QScriptValue qmlScriptObject(QObject*, QmlEngine*); - static QScriptEngine *getScriptEngine(QmlEngine *e); private: Q_DECLARE_PRIVATE(QmlEngine) }; diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index 7b459e9..18cdd83 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -193,9 +193,12 @@ public: bool resolveType(const Imports&, const QByteArray& type, QmlType** type_return, QUrl* url_return, ImportedNamespace** ns_return=0) const; void resolveTypeInNamespace(ImportedNamespace*, const QByteArray& type, QmlType** type_return, QUrl* url_return ) const; + + static QScriptValue qmlScriptObject(QObject*, QmlEngine*); static QScriptValue createComponent(QScriptContext*, QScriptEngine*); static QScriptValue createQmlObject(QScriptContext*, QScriptEngine*); + static QScriptEngine *getScriptEngine(QmlEngine *e) { return &e->d_func()->scriptEngine; } static QmlEnginePrivate *get(QmlEngine *e) { return e->d_func(); } }; diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp index 990722a..2c06efa 100644 --- a/src/declarative/qml/qmlexpression.cpp +++ b/src/declarative/qml/qmlexpression.cpp @@ -240,7 +240,7 @@ QVariant QmlExpressionPrivate::evalQtScript() if (me) ctxtPriv->defaultObjects.insert(ctxtPriv->highPriorityCount, me); - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QScriptValueList oldScopeChain = scriptEngine->currentContext()->scopeChain(); diff --git a/src/declarative/util/qmlscript.cpp b/src/declarative/util/qmlscript.cpp index df05d8e..ca9aad5 100644 --- a/src/declarative/util/qmlscript.cpp +++ b/src/declarative/util/qmlscript.cpp @@ -185,7 +185,7 @@ void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &s Q_Q(QmlScript); QmlEngine *engine = qmlEngine(q); QmlContext *context = qmlContext(q); - QScriptEngine *scriptEngine = QmlEngine::getScriptEngine(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QScriptContext *currentContext = scriptEngine->currentContext(); QScriptValueList oldScopeChain = currentContext->scopeChain(); |