diff options
author | Christiaan Janssen <christiaan.janssen@nokia.com> | 2011-04-29 13:33:11 (GMT) |
---|---|---|
committer | Christiaan Janssen <christiaan.janssen@nokia.com> | 2011-05-06 09:02:27 (GMT) |
commit | 1f0f8a1b15fa4efa58feb2799614afc8bf0bd6e3 (patch) | |
tree | 9fffa7ec7d0379ba07a975a6f720d4b4aabf8043 /src | |
parent | 7d9f03c87e0e096934583a36340de5446e1d0520 (diff) | |
download | Qt-1f0f8a1b15fa4efa58feb2799614afc8bf0bd6e3.zip Qt-1f0f8a1b15fa4efa58feb2799614afc8bf0bd6e3.tar.gz Qt-1f0f8a1b15fa4efa58feb2799614afc8bf0bd6e3.tar.bz2 |
QmlDebugger: adding slots to items in Live Preview
Reviewed-by: Kai Koehne
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/qml/qdeclarativeenginedebug.cpp | 17 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeenginedebug_p.h | 2 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index 31fd516..0ac7680 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -518,8 +518,13 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message) QString propertyName; QVariant expr; bool isLiteralValue; + QString filename; + int line; ds >> objectId >> propertyName >> expr >> isLiteralValue; - setBinding(objectId, propertyName, expr, isLiteralValue); + if (!ds.atEnd()) { // backward compatibility from 2.1, 2.2 + ds >> filename >> line; + } + setBinding(objectId, propertyName, expr, isLiteralValue, filename, line); } else if (type == "RESET_BINDING") { int objectId; QString propertyName; @@ -537,7 +542,9 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message) void QDeclarativeEngineDebugServer::setBinding(int objectId, const QString &propertyName, const QVariant &expression, - bool isLiteralValue) + bool isLiteralValue, + QString filename, + int line) { QObject *object = objectForId(objectId); QDeclarativeContext *context = qmlContext(object); @@ -559,6 +566,7 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId, newBinding = new QDeclarativeBinding(expression.toString(), object, context); newBinding->setTarget(property); newBinding->setNotifyOnValueChanged(true); + newBinding->setSourceLocation(filename, line); } state->changeBindingInRevertList(object, propertyName, newBinding); @@ -574,11 +582,12 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId, property.write(expression); } else if (hasValidSignal(object, propertyName)) { QDeclarativeExpression *declarativeExpression = new QDeclarativeExpression(context, object, expression.toString()); - QDeclarativeExpression *oldExpression = QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression); - declarativeExpression->setSourceLocation(oldExpression->sourceFile(), oldExpression->lineNumber()); + QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression); + declarativeExpression->setSourceLocation(filename, line); } else if (property.isProperty()) { QDeclarativeBinding *binding = new QDeclarativeBinding(expression.toString(), object, context); binding->setTarget(property); + binding->setSourceLocation(filename, line); binding->setNotifyOnValueChanged(true); QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::setBinding(property, binding); if (oldBinding) diff --git a/src/declarative/qml/qdeclarativeenginedebug_p.h b/src/declarative/qml/qdeclarativeenginedebug_p.h index e95676c..64b2724 100644 --- a/src/declarative/qml/qdeclarativeenginedebug_p.h +++ b/src/declarative/qml/qdeclarativeenginedebug_p.h @@ -115,7 +115,7 @@ private: QDeclarativeObjectData objectData(QObject *); QDeclarativeObjectProperty propertyData(QObject *, int); QVariant valueContents(const QVariant &defaultValue) const; - void setBinding(int objectId, const QString &propertyName, const QVariant &expression, bool isLiteralValue); + void setBinding(int objectId, const QString &propertyName, const QVariant &expression, bool isLiteralValue, QString filename = QString(), int line = -1); void resetBinding(int objectId, const QString &propertyName); void setMethodBody(int objectId, const QString &method, const QString &body); |