QmlDesigner: Adding debugging operator to BindingProperty

This is required to output the expression in the DebugView.

Change-Id: I3ce0bf4a916e30e8c86c224e305fa1c4af337489
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2016-07-29 14:07:30 +02:00
committed by Tim Jenssen
parent 7c3f61f819
commit 5c5197d19d
2 changed files with 21 additions and 0 deletions

View File

@@ -58,4 +58,7 @@ protected:
bool compareBindingProperties(const QmlDesigner::BindingProperty &bindingProperty01, const QmlDesigner::BindingProperty &bindingProperty02); bool compareBindingProperties(const QmlDesigner::BindingProperty &bindingProperty01, const QmlDesigner::BindingProperty &bindingProperty02);
QMLDESIGNERCORE_EXPORT QTextStream& operator<<(QTextStream &stream, const BindingProperty &property);
QMLDESIGNERCORE_EXPORT QDebug operator<<(QDebug debug, const BindingProperty &AbstractProperty);
} // namespace QmlDesigner } // namespace QmlDesigner

View File

@@ -244,4 +244,22 @@ void BindingProperty::setDynamicTypeNameAndExpression(const TypeName &typeName,
model()->d->setDynamicBindingProperty(internalNode(), name(), typeName, expression); model()->d->setDynamicBindingProperty(internalNode(), name(), typeName, expression);
} }
QDebug operator<<(QDebug debug, const BindingProperty &property)
{
if (!property.isValid())
return debug.nospace() << "BindingProperty(" << PropertyName("invalid") << ')';
else
return debug.nospace() << "BindingProperty(" << property.name() << " " << property.expression() << ')';
}
QTextStream& operator<<(QTextStream &stream, const BindingProperty &property)
{
if (!property.isValid())
stream << "BindingProperty(" << PropertyName("invalid") << ')';
else
stream << "BindingProperty(" << property.name() << " " << property.expression() << ')';
return stream;
}
} // namespace QmlDesigner } // namespace QmlDesigner