diff options
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp')
-rw-r--r-- | src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp index ff4e30835d..f72b8a51f9 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp @@ -63,8 +63,12 @@ QT_BEGIN_NAMESPACE QQmlEngineDebugServiceImpl::QQmlEngineDebugServiceImpl(QObject *parent) : QQmlEngineDebugService(2, parent), m_watch(new QQmlWatcher(this)), m_statesDelegate(0) { - QObject::connect(m_watch, SIGNAL(propertyChanged(int,int,QMetaProperty,QVariant)), - this, SLOT(propertyChanged(int,int,QMetaProperty,QVariant))); + connect(m_watch, &QQmlWatcher::propertyChanged, + this, &QQmlEngineDebugServiceImpl::propertyChanged); + + // Move the message into the correct thread for processing + connect(this, &QQmlEngineDebugServiceImpl::scheduleMessage, + this, &QQmlEngineDebugServiceImpl::processMessage, Qt::QueuedConnection); } QQmlEngineDebugServiceImpl::~QQmlEngineDebugServiceImpl() @@ -420,7 +424,7 @@ QQmlEngineDebugServiceImpl::objectData(QObject *object) void QQmlEngineDebugServiceImpl::messageReceived(const QByteArray &message) { - QMetaObject::invokeMethod(this, "processMessage", Qt::QueuedConnection, Q_ARG(QByteArray, message)); + emit scheduleMessage(message); } /*! @@ -656,7 +660,7 @@ bool QQmlEngineDebugServiceImpl::setBinding(int objectId, filename, line, column); QQmlPropertyPrivate::takeSignalExpression(property, qmlExpression); } else if (property.isProperty()) { - QQmlBinding *binding = new QQmlBinding(expression.toString(), object, QQmlContextData::get(context), filename, line, column); + QQmlBinding *binding = QQmlBinding::create(&QQmlPropertyPrivate::get(property)->core, expression.toString(), object, QQmlContextData::get(context), filename, line, column); binding->setTarget(property); QQmlPropertyPrivate::setBinding(binding); binding->update(); @@ -749,7 +753,7 @@ bool QQmlEngineDebugServiceImpl::setMethodBody(int objectId, const QString &meth if (!prop || !prop->isVMEFunction()) return false; - QMetaMethod metaMethod = object->metaObject()->method(prop->coreIndex); + QMetaMethod metaMethod = object->metaObject()->method(prop->coreIndex()); QList<QByteArray> paramNames = metaMethod.parameterNames(); QString paramStr; @@ -758,19 +762,22 @@ bool QQmlEngineDebugServiceImpl::setMethodBody(int objectId, const QString &meth paramStr.append(QString::fromUtf8(paramNames.at(ii))); } - QString jsfunction = QLatin1String("(function ") + method + QLatin1Char('(') + paramStr + - QLatin1String(") {"); - jsfunction += body; - jsfunction += QLatin1String("\n})"); + const QString jsfunction = QLatin1String("(function ") + method + QLatin1Char('(') + paramStr + + QLatin1String(") {") + body + QLatin1String("\n})"); QQmlVMEMetaObject *vmeMetaObject = QQmlVMEMetaObject::get(object); Q_ASSERT(vmeMetaObject); // the fact we found the property above should guarentee this - int lineNumber = vmeMetaObject->vmeMethodLineNumber(prop->coreIndex); QV4::ExecutionEngine *v4 = QV8Engine::getV4(qmlEngine(object)->handle()); QV4::Scope scope(v4); + + int lineNumber = 0; + QV4::ScopedFunctionObject oldMethod(scope, vmeMetaObject->vmeMethod(prop->coreIndex())); + if (oldMethod && oldMethod->d()->function) { + lineNumber = oldMethod->d()->function->compiledFunction->location.line; + } QV4::ScopedValue v(scope, QQmlJavaScriptExpression::evalFunction(contextData, object, jsfunction, contextData->urlString(), lineNumber)); - vmeMetaObject->setVmeMethod(prop->coreIndex, v); + vmeMetaObject->setVmeMethod(prop->coreIndex(), v); return true; } |