forked from qt-creator/qt-creator
QmlDesigner: Extend the tracer to the properties
Task-number: QDS-15148 Change-Id: Ib87b5db1d17e76a9c18a618b9980210d37937f8d Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -18,20 +18,22 @@ class QMLDESIGNERCORE_EXPORT NodeAbstractProperty : public AbstractProperty
|
|||||||
friend Internal::ModelPrivate;
|
friend Internal::ModelPrivate;
|
||||||
friend AbstractProperty;
|
friend AbstractProperty;
|
||||||
|
|
||||||
|
using SL = ModelTracing::SourceLocation;
|
||||||
|
|
||||||
friend QMLDESIGNERCORE_EXPORT bool operator ==(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2);
|
friend QMLDESIGNERCORE_EXPORT bool operator ==(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2);
|
||||||
friend QMLDESIGNERCORE_EXPORT bool operator !=(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2);
|
friend QMLDESIGNERCORE_EXPORT bool operator !=(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NodeAbstractProperty();
|
NodeAbstractProperty();
|
||||||
NodeAbstractProperty(const NodeAbstractProperty &property, AbstractView *view);
|
NodeAbstractProperty(const NodeAbstractProperty &property, AbstractView *view);
|
||||||
void reparentHere(const ModelNode &modelNode);
|
void reparentHere(const ModelNode &modelNode, SL sl = {});
|
||||||
bool isEmpty() const;
|
bool isEmpty(SL sl = {}) const;
|
||||||
int count() const;
|
int count(SL sl = {}) const;
|
||||||
int indexOf(const ModelNode &node) const;
|
int indexOf(const ModelNode &node, SL sl = {}) const;
|
||||||
NodeAbstractProperty parentProperty() const;
|
NodeAbstractProperty parentProperty(SL sl = {}) const;
|
||||||
|
|
||||||
QList<ModelNode> allSubNodes();
|
QList<ModelNode> allSubNodes(SL sl = {});
|
||||||
QList<ModelNode> directSubNodes() const;
|
QList<ModelNode> directSubNodes(SL sl = {}) const;
|
||||||
|
|
||||||
friend auto qHash(const NodeAbstractProperty &property) { qHash(AbstractProperty(property)); }
|
friend auto qHash(const NodeAbstractProperty &property) { qHash(AbstractProperty(property)); }
|
||||||
|
|
||||||
|
@@ -157,6 +157,8 @@ class QMLDESIGNERCORE_EXPORT NodeListProperty final : public NodeAbstractPropert
|
|||||||
friend AbstractProperty;
|
friend AbstractProperty;
|
||||||
friend Internal::ModelPrivate;
|
friend Internal::ModelPrivate;
|
||||||
|
|
||||||
|
using SL = ModelTracing::SourceLocation;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using value_type = ModelNode;
|
using value_type = ModelNode;
|
||||||
using iterator = Internal::NodeListPropertyIterator;
|
using iterator = Internal::NodeListPropertyIterator;
|
||||||
@@ -173,26 +175,28 @@ public:
|
|||||||
AbstractView *view)
|
AbstractView *view)
|
||||||
: NodeAbstractProperty(propertyName, internalNode, model, view)
|
: NodeAbstractProperty(propertyName, internalNode, model, view)
|
||||||
{}
|
{}
|
||||||
QList<ModelNode> toModelNodeList() const;
|
|
||||||
void slide(int, int) const;
|
QList<ModelNode> toModelNodeList(SL sl = {}) const;
|
||||||
void swap(int, int) const;
|
void slide(int, int, SL sl = {}) const;
|
||||||
void reparentHere(const ModelNode &modelNode);
|
void swap(int, int, SL sl = {}) const;
|
||||||
ModelNode at(int index) const;
|
void reparentHere(const ModelNode &modelNode, SL sl = {});
|
||||||
void iterSwap(iterator &first, iterator &second);
|
ModelNode at(int index, SL sl = {}) const;
|
||||||
iterator rotate(iterator first, iterator newFirst, iterator last);
|
void iterSwap(iterator &first, iterator &second, SL sl = {});
|
||||||
|
iterator rotate(iterator first, iterator newFirst, iterator last, SL sl = {});
|
||||||
template<typename Range>
|
template<typename Range>
|
||||||
iterator rotate(Range &range, iterator newFirst)
|
iterator rotate(Range &range, iterator newFirst)
|
||||||
{
|
{
|
||||||
return rotate(range.begin(), newFirst, range.end());
|
return rotate(range.begin(), newFirst, range.end());
|
||||||
}
|
}
|
||||||
void reverse(iterator first, iterator last);
|
|
||||||
|
void reverse(iterator first, iterator last, SL sl = {});
|
||||||
template<typename Range>
|
template<typename Range>
|
||||||
void reverse(Range &range)
|
void reverse(Range &range)
|
||||||
{
|
{
|
||||||
reverse(range.begin(), range.end());
|
reverse(range.begin(), range.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reverseModelNodes(const QList<ModelNode> &nodes);
|
static void reverseModelNodes(const QList<ModelNode> &nodes, SL sl = {});
|
||||||
|
|
||||||
iterator begin();
|
iterator begin();
|
||||||
iterator end();
|
iterator end();
|
||||||
|
@@ -16,12 +16,16 @@ class QMLDESIGNERCORE_EXPORT NodeProperty final : public NodeAbstractProperty
|
|||||||
friend Internal::ModelPrivate;
|
friend Internal::ModelPrivate;
|
||||||
friend AbstractProperty;
|
friend AbstractProperty;
|
||||||
|
|
||||||
public:
|
using SL = ModelTracing::SourceLocation;
|
||||||
void setModelNode(const ModelNode &modelNode);
|
|
||||||
ModelNode modelNode() const;
|
|
||||||
|
|
||||||
void reparentHere(const ModelNode &modelNode);
|
public:
|
||||||
void setDynamicTypeNameAndsetModelNode(const TypeName &typeName, const ModelNode &modelNode);
|
void setModelNode(const ModelNode &modelNode, SL sl = {});
|
||||||
|
ModelNode modelNode(SL sl = {}) const;
|
||||||
|
|
||||||
|
void reparentHere(const ModelNode &modelNode, SL sl = {});
|
||||||
|
void setDynamicTypeNameAndsetModelNode(const TypeName &typeName,
|
||||||
|
const ModelNode &modelNode,
|
||||||
|
SL sl = {});
|
||||||
|
|
||||||
NodeProperty();
|
NodeProperty();
|
||||||
|
|
||||||
|
@@ -14,18 +14,20 @@ class QMLDESIGNERCORE_EXPORT SignalHandlerProperty final : public AbstractProper
|
|||||||
friend Internal::ModelPrivate;
|
friend Internal::ModelPrivate;
|
||||||
friend AbstractProperty;
|
friend AbstractProperty;
|
||||||
|
|
||||||
public:
|
using SL = ModelTracing::SourceLocation;
|
||||||
void setSource(const QString &source);
|
|
||||||
QString source() const;
|
|
||||||
QString sourceNormalizedWithBraces() const;
|
|
||||||
|
|
||||||
bool useNewFunctionSyntax();
|
public:
|
||||||
|
void setSource(const QString &source, SL sl = {});
|
||||||
|
QString source(SL sl = {}) const;
|
||||||
|
QString sourceNormalizedWithBraces(SL sl = {}) const;
|
||||||
|
|
||||||
|
bool useNewFunctionSyntax(SL sl = {});
|
||||||
|
|
||||||
SignalHandlerProperty();
|
SignalHandlerProperty();
|
||||||
SignalHandlerProperty(const SignalHandlerProperty &property, AbstractView *view);
|
SignalHandlerProperty(const SignalHandlerProperty &property, AbstractView *view);
|
||||||
|
|
||||||
static PropertyName prefixAdded(PropertyNameView propertyName);
|
static PropertyName prefixAdded(PropertyNameView propertyName, SL sl = {});
|
||||||
static PropertyName prefixRemoved(PropertyNameView propertyName);
|
static PropertyName prefixRemoved(PropertyNameView propertyName, SL sl = {});
|
||||||
|
|
||||||
SignalHandlerProperty(PropertyNameView propertyName,
|
SignalHandlerProperty(PropertyNameView propertyName,
|
||||||
const Internal::InternalNodePointer &internalNode,
|
const Internal::InternalNodePointer &internalNode,
|
||||||
@@ -34,7 +36,7 @@ public:
|
|||||||
: AbstractProperty(propertyName, internalNode, model, view)
|
: AbstractProperty(propertyName, internalNode, model, view)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
static QString normalizedSourceWithBraces(const QString &source);
|
static QString normalizedSourceWithBraces(const QString &source, SL sl = {});
|
||||||
};
|
};
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT SignalDeclarationProperty final : public AbstractProperty
|
class QMLDESIGNERCORE_EXPORT SignalDeclarationProperty final : public AbstractProperty
|
||||||
@@ -43,9 +45,11 @@ class QMLDESIGNERCORE_EXPORT SignalDeclarationProperty final : public AbstractPr
|
|||||||
friend Internal::ModelPrivate;
|
friend Internal::ModelPrivate;
|
||||||
friend AbstractProperty;
|
friend AbstractProperty;
|
||||||
|
|
||||||
|
using SL = ModelTracing::SourceLocation;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setSignature(const QString &source);
|
void setSignature(const QString &source, SL sl = {});
|
||||||
QString signature() const;
|
QString signature(SL sl = {}) const;
|
||||||
|
|
||||||
SignalDeclarationProperty();
|
SignalDeclarationProperty();
|
||||||
SignalDeclarationProperty(const SignalDeclarationProperty &property, AbstractView *view);
|
SignalDeclarationProperty(const SignalDeclarationProperty &property, AbstractView *view);
|
||||||
|
@@ -24,20 +24,24 @@ class QMLDESIGNERCORE_EXPORT VariantProperty final : public AbstractProperty
|
|||||||
friend Internal::ModelPrivate;
|
friend Internal::ModelPrivate;
|
||||||
friend AbstractProperty;
|
friend AbstractProperty;
|
||||||
|
|
||||||
|
using SL = ModelTracing::SourceLocation;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setValue(const QVariant &value);
|
void setValue(const QVariant &value, SL sl = {});
|
||||||
const QVariant &value() const;
|
const QVariant &value(SL sl = {}) const;
|
||||||
|
|
||||||
const QVariant &operator->() const { return value(); }
|
const QVariant &operator->() const { return value(); }
|
||||||
|
|
||||||
const QVariant &operator*() const { return value(); }
|
const QVariant &operator*() const { return value(); }
|
||||||
|
|
||||||
void setEnumeration(const EnumerationName &enumerationName);
|
void setEnumeration(const EnumerationName &enumerationName, SL sl = {});
|
||||||
const Enumeration &enumeration() const;
|
const Enumeration &enumeration(SL sl = {}) const;
|
||||||
bool holdsEnumeration() const;
|
bool holdsEnumeration(SL sl = {}) const;
|
||||||
|
|
||||||
void setDynamicTypeNameAndValue(const TypeName &type, const QVariant &value);
|
void setDynamicTypeNameAndValue(const TypeName &type, const QVariant &value, SL sl = {});
|
||||||
void setDynamicTypeNameAndEnumeration(const TypeName &type, const EnumerationName &enumerationName);
|
void setDynamicTypeNameAndEnumeration(const TypeName &type,
|
||||||
|
const EnumerationName &enumerationName,
|
||||||
|
SL sl = {});
|
||||||
|
|
||||||
VariantProperty();
|
VariantProperty();
|
||||||
VariantProperty(const VariantProperty &property, AbstractView *view);
|
VariantProperty(const VariantProperty &property, AbstractView *view);
|
||||||
|
@@ -25,8 +25,12 @@ NodeAbstractProperty::NodeAbstractProperty(const Internal::InternalNodeAbstractP
|
|||||||
: AbstractProperty(property, model, view)
|
: AbstractProperty(property, model, view)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void NodeAbstractProperty::reparentHere(const ModelNode &modelNode)
|
void NodeAbstractProperty::reparentHere(const ModelNode &modelNode, SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node abstract property reparent here",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!isValid() || !modelNode.isValid())
|
if (!isValid() || !modelNode.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -84,8 +88,12 @@ void NodeAbstractProperty::reparentHere(const ModelNode &modelNode, bool isNode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NodeAbstractProperty::isEmpty() const
|
bool NodeAbstractProperty::isEmpty(SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node abstract property is empty",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (isValid()) {
|
if (isValid()) {
|
||||||
Internal::InternalNodeAbstractProperty::Pointer property = internalNode()->nodeAbstractProperty(
|
Internal::InternalNodeAbstractProperty::Pointer property = internalNode()->nodeAbstractProperty(
|
||||||
name());
|
name());
|
||||||
@@ -98,8 +106,12 @@ bool NodeAbstractProperty::isEmpty() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int NodeAbstractProperty::indexOf(const ModelNode &node) const
|
int NodeAbstractProperty::indexOf(const ModelNode &node, SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node abstract property index of",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (isValid()) {
|
if (isValid()) {
|
||||||
Internal::InternalNodeAbstractProperty::Pointer property = internalNode()->nodeAbstractProperty(
|
Internal::InternalNodeAbstractProperty::Pointer property = internalNode()->nodeAbstractProperty(
|
||||||
name());
|
name());
|
||||||
@@ -112,8 +124,12 @@ int NodeAbstractProperty::indexOf(const ModelNode &node) const
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeAbstractProperty NodeAbstractProperty::parentProperty() const
|
NodeAbstractProperty NodeAbstractProperty::parentProperty(SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node abstract property parent property",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
@@ -123,8 +139,12 @@ NodeAbstractProperty NodeAbstractProperty::parentProperty() const
|
|||||||
return NodeAbstractProperty(internalNode()->parentProperty()->name(), internalNode()->parentProperty()->propertyOwner(), model(), view());
|
return NodeAbstractProperty(internalNode()->parentProperty()->name(), internalNode()->parentProperty()->propertyOwner(), model(), view());
|
||||||
}
|
}
|
||||||
|
|
||||||
int NodeAbstractProperty::count() const
|
int NodeAbstractProperty::count(SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node abstract property count",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
Internal::InternalNodeAbstractProperty::Pointer property = internalNode()->nodeAbstractProperty(name());
|
Internal::InternalNodeAbstractProperty::Pointer property = internalNode()->nodeAbstractProperty(name());
|
||||||
if (!property)
|
if (!property)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -132,8 +152,12 @@ int NodeAbstractProperty::count() const
|
|||||||
return property->count();
|
return property->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ModelNode> NodeAbstractProperty::allSubNodes()
|
QList<ModelNode> NodeAbstractProperty::allSubNodes(SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node abstract property all sub nodes",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!internalNode() || !internalNode()->isValid)
|
if (!internalNode() || !internalNode()->isValid)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
@@ -162,8 +186,12 @@ QList<ModelNode> NodeAbstractProperty::allSubNodes()
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ModelNode> NodeAbstractProperty::directSubNodes() const
|
QList<ModelNode> NodeAbstractProperty::directSubNodes(SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node abstract property direct sub nodes",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!internalNode() || !internalNode()->isValid)
|
if (!internalNode() || !internalNode()->isValid)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
|
@@ -50,8 +50,12 @@ static QList<ModelNode> internalNodesToModelNodes(const auto &inputList, Model *
|
|||||||
return modelNodeList;
|
return modelNodeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ModelNode> NodeListProperty::toModelNodeList() const
|
QList<ModelNode> NodeListProperty::toModelNodeList(SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node list property to model node list",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
@@ -61,8 +65,12 @@ QList<ModelNode> NodeListProperty::toModelNodeList() const
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeListProperty::slide(int from, int to) const
|
void NodeListProperty::slide(int from, int to, SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node list property slide",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
Internal::WriteLocker locker(model());
|
Internal::WriteLocker locker(model());
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return;
|
return;
|
||||||
@@ -74,8 +82,12 @@ void NodeListProperty::slide(int from, int to) const
|
|||||||
privateModel()->changeNodeOrder(internalNodeSharedPointer(), name(), from, to);
|
privateModel()->changeNodeOrder(internalNodeSharedPointer(), name(), from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeListProperty::swap(int from, int to) const
|
void NodeListProperty::swap(int from, int to, SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node list property swap",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (from == to)
|
if (from == to)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -92,13 +104,21 @@ void NodeListProperty::swap(int from, int to) const
|
|||||||
slide(a + 1, b);
|
slide(a + 1, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeListProperty::reparentHere(const ModelNode &modelNode)
|
void NodeListProperty::reparentHere(const ModelNode &modelNode, SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node list property reparent here",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
NodeAbstractProperty::reparentHere(modelNode, true);
|
NodeAbstractProperty::reparentHere(modelNode, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelNode NodeListProperty::at(int index) const
|
ModelNode NodeListProperty::at(int index, SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node list property at",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
@@ -108,8 +128,14 @@ ModelNode NodeListProperty::at(int index) const
|
|||||||
return ModelNode();
|
return ModelNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeListProperty::iterSwap(NodeListProperty::iterator &first, NodeListProperty::iterator &second)
|
void NodeListProperty::iterSwap(NodeListProperty::iterator &first,
|
||||||
|
NodeListProperty::iterator &second,
|
||||||
|
SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node list property iter swap",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -122,8 +148,13 @@ void NodeListProperty::iterSwap(NodeListProperty::iterator &first, NodeListPrope
|
|||||||
|
|
||||||
NodeListProperty::iterator NodeListProperty::rotate(NodeListProperty::iterator first,
|
NodeListProperty::iterator NodeListProperty::rotate(NodeListProperty::iterator first,
|
||||||
NodeListProperty::iterator newFirst,
|
NodeListProperty::iterator newFirst,
|
||||||
NodeListProperty::iterator last)
|
NodeListProperty::iterator last,
|
||||||
|
SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node list property rotate",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
@@ -141,8 +172,12 @@ NodeListProperty::iterator NodeListProperty::rotate(NodeListProperty::iterator f
|
|||||||
return {iter - begin, internalNodeListProperty().get(), model(), view()};
|
return {iter - begin, internalNodeListProperty().get(), model(), view()};
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeListProperty::reverse(NodeListProperty::iterator first, NodeListProperty::iterator last)
|
void NodeListProperty::reverse(NodeListProperty::iterator first, NodeListProperty::iterator last, SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node list property reverse",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -156,8 +191,12 @@ void NodeListProperty::reverse(NodeListProperty::iterator first, NodeListPropert
|
|||||||
privateModel()->notifyNodeOrderChanged(m_internalNodeListProperty.get());
|
privateModel()->notifyNodeOrderChanged(m_internalNodeListProperty.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeListProperty::reverseModelNodes(const QList<ModelNode> &nodes)
|
void NodeListProperty::reverseModelNodes(const QList<ModelNode> &nodes, SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node list property reverse model nodes",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
ModelNode firstNode = nodes.first();
|
ModelNode firstNode = nodes.first();
|
||||||
if (!firstNode.isValid())
|
if (!firstNode.isValid())
|
||||||
return;
|
return;
|
||||||
|
@@ -10,8 +10,12 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
NodeProperty::NodeProperty() = default;
|
NodeProperty::NodeProperty() = default;
|
||||||
|
|
||||||
void NodeProperty::setModelNode(const ModelNode &modelNode)
|
void NodeProperty::setModelNode(const ModelNode &modelNode, SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node property set model node",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -33,8 +37,12 @@ void NodeProperty::setModelNode(const ModelNode &modelNode)
|
|||||||
false); //### we have to add a flag that this is not a list
|
false); //### we have to add a flag that this is not a list
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelNode NodeProperty::modelNode() const
|
ModelNode NodeProperty::modelNode(SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node property model node",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
@@ -45,13 +53,23 @@ ModelNode NodeProperty::modelNode() const
|
|||||||
return ModelNode();
|
return ModelNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeProperty::reparentHere(const ModelNode &modelNode)
|
void NodeProperty::reparentHere(const ModelNode &modelNode, SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node property reparent here",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
NodeAbstractProperty::reparentHere(modelNode, false);
|
NodeAbstractProperty::reparentHere(modelNode, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeProperty::setDynamicTypeNameAndsetModelNode(const TypeName &typeName, const ModelNode &modelNode)
|
void NodeProperty::setDynamicTypeNameAndsetModelNode(const TypeName &typeName,
|
||||||
|
const ModelNode &modelNode,
|
||||||
|
SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"node property set dynamic type and set model node",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!modelNode.isValid())
|
if (!modelNode.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -19,8 +19,12 @@ SignalHandlerProperty::SignalHandlerProperty(const SignalHandlerProperty &proper
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalHandlerProperty::setSource(const QString &source)
|
void SignalHandlerProperty::setSource(const QString &source, SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"signal handler property set source",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
Internal::WriteLocker locker(model());
|
Internal::WriteLocker locker(model());
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return;
|
return;
|
||||||
@@ -44,8 +48,12 @@ void SignalHandlerProperty::setSource(const QString &source)
|
|||||||
privateModel()->setSignalHandlerProperty(internalNodeSharedPointer(), name(), source);
|
privateModel()->setSignalHandlerProperty(internalNodeSharedPointer(), name(), source);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SignalHandlerProperty::source() const
|
QString SignalHandlerProperty::source(SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"signal handler property source",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
@@ -55,13 +63,21 @@ QString SignalHandlerProperty::source() const
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SignalHandlerProperty::sourceNormalizedWithBraces() const
|
QString SignalHandlerProperty::sourceNormalizedWithBraces(SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"signal handler property source normalized with braces",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
return normalizedSourceWithBraces(source());
|
return normalizedSourceWithBraces(source());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SignalHandlerProperty::useNewFunctionSyntax()
|
bool SignalHandlerProperty::useNewFunctionSyntax(SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"signal handler property use new function syntax",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (name().contains('.'))
|
if (name().contains('.'))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -74,8 +90,12 @@ bool SignalHandlerProperty::useNewFunctionSyntax()
|
|||||||
return parentModelNode().metaInfo().isQtQmlConnections();
|
return parentModelNode().metaInfo().isQtQmlConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyName SignalHandlerProperty::prefixAdded(PropertyNameView propertyName)
|
PropertyName SignalHandlerProperty::prefixAdded(PropertyNameView propertyName, SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"signal handler property prefix added",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
QString nameAsString = QString::fromUtf8(propertyName);
|
QString nameAsString = QString::fromUtf8(propertyName);
|
||||||
if (propertyName.startsWith("on"))
|
if (propertyName.startsWith("on"))
|
||||||
return propertyName.toByteArray();
|
return propertyName.toByteArray();
|
||||||
@@ -87,8 +107,12 @@ PropertyName SignalHandlerProperty::prefixAdded(PropertyNameView propertyName)
|
|||||||
return nameAsString.toLatin1();
|
return nameAsString.toLatin1();
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyName SignalHandlerProperty::prefixRemoved(PropertyNameView propertyName)
|
PropertyName SignalHandlerProperty::prefixRemoved(PropertyNameView propertyName, SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"signal handler property prefix removed",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
QString nameAsString = QString::fromUtf8(propertyName);
|
QString nameAsString = QString::fromUtf8(propertyName);
|
||||||
if (!nameAsString.startsWith("on"))
|
if (!nameAsString.startsWith("on"))
|
||||||
return propertyName.toByteArray();
|
return propertyName.toByteArray();
|
||||||
@@ -100,8 +124,12 @@ PropertyName SignalHandlerProperty::prefixRemoved(PropertyNameView propertyName)
|
|||||||
return nameAsString.toLatin1();
|
return nameAsString.toLatin1();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SignalHandlerProperty::normalizedSourceWithBraces(const QString &source)
|
QString SignalHandlerProperty::normalizedSourceWithBraces(const QString &source, SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"signal handler property normalized source with braces",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
static const QRegularExpression reg("^\\{(\\s*?.*?)*?\\}$");
|
static const QRegularExpression reg("^\\{(\\s*?.*?)*?\\}$");
|
||||||
|
|
||||||
const QString trimmed = source.trimmed();
|
const QString trimmed = source.trimmed();
|
||||||
@@ -120,8 +148,12 @@ SignalDeclarationProperty::SignalDeclarationProperty(const SignalDeclarationProp
|
|||||||
: AbstractProperty(property.name(), property.internalNodeSharedPointer(), property.model(), view)
|
: AbstractProperty(property.name(), property.internalNodeSharedPointer(), property.model(), view)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void SignalDeclarationProperty::setSignature(const QString &signature)
|
void SignalDeclarationProperty::setSignature(const QString &signature, SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"signal declaration property set signature",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
Internal::WriteLocker locker(model());
|
Internal::WriteLocker locker(model());
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return;
|
return;
|
||||||
@@ -145,8 +177,12 @@ void SignalDeclarationProperty::setSignature(const QString &signature)
|
|||||||
privateModel()->setSignalDeclarationProperty(internalNodeSharedPointer(), name(), signature);
|
privateModel()->setSignalDeclarationProperty(internalNodeSharedPointer(), name(), signature);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SignalDeclarationProperty::signature() const
|
QString SignalDeclarationProperty::signature(SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"signal declaration property signature",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
|
@@ -19,8 +19,12 @@ VariantProperty::VariantProperty(const VariantProperty &property, AbstractView *
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VariantProperty::setValue(const QVariant &value)
|
void VariantProperty::setValue(const QVariant &value, SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"variant property set value",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -47,8 +51,12 @@ void VariantProperty::setValue(const QVariant &value)
|
|||||||
privateModel()->setVariantProperty(internalNodeSharedPointer(), name(), value);
|
privateModel()->setVariantProperty(internalNodeSharedPointer(), name(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QVariant &VariantProperty::value() const
|
const QVariant &VariantProperty::value(SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"variant property value",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (isValid()) {
|
if (isValid()) {
|
||||||
auto property = internalNode()->variantProperty(name());
|
auto property = internalNode()->variantProperty(name());
|
||||||
if (property)
|
if (property)
|
||||||
@@ -60,13 +68,21 @@ const QVariant &VariantProperty::value() const
|
|||||||
return nullVariant;
|
return nullVariant;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VariantProperty::setEnumeration(const EnumerationName &enumerationName)
|
void VariantProperty::setEnumeration(const EnumerationName &enumerationName, SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"variant property set enumeration",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
setValue(QVariant::fromValue(Enumeration(enumerationName)));
|
setValue(QVariant::fromValue(Enumeration(enumerationName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
const Enumeration &VariantProperty::enumeration() const
|
const Enumeration &VariantProperty::enumeration(SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"variant property enumeration",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (auto enumeration = get_if<Enumeration>(&value()))
|
if (auto enumeration = get_if<Enumeration>(&value()))
|
||||||
return *enumeration;
|
return *enumeration;
|
||||||
|
|
||||||
@@ -75,13 +91,21 @@ const Enumeration &VariantProperty::enumeration() const
|
|||||||
return nullEnumeration;
|
return nullEnumeration;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VariantProperty::holdsEnumeration() const
|
bool VariantProperty::holdsEnumeration(SL sl) const
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"variant property holds enumeration",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
return value().canConvert<Enumeration>();
|
return value().canConvert<Enumeration>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VariantProperty::setDynamicTypeNameAndValue(const TypeName &type, const QVariant &value)
|
void VariantProperty::setDynamicTypeNameAndValue(const TypeName &type, const QVariant &value, SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"variant property set dtnamic type name and value",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
if (!isValid())
|
if (!isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -104,8 +128,14 @@ void VariantProperty::setDynamicTypeNameAndValue(const TypeName &type, const QVa
|
|||||||
privateModel()->setDynamicVariantProperty(internalNodeSharedPointer(), name(), type, value);
|
privateModel()->setDynamicVariantProperty(internalNodeSharedPointer(), name(), type, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VariantProperty::setDynamicTypeNameAndEnumeration(const TypeName &type, const EnumerationName &enumerationName)
|
void VariantProperty::setDynamicTypeNameAndEnumeration(const TypeName &type,
|
||||||
|
const EnumerationName &enumerationName,
|
||||||
|
SL sl)
|
||||||
{
|
{
|
||||||
|
NanotraceHR::Tracer tracer{"variant property set dynamic type name and enumeration",
|
||||||
|
ModelTracing::category(),
|
||||||
|
keyValue("caller location", sl)};
|
||||||
|
|
||||||
setDynamicTypeNameAndValue(type, QVariant::fromValue(Enumeration(enumerationName)));
|
setDynamicTypeNameAndValue(type, QVariant::fromValue(Enumeration(enumerationName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user