forked from qt-creator/qt-creator
Debugger: Fix value assignment in locals and expressions
For booleans and numbers. Change-Id: I5ff1660faee1bf0ed21211d5fe98462f660fb417 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -795,9 +795,15 @@ void QmlEngine::assignValueInDebugger(WatchItem *item,
|
|||||||
const QString &expression, const QVariant &editValue)
|
const QString &expression, const QVariant &editValue)
|
||||||
{
|
{
|
||||||
if (!expression.isEmpty()) {
|
if (!expression.isEmpty()) {
|
||||||
QVariant value = (editValue.type() == QVariant::String)
|
QTC_CHECK(editValue.type() == QVariant::String);
|
||||||
? QVariant('"' + editValue.toString().replace('"', "\\\"") + '"')
|
QVariant value;
|
||||||
: editValue;
|
QString val = editValue.toString();
|
||||||
|
if (item->type == "boolean")
|
||||||
|
value = val != "false" && val != "0";
|
||||||
|
else if (item->type == "number")
|
||||||
|
value = val.toDouble();
|
||||||
|
else
|
||||||
|
value = QString('"' + val.replace('"', "\\\"") + '"');
|
||||||
|
|
||||||
if (item->isInspect()) {
|
if (item->isInspect()) {
|
||||||
d->inspectorAgent.assignValue(item, expression, value);
|
d->inspectorAgent.assignValue(item, expression, value);
|
||||||
|
|||||||
Reference in New Issue
Block a user