diff --git a/src/plugins/qmljsinspector/qmljsinspector.cpp b/src/plugins/qmljsinspector/qmljsinspector.cpp index df2f658b018..95049e71b26 100644 --- a/src/plugins/qmljsinspector/qmljsinspector.cpp +++ b/src/plugins/qmljsinspector/qmljsinspector.cpp @@ -696,10 +696,11 @@ void InspectorUi::selectItems(const QList &objectIds) selectItems(objectReferences); } -void InspectorUi::changePropertyValue(int debugId,const QString &propertyName, const QString &valueExpression) +void InspectorUi::changePropertyValue(int debugId, const QString &propertyName, + const QString &valueExpression, bool isLiteral) { QmlDebugObjectReference obj = m_clientProxy->objectReferenceForId(debugId); - m_clientProxy->setBindingForObject(debugId, propertyName, valueExpression, false, + m_clientProxy->setBindingForObject(debugId, propertyName, valueExpression, isLiteral, obj.source().url().toString(), obj.source().lineNumber()); } @@ -901,8 +902,8 @@ void InspectorUi::disableLivePreview() void InspectorUi::connectSignals() { - connect(m_propertyInspector, SIGNAL(changePropertyValue(int,QString,QString)), - this, SLOT(changePropertyValue(int,QString,QString))); + connect(m_propertyInspector, SIGNAL(changePropertyValue(int,QString,QString,bool)), + this, SLOT(changePropertyValue(int,QString,QString,bool))); connect(m_clientProxy, SIGNAL(propertyChanged(int,QByteArray,QVariant)), m_propertyInspector, SLOT(propertyValueChanged(int,QByteArray,QVariant))); diff --git a/src/plugins/qmljsinspector/qmljsinspector.h b/src/plugins/qmljsinspector/qmljsinspector.h index 20bad0a36d1..8f5e17798bc 100644 --- a/src/plugins/qmljsinspector/qmljsinspector.h +++ b/src/plugins/qmljsinspector/qmljsinspector.h @@ -120,7 +120,8 @@ private slots: void selectItems(const QList &objectReferences); void selectItems(const QList &objectIds); void changeSelectedItems(const QList &objects); - void changePropertyValue(int debugId,const QString &propertyName, const QString &valueExpression); + void changePropertyValue(int debugId,const QString &propertyName, + const QString &valueExpression, bool isLiteral); void objectTreeReady(); void onRootContext(const QVariant &value); diff --git a/src/plugins/qmljsinspector/qmljspropertyinspector.cpp b/src/plugins/qmljsinspector/qmljspropertyinspector.cpp index 9f4c325c48c..86c0e5804f1 100644 --- a/src/plugins/qmljsinspector/qmljspropertyinspector.cpp +++ b/src/plugins/qmljsinspector/qmljspropertyinspector.cpp @@ -79,7 +79,7 @@ class PropertyEditDelegate : public QItemDelegate int objectId = m_treeWidget->getData(index.row(), PROPERTY_NAME_COLUMN, Qt::UserRole).toInt(); QString propertyName = m_treeWidget->getData(index.row(), PROPERTY_NAME_COLUMN, Qt::DisplayRole).toString(); bool propertyValue = m_treeWidget->getData(index.row(), PROPERTY_VALUE_COLUMN, Qt::DisplayRole).toBool(); - m_treeWidget->propertyValueEdited(objectId, propertyName, !propertyValue?"true":"false"); + m_treeWidget->propertyValueEdited(objectId, propertyName, !propertyValue?"true":"false", true); return 0; } @@ -113,25 +113,9 @@ class PropertyEditDelegate : public QItemDelegate return; QString propertyName = m_treeWidget->getData(index.row(), PROPERTY_NAME_COLUMN, Qt::DisplayRole).toString(); - QLineEdit *lineEdit = static_cast(editor); QString propertyValue = lineEdit->text(); - - // add quotes if it's a string - QmlJSPropertyInspector::PropertyType propertyType = m_treeWidget->getTypeFor(index.row()); - const QChar quote(QLatin1Char('\"')); - - if (propertyType == QmlJSPropertyInspector::StringType) { - const QChar backslash(QLatin1Char('\\')); - propertyValue = propertyValue.replace(quote, QString(backslash) + quote); - } - - if (propertyType == QmlJSPropertyInspector::StringType || propertyType == QmlJSPropertyInspector::ColorType) { - propertyValue = quote + propertyValue + quote; - } - - m_treeWidget->propertyValueEdited(objectId, propertyName, propertyValue); - + m_treeWidget->propertyValueEdited(objectId, propertyName, propertyValue, true); lineEdit->clearFocus(); } @@ -367,9 +351,12 @@ void QmlJSPropertyInspector::propertyValueChanged(int debugId, const QByteArray } } -void QmlJSPropertyInspector::propertyValueEdited(const int objectId,const QString& propertyName, const QString& propertyValue) +void QmlJSPropertyInspector::propertyValueEdited(const int objectId, + const QString& propertyName, + const QString& propertyValue, + bool isLiteral) { - emit changePropertyValue(objectId, propertyName, propertyValue); + emit changePropertyValue(objectId, propertyName, propertyValue, isLiteral); } void QmlJSPropertyInspector::buildPropertyTree(const QmlDebugObjectReference &obj) diff --git a/src/plugins/qmljsinspector/qmljspropertyinspector.h b/src/plugins/qmljsinspector/qmljspropertyinspector.h index 3080c646527..4f42177a490 100644 --- a/src/plugins/qmljsinspector/qmljspropertyinspector.h +++ b/src/plugins/qmljsinspector/qmljspropertyinspector.h @@ -127,12 +127,14 @@ public: bool contentsValid() const; signals: - void changePropertyValue(int debugId, QString propertyName, QString valueExpression); + void changePropertyValue(int debugId, QString propertyName, QString valueExpression, + bool isLiteral); void customContextMenuRequested(const QPoint &pos); public slots: void setCurrentObjects(const QList &); - void propertyValueEdited(const int objectId,const QString &propertyName, const QString &propertyValue); + void propertyValueEdited(const int objectId,const QString &propertyName, const QString &propertyValue, + bool isLiteral = false); void propertyValueChanged(int debugId, const QByteArray &propertyName, const QVariant &propertyValue); void openExpressionEditor(const QModelIndex &itemIndex);