Commit c6a7091c authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner.NodeInstances: Fix line feed handling

Task-number: QTCREATORBUG-4161

Change-Id: I61d765bedffde4d1f15e763d92b771f22dbcd4a2
Reviewed-on: http://codereview.qt.nokia.com/1849

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent d1b3b66d
......@@ -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;
......
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