summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-10-16 13:22:52 +0200
committerUlf Hermann <ulf.hermann@qt.io>2017-10-17 09:47:51 +0000
commiteeb0358d65620f6de39649fbe8b43ee44b5fff8c (patch)
tree0e90dde244749876bdcb73a81e5091097e4c0cdc
parent34d7b26a8887eed9170b898973a96c5447f29640 (diff)
downloadqt-creator-eeb0358d65620f6de39649fbe8b43ee44b5fff8c.tar.gz
Debugger: Re-add quotes to JS strings after editing
The quotes are stripped when the string is presented for editing, so they have to be added back when we're done editing. This is what we already did if we were talking to the inspector rather than the V4 debugger. In order for this to work, JS numbers need to be identified as numbers, rather than strings. So, we have to add "number" to the types recognized as float. Change-Id: I2054f4ad36ec1d14fb2dfee3705a80c8ec84d5ac Task-number: QTCREATORBUG-19032 Reviewed-by: hjk <hjk@qt.io>
-rw-r--r--src/plugins/debugger/qml/qmlengine.cpp6
-rw-r--r--src/plugins/debugger/qml/qmlinspectoragent.cpp4
-rw-r--r--src/plugins/debugger/watchdata.cpp2
3 files changed, 6 insertions, 6 deletions
diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp
index b5e8fde5b9..92a9f746cf 100644
--- a/src/plugins/debugger/qml/qmlengine.cpp
+++ b/src/plugins/debugger/qml/qmlengine.cpp
@@ -870,9 +870,13 @@ bool QmlEngine::canHandleToolTip(const DebuggerToolTipContext &) const
}
void QmlEngine::assignValueInDebugger(WatchItem *item,
- const QString &expression, const QVariant &value)
+ const QString &expression, const QVariant &editValue)
{
if (!expression.isEmpty()) {
+ QVariant value = (editValue.type() == QVariant::String)
+ ? QVariant('"' + editValue.toString().replace('"', "\\\"") + '"')
+ : editValue;
+
if (item->isInspect()) {
d->inspectorAgent.assignValue(item, expression, value);
} else {
diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp
index a765746c82..f273529f69 100644
--- a/src/plugins/debugger/qml/qmlinspectoragent.cpp
+++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp
@@ -176,10 +176,6 @@ void QmlInspectorAgent::assignValue(const WatchItem *data,
if (data->id != WatchItem::InvalidId) {
QString val(valueV.toString());
- if (valueV.type() == QVariant::String) {
- val = val.replace(QLatin1Char('\"'), QLatin1String("\\\""));
- val = QLatin1Char('\"') + val + QLatin1Char('\"');
- }
QString expression = QString("%1 = %2;").arg(expr).arg(val);
queryExpressionResult(data->id, expression);
}
diff --git a/src/plugins/debugger/watchdata.cpp b/src/plugins/debugger/watchdata.cpp
index 453d6562d6..7c1e727d05 100644
--- a/src/plugins/debugger/watchdata.cpp
+++ b/src/plugins/debugger/watchdata.cpp
@@ -94,7 +94,7 @@ bool isIntType(const QString &type)
bool isFloatType(const QString &type)
{
- return type == "float" || type == "double" || type == "qreal";
+ return type == "float" || type == "double" || type == "qreal" || type == "number";
}
bool isIntOrFloatType(const QString &type)