Commit ec1a02df authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.PropertyEditor: fix url behaviour



An invalid QVariant/QUrl has to be exposed as an empty string.

Change-Id: Ifec13fcd95812256991eb9f49401acab0477430e
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@digia.com>
parent 4c5376dc
......@@ -114,6 +114,17 @@ static void fixAmbigousColorNames(const QmlDesigner::ModelNode &modelNode, const
}
}
static void fixUrl(const QmlDesigner::ModelNode &modelNode, const QString &name, QVariant *value)
{
if (modelNode.isValid() && modelNode.metaInfo().isValid()
&& (modelNode.metaInfo().propertyTypeName(name) == "QUrl"
|| modelNode.metaInfo().propertyTypeName(name) == "url")) {
if (!value->isValid()) {
*value = QString(QLatin1String(""));
}
}
}
void PropertyEditorValue::setValueWithEmit(const QVariant &value)
{
if (m_value != value || isBound()) {
......@@ -144,6 +155,7 @@ void PropertyEditorValue::setValue(const QVariant &value)
m_value = value;
fixAmbigousColorNames(modelNode(), name(), &m_value);
fixUrl(modelNode(), name(), &m_value);
if (m_value.isValid())
emit valueChangedQml();
......
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