forked from qt-creator/qt-creator
QmlDesigner.NodeInstances: Fix line feed handling
Task-number: QTCREATORBUG-4161 Change-Id: I61d765bedffde4d1f15e763d92b771f22dbcd4a2 Reviewed-on: http://codereview.qt.nokia.com/1849 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
This commit is contained in:
@@ -374,6 +374,18 @@ void ObjectNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParentIn
|
||||
addToNewProperty(object(), newParentInstance->object(), newParentProperty);
|
||||
}
|
||||
}
|
||||
QVariant ObjectNodeInstance::convertSpecialCharacter(const QVariant& value) const
|
||||
{
|
||||
QVariant specialCharacterConvertedValue = value;
|
||||
if (value.type() == QVariant::String) {
|
||||
QString string = value.toString();
|
||||
string.replace(QLatin1String("\\n"), QLatin1String("\n"));
|
||||
string.replace(QLatin1String("\\t"), QLatin1String("\t"));
|
||||
specialCharacterConvertedValue = string;
|
||||
}
|
||||
|
||||
return specialCharacterConvertedValue;
|
||||
}
|
||||
|
||||
void ObjectNodeInstance::setPropertyVariant(const QString &name, const QVariant &value)
|
||||
{
|
||||
@@ -394,7 +406,7 @@ void ObjectNodeInstance::setPropertyVariant(const QString &name, const QVariant
|
||||
QDeclarativePropertyPrivate::setBinding(property, 0, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
|
||||
}
|
||||
|
||||
bool isWritten = property.write(value);
|
||||
bool isWritten = property.write(convertSpecialCharacter(value));
|
||||
|
||||
if (!isWritten)
|
||||
qDebug() << "ObjectNodeInstance.setPropertyVariant: Cannot be written: " << object() << name << value;
|
||||
|
||||
@@ -191,6 +191,7 @@ protected:
|
||||
void removeFromOldProperty(QObject *object, QObject *oldParent, const QString &oldParentProperty);
|
||||
void addToNewProperty(QObject *object, QObject *newParent, const QString &newParentProperty);
|
||||
void deleteObjectsInList(const QDeclarativeProperty &metaProperty);
|
||||
QVariant convertSpecialCharacter(const QVariant& value) const;
|
||||
|
||||
private:
|
||||
QHash<QString, QVariant> m_resetValueHash;
|
||||
|
||||
Reference in New Issue
Block a user