Commit eeb0358d authored by Ulf Hermann's avatar Ulf Hermann

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: default avatarhjk <hjk@qt.io>
parent 34d7b26a
......@@ -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 {
......
......@@ -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);
}
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment