diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-27 05:20:37 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-27 05:20:37 (GMT) |
commit | 752a15ca59b1b209aa67c3fbee53868b3a22df80 (patch) | |
tree | 1403cb3d0c3ff3dbadb201bedfe079db7c021b9b | |
parent | ef1a5d6bad05b99765658b3ca916bd3c5f507db0 (diff) | |
download | Qt-752a15ca59b1b209aa67c3fbee53868b3a22df80.zip Qt-752a15ca59b1b209aa67c3fbee53868b3a22df80.tar.gz Qt-752a15ca59b1b209aa67c3fbee53868b3a22df80.tar.bz2 |
Make private stuff private
-rw-r--r-- | src/declarative/fx/qfxitem.cpp | 5 | ||||
-rw-r--r-- | src/declarative/qml/qmlbasicscript.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlcomponent.cpp | 10 | ||||
-rw-r--r-- | src/declarative/qml/qmlcomponentjs.cpp | 3 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompositetypemanager.cpp | 4 | ||||
-rw-r--r-- | src/declarative/qml/qmlcontext.cpp | 4 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 112 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine.h | 21 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine_p.h | 16 | ||||
-rw-r--r-- | src/declarative/qml/qmlexpression.cpp | 19 | ||||
-rw-r--r-- | src/declarative/qml/qmlexpression.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlexpression_p.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlvme.cpp | 2 | ||||
-rw-r--r-- | src/declarative/util/qmlscript.cpp | 4 |
14 files changed, 90 insertions, 116 deletions
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 6c6fcd3..247ea53 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -49,7 +49,8 @@ #include <QtScript/qscriptengine.h> #include <private/qfxperf_p.h> -#include "qmlengine.h" +#include <QtDeclarative/qmlengine.h> +#include <private/qmlengine_p.h> #include "qmlstate.h" #include "qlistmodelinterface.h" #include "qfxanchors_p.h" @@ -819,7 +820,7 @@ void QFxItem::qmlLoaded() QFxItem* ret = qobject_cast<QFxItem*>(o); if (ret) { ret->setItemParent(this); - QScriptValue v = qmlEngine(this)->scriptEngine()->newQObject(ret); + QScriptValue v = QmlEnginePrivate::getScriptEngine(qmlEngine(this))->newQObject(ret); emit newChildCreated(d->_qmlnewloading.at(i).toString(),v); } diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp index 8fcb0e1..b940d61 100644 --- a/src/declarative/qml/qmlbasicscript.cpp +++ b/src/declarative/qml/qmlbasicscript.cpp @@ -656,7 +656,7 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c return QVariant(); QmlContextPrivate *contextPrivate = context->d_func(); - QmlEnginePrivate *enginePrivate = context->engine()->d_func(); + QmlEnginePrivate *enginePrivate = QmlEnginePrivate::get(context->engine()); QStack<QVariant> stack; diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index 7dcc373..8fb7736 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -330,7 +330,7 @@ void QmlComponent::setData(const QByteArray &data, const QUrl &url) d->url = url; QmlCompositeTypeData *typeData = - d->engine->d_func()->typeManager.getImmediate(data, url); + QmlEnginePrivate::get(d->engine)->typeManager.getImmediate(data, url); if (typeData->status == QmlCompositeTypeData::Waiting) { @@ -361,7 +361,7 @@ void QmlComponent::loadUrl(const QUrl &url) d->url = url; QmlCompositeTypeData *data = - d->engine->d_func()->typeManager.get(d->url); + QmlEnginePrivate::get(d->engine)->typeManager.get(d->url); if (data->status == QmlCompositeTypeData::Waiting) { @@ -481,8 +481,8 @@ QObject *QmlComponent::beginCreate(QmlContext *context) return 0; } - if (!d->engine->d_func()->rootComponent) - d->engine->d_func()->rootComponent = this; + if (!QmlEnginePrivate::get(d->engine)->rootComponent) + QmlEnginePrivate::get(d->engine)->rootComponent = this; QmlContextPrivate *contextPriv = static_cast<QmlContextPrivate *>(QObjectPrivate::get(context)); @@ -500,7 +500,7 @@ QObject *QmlComponent::beginCreate(QmlContext *context) if (vme.isError()) d->errors = vme.errors(); - QmlEnginePrivate *ep = d->engine->d_func(); + QmlEnginePrivate *ep = QmlEnginePrivate::get(d->engine); if (ep->rootComponent == this) { ep->rootComponent = 0; diff --git a/src/declarative/qml/qmlcomponentjs.cpp b/src/declarative/qml/qmlcomponentjs.cpp index 89f3851..df3e834 100644 --- a/src/declarative/qml/qmlcomponentjs.cpp +++ b/src/declarative/qml/qmlcomponentjs.cpp @@ -41,6 +41,7 @@ #include "qmlcomponentjs_p.h" #include "qmlcomponentjs_p_p.h" +#include "qmlengine_p.h" #include "qmlcomponent.h" QT_BEGIN_NAMESPACE @@ -83,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/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp index 6f17b70..b0a8642 100644 --- a/src/declarative/qml/qmlcompositetypemanager.cpp +++ b/src/declarative/qml/qmlcompositetypemanager.cpp @@ -247,7 +247,7 @@ void QmlCompositeTypeManager::setData(QmlCompositeTypeData *unit, unit->errors << unit->data.errors(); } else { foreach (QmlScriptParser::Import imp, unit->data.imports()) { - if (!engine->d_func()->addToImport(&unit->imports, imp.uri, imp.qualifier, imp.version, imp.type)) { + if (!QmlEnginePrivate::get(engine)->addToImport(&unit->imports, imp.uri, imp.qualifier, imp.version, imp.type)) { QmlError error; error.setUrl(url); error.setDescription(tr("Import %1 unavailable").arg(imp.uri)); @@ -323,7 +323,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit) } QUrl url; - if (!engine->d_func()->resolveType(unit->imports, type, &ref.type, &url)) { + if (!QmlEnginePrivate::get(engine)->resolveType(unit->imports, type, &ref.type, &url)) { // XXX could produce error message here. } diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp index bc2e6bf..dabaa5e 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -106,9 +106,9 @@ void QmlContextPrivate::init() parent->d_func()->childContexts.insert(q); //set scope chain - QScriptEngine *scriptEngine = engine->scriptEngine(); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QScriptValue scopeObj = - scriptEngine->newObject(engine->d_func()->contextClass, scriptEngine->newVariant(QVariant::fromValue((QObject*)q))); + scriptEngine->newObject(QmlEnginePrivate::get(engine)->contextClass, scriptEngine->newVariant(QVariant::fromValue((QObject*)q))); if (!parent) scopeChain.append(scriptEngine->globalObject()); else diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index b478618..321feb9 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -94,11 +94,13 @@ struct StaticQtMetaObject : public QObject }; QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e) -: rootContext(0), currentBindContext(0), currentExpression(0), q(e), - isDebugging(false), rootComponent(0), networkAccessManager(0), typeManager(e), +: rootContext(0), currentBindContext(0), currentExpression(0), + isDebugging(false), contextClass(0), objectClass(0), valueTypeClass(0), + scriptEngine(this), rootComponent(0), networkAccessManager(0), typeManager(e), uniqueId(1) { - QScriptValue qtObject = scriptEngine.newQMetaObject(StaticQtMetaObject::get()); + QScriptValue qtObject = + scriptEngine.newQMetaObject(StaticQtMetaObject::get()); scriptEngine.globalObject().setProperty(QLatin1String("Qt"), qtObject); } @@ -146,6 +148,7 @@ Q_GLOBAL_STATIC(QmlEngineDebugServer, qmlEngineDebugServer); void QmlEnginePrivate::init() { + Q_Q(QmlEngine); scriptEngine.installTranslatorFunctions(); contextClass = new QmlContextScriptClass(q); objectClass = new QmlObjectScriptClass(q); @@ -157,13 +160,11 @@ void QmlEnginePrivate::init() debugger->attachTo(&scriptEngine); } #endif - //###needed for the other funcs, but should it be exposed? - scriptEngine.globalObject().setProperty(QLatin1String("qmlEngine"), - scriptEngine.newQObject(q)); + scriptEngine.globalObject().setProperty(QLatin1String("createQmlObject"), - scriptEngine.newFunction(QmlEngine::createQmlObject, 1)); + scriptEngine.newFunction(QmlEnginePrivate::createQmlObject, 1)); scriptEngine.globalObject().setProperty(QLatin1String("createComponent"), - scriptEngine.newFunction(QmlEngine::createComponent, 1)); + scriptEngine.newFunction(QmlEnginePrivate::createComponent, 1)); if (QCoreApplication::instance()->thread() == q->thread() && QmlEngineDebugServer::isDebuggingEnabled()) { @@ -520,11 +521,13 @@ void QmlInstanceDeclarativeData::destroyed(QObject *object) } /*! \internal */ +/* QScriptEngine *QmlEngine::scriptEngine() { Q_D(QmlEngine); return &d->scriptEngine; } +*/ /*! Creates a QScriptValue allowing you to use \a object in QML script. @@ -533,17 +536,12 @@ QScriptEngine *QmlEngine::scriptEngine() 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. - - You'll want to use this function if you are writing C++ code which - dynamically creates and returns objects when called from QtScript, - and these objects are visual items in the QML tree. - - \sa QScriptEngine::newQObject() */ -QScriptValue QmlEngine::qmlScriptObject(QObject* object, QmlEngine* engine) +QScriptValue QmlEnginePrivate::qmlScriptObject(QObject* object, + QmlEngine* engine) { - return engine->scriptEngine()->newObject(new QmlObjectScriptClass(engine), - engine->scriptEngine()->newQObject(object)); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); + return scriptEngine->newObject(new QmlObjectScriptClass(engine), scriptEngine->newQObject(object)); } /*! @@ -598,21 +596,23 @@ QScriptValue QmlEngine::qmlScriptObject(QObject* object, QmlEngine* engine) If you want to just create an arbitrary string of QML, instead of loading a qml file, consider the createQmlObject() function. - \sa QmlComponent::createObject(), QmlEngine::createQmlObject() */ -QScriptValue QmlEngine::createComponent(QScriptContext *ctxt, QScriptEngine *engine) +QScriptValue QmlEnginePrivate::createComponent(QScriptContext *ctxt, + QScriptEngine *engine) { QmlComponentJS* c; - QmlEngine* activeEngine = qobject_cast<QmlEngine*>( - engine->globalObject().property(QLatin1String("qmlEngine")).toQObject()); - QmlContext* context =activeEngine->d_func()->currentExpression->context(); - if(ctxt->argumentCount() != 1 || !activeEngine){ + + QmlEnginePrivate *activeEnginePriv = + static_cast<QmlScriptEngine*>(engine)->p; + QmlEngine* activeEngine = activeEnginePriv->q_func(); + + QmlContext* context = activeEnginePriv->currentExpression->context(); + if(ctxt->argumentCount() != 1) { c = new QmlComponentJS(activeEngine); }else{ QUrl url = QUrl(context->resolvedUrl(ctxt->argument(0).toString())); - if(!url.isValid()){ + if(!url.isValid()) url = QUrl(ctxt->argument(0).toString()); - } c = new QmlComponentJS(activeEngine, url, activeEngine); } c->setContext(context); @@ -643,21 +643,15 @@ QScriptValue QmlEngine::createComponent(QScriptContext *ctxt, QScriptEngine *eng instead. 'New components' refers to external QML files that have not yet been loaded, and so it is safe to use createQmlObject to load built-in components. - - \sa QmlEngine::createComponent() */ -QScriptValue QmlEngine::createQmlObject(QScriptContext *ctxt, QScriptEngine *engine) +QScriptValue QmlEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngine *engine) { - QmlEngine* activeEngine = qobject_cast<QmlEngine*>( - engine->globalObject().property(QLatin1String("qmlEngine")).toQObject()); - if(ctxt->argumentCount() < 2 || !activeEngine){ - if(ctxt->argumentCount() < 2){ - qWarning() << "createQmlObject requires two arguments, A QML string followed by an existing QML item id."; - }else{ - qWarning() << "createQmlObject cannot find engine."; - } + QmlEnginePrivate *activeEnginePriv = + static_cast<QmlScriptEngine*>(engine)->p; + QmlEngine* activeEngine = activeEnginePriv->q_func(); + + if(ctxt->argumentCount() < 2) return engine->nullValue(); - } QString qml = ctxt->argument(0).toString(); QUrl url; @@ -669,24 +663,25 @@ QScriptValue QmlEngine::createQmlObject(QScriptContext *ctxt, QScriptEngine *eng QmlComponent component(activeEngine, qml.toUtf8(), url); if(component.isError()) { QList<QmlError> errors = component.errors(); - foreach (const QmlError &error, errors) { - qWarning() <<"Error in createQmlObject(): "<< error; - } + qWarning() <<"QmlEngine::createQmlObject():"; + foreach (const QmlError &error, errors) + qWarning() << " " << error; return engine->nullValue(); } QObject *obj = component.create(qmlCtxt); + if(component.isError()) { QList<QmlError> errors = component.errors(); - foreach (const QmlError &error, errors) { - qWarning() <<"Error in createQmlObject(): "<< error; - } + qWarning() <<"QmlEngine::createQmlObject():"; + foreach (const QmlError &error, errors) + qWarning() << " " << error; return engine->nullValue(); } - if(obj){ + if(obj) { obj->setParent(parentArg); obj->setProperty("parent", QVariant::fromValue<QObject*>(parentArg)); return qmlScriptObject(obj, activeEngine); @@ -695,7 +690,8 @@ QScriptValue QmlEngine::createQmlObject(QScriptContext *ctxt, QScriptEngine *eng } QmlScriptClass::QmlScriptClass(QmlEngine *bindengine) -: QScriptClass(bindengine->scriptEngine()), engine(bindengine) +: QScriptClass(QmlEnginePrivate::getScriptEngine(bindengine)), + engine(bindengine) { } @@ -762,8 +758,7 @@ QmlContextScriptClass::queryProperty(const QScriptValue &object, } for (int ii = 0; !rv && ii < bindContext->d_func()->defaultObjects.count(); ++ii) { - rv = engine->d_func()->queryObject(propName, id, - bindContext->d_func()->defaultObjects.at(ii)); + rv = QmlEnginePrivate::get(engine)->queryObject(propName, id, bindContext->d_func()->defaultObjects.at(ii)); if (rv) *id |= (ii << 24); } @@ -785,7 +780,8 @@ QScriptValue QmlContextScriptClass::property(const QScriptValue &object, uint basicId = id & QmlScriptClass::ClassIdMask; - QScriptEngine *scriptEngine = engine->scriptEngine(); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); + QmlEnginePrivate *ep = QmlEnginePrivate::get(engine); switch (basicId) { case VariantPropertyId: @@ -799,18 +795,18 @@ QScriptValue QmlContextScriptClass::property(const QScriptValue &object, #endif QScriptValue rv; if (QmlMetaType::isObject(value.userType())) { - rv = scriptEngine->newObject(engine->d_func()->objectClass, scriptEngine->newVariant(value)); + rv = scriptEngine->newObject(ep->objectClass, scriptEngine->newVariant(value)); } else { rv = scriptEngine->newVariant(value); } - engine->d_func()->capturedProperties << QmlEnginePrivate::CapturedProperty(bindContext, -1, index + bindContext->d_func()->notifyIndex); + ep->capturedProperties << QmlEnginePrivate::CapturedProperty(bindContext, -1, index + bindContext->d_func()->notifyIndex); return rv; } default: { int objId = (id & ClassIdSelectorMask) >> 24; QObject *obj = bindContext->d_func()->defaultObjects.at(objId); - QScriptValue rv = engine->d_func()->propertyObject(name, obj, + QScriptValue rv = ep->propertyObject(name, obj, id & ~QmlScriptClass::ClassIdSelectorMask); if (rv.isValid()) { #ifdef PROPERTY_DEBUG @@ -844,7 +840,7 @@ void QmlContextScriptClass::setProperty(QScriptValue &object, int objIdx = (id & QmlScriptClass::ClassIdSelectorMask) >> 24; QObject *obj = bindContext->d_func()->defaultObjects.at(objIdx); - QScriptEngine *scriptEngine = engine->scriptEngine(); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QScriptValue oldact = scriptEngine->currentContext()->activationObject(); scriptEngine->currentContext()->setActivationObject(scriptEngine->globalObject()); @@ -952,9 +948,10 @@ QmlObjectScriptClass::QmlObjectScriptClass(QmlEngine *bindEngine) : QmlScriptClass(bindEngine) { engine = bindEngine; - prototypeObject = engine->scriptEngine()->newObject(); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(bindEngine); + prototypeObject = scriptEngine->newObject(); prototypeObject.setProperty(QLatin1String("destroy"), - engine->scriptEngine()->newFunction(QmlObjectDestroy)); + scriptEngine->newFunction(QmlObjectDestroy)); } QmlObjectScriptClass::~QmlObjectScriptClass() @@ -980,7 +977,7 @@ QScriptClass::QueryFlags QmlObjectScriptClass::queryProperty(const QScriptValue #endif if (obj) - rv = engine->d_func()->queryObject(propName, id, obj); + rv = QmlEnginePrivate::get(engine)->queryObject(propName, id, obj); return rv; } @@ -996,7 +993,8 @@ QScriptValue QmlObjectScriptClass::property(const QScriptValue &object, qWarning() << "QmlObject Property:" << propName << obj; #endif - QScriptValue rv = engine->d_func()->propertyObject(name, obj, id); + QScriptValue rv = + QmlEnginePrivate::get(engine)->propertyObject(name, obj, id); if (rv.isValid()) { #ifdef PROPERTY_DEBUG qWarning() << "~Property: Resolved property" << propName @@ -1022,7 +1020,7 @@ void QmlObjectScriptClass::setProperty(QScriptValue &object, qWarning() << "Set QmlObject Property" << name.toString() << value.toVariant(); #endif - QScriptEngine *scriptEngine = engine->scriptEngine(); + 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 2faad66..6066059 100644 --- a/src/declarative/qml/qmlengine.h +++ b/src/declarative/qml/qmlengine.h @@ -86,28 +86,7 @@ public: static QmlContext *contextForObject(const QObject *); static void setContextForObject(QObject *, QmlContext *); - static QScriptValue qmlScriptObject(QObject*, QmlEngine*); - - static QScriptValue createComponent(QScriptContext*, QScriptEngine*); - static QScriptValue createQmlObject(QScriptContext*, QScriptEngine*); - private: - // LK: move to the private class - QScriptEngine *scriptEngine(); - friend class QFxItem; // XXX - friend class QmlScriptPrivate; - friend class QmlCompositeTypeManager; - friend class QmlCompiler; - friend class QmlScriptClass; - friend class QmlContext; - friend class QmlContextPrivate; - friend class QmlExpression; - friend class QmlExpressionPrivate; - friend class QmlBasicScript; - friend class QmlVME; - friend class QmlComponent; - friend class QmlContextScriptClass; //### - friend class QmlObjectScriptClass; //### Q_DECLARE_PRIVATE(QmlEngine) }; diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index b8d49aa..18cdd83 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -114,7 +114,6 @@ public: QmlContext *rootContext; QmlContext *currentBindContext; QmlExpression *currentExpression; - QmlEngine *q; bool isDebugging; #ifdef QT_SCRIPTTOOLS_LIB QScriptEngineDebugger *debugger; @@ -127,7 +126,13 @@ public: QmlContext *setCurrentBindContext(QmlContext *); QStack<QmlContext *> activeContexts; - QScriptEngine scriptEngine; + struct QmlScriptEngine : public QScriptEngine + { + QmlScriptEngine(QmlEnginePrivate *priv) + : p(priv) {} + QmlEnginePrivate *p; + }; + QmlScriptEngine scriptEngine; QUrl baseUrl; @@ -188,6 +193,13 @@ 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(); } }; class QmlScriptClass : public QScriptClass diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp index ea0e9aa..7394004 100644 --- a/src/declarative/qml/qmlexpression.cpp +++ b/src/declarative/qml/qmlexpression.cpp @@ -51,7 +51,7 @@ Q_DECLARE_METATYPE(QList<QObject *>); QT_BEGIN_NAMESPACE QmlExpressionPrivate::QmlExpressionPrivate() -: ctxt(0), expressionFunctionValid(false), sseData(0), me(0), trackChange(true), line(-1), id(0), guardList(0), guardListLength(0) +: ctxt(0), expressionFunctionValid(false), sseData(0), me(0), trackChange(true), line(-1), guardList(0), guardListLength(0) { } @@ -63,8 +63,6 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, const QString &expr, expression = expr; this->ctxt = ctxt; - if (ctxt && ctxt->engine()) - id = ctxt->engine()->d_func()->getUniqueId(); if (ctxt) ctxt->d_func()->childExpressions.insert(q); this->me = me; @@ -78,8 +76,6 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc, sse.load((const char *)expr, rc); this->ctxt = ctxt; - if (ctxt && ctxt->engine()) - id = ctxt->engine()->d_func()->getUniqueId(); if (ctxt) ctxt->d_func()->childExpressions.insert(q); this->me = me; @@ -244,7 +240,7 @@ QVariant QmlExpressionPrivate::evalQtScript() if (me) ctxtPriv->defaultObjects.insert(ctxtPriv->highPriorityCount, me); - QScriptEngine *scriptEngine = engine->scriptEngine(); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QScriptValueList oldScopeChain = scriptEngine->currentContext()->scopeChain(); @@ -346,7 +342,7 @@ QVariant QmlExpression::value() QmlBasicScript::CacheState cacheState = QmlBasicScript::Reset; - QmlEnginePrivate *ep = engine()->d_func(); + QmlEnginePrivate *ep = QmlEnginePrivate::get(engine()); QmlExpression *lastCurrentExpression = ep->currentExpression; QPODVector<QmlEnginePrivate::CapturedProperty> lastCapturedProperties; @@ -437,15 +433,6 @@ QObject *QmlExpression::scopeObject() const return d->me; } -/*! - \internal -*/ -quint32 QmlExpression::id() const -{ - Q_D(const QmlExpression); - return d->id; -} - /*! \internal */ void QmlExpression::__q_notify() { diff --git a/src/declarative/qml/qmlexpression.h b/src/declarative/qml/qmlexpression.h index 6db6ef9..d5f0cbb 100644 --- a/src/declarative/qml/qmlexpression.h +++ b/src/declarative/qml/qmlexpression.h @@ -80,8 +80,6 @@ public: QObject *scopeObject() const; - quint32 id() const; - public Q_SLOTS: QVariant value(); diff --git a/src/declarative/qml/qmlexpression_p.h b/src/declarative/qml/qmlexpression_p.h index 41b7749..7f086c2 100644 --- a/src/declarative/qml/qmlexpression_p.h +++ b/src/declarative/qml/qmlexpression_p.h @@ -86,8 +86,6 @@ public: QUrl fileName; int line; - quint32 id; - QVariant evalSSE(QmlBasicScript::CacheState &cacheState); QVariant evalQtScript(); diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index ebf0a73..1cfd5e9 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -143,7 +143,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt, QmlCompiledData QStack<ListInstance> qliststack; vmeErrors.clear(); - QmlEnginePrivate *ep = ctxt->engine()->d_func(); + QmlEnginePrivate *ep = QmlEnginePrivate::get(ctxt->engine()); for (int ii = start; !isError() && ii < (start + count); ++ii) { QmlInstruction &instr = comp->bytecode[ii]; diff --git a/src/declarative/util/qmlscript.cpp b/src/declarative/util/qmlscript.cpp index cfe5a1e..ca9aad5 100644 --- a/src/declarative/util/qmlscript.cpp +++ b/src/declarative/util/qmlscript.cpp @@ -185,9 +185,9 @@ void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &s Q_Q(QmlScript); QmlEngine *engine = qmlEngine(q); QmlContext *context = qmlContext(q); - QScriptEngine *scriptEngine = engine->scriptEngine(); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); - QScriptContext *currentContext = engine->scriptEngine()->currentContext(); + QScriptContext *currentContext = scriptEngine->currentContext(); QScriptValueList oldScopeChain = currentContext->scopeChain(); QScriptValue oldact = currentContext->activationObject(); |