From de7cacac4d74051f5bba385606b0f018f85e00c9 Mon Sep 17 00:00:00 2001 From: Burak Hancerli Date: Fri, 23 May 2025 10:41:01 +0200 Subject: [PATCH] QmlDesigner: Extend the tracer to the properties Task-number: QDS-15148 Change-Id: Ib87b5db1d17e76a9c18a618b9980210d37937f8d Reviewed-by: Marco Bubke --- .../include/nodeabstractproperty.h | 16 +++--- .../designercore/include/nodelistproperty.h | 22 ++++--- .../libs/designercore/include/nodeproperty.h | 14 +++-- .../include/signalhandlerproperty.h | 24 ++++---- .../designercore/include/variantproperty.h | 18 +++--- .../model/nodeabstractproperty.cpp | 42 +++++++++++--- .../designercore/model/nodelistproperty.cpp | 57 ++++++++++++++++--- .../libs/designercore/model/nodeproperty.cpp | 26 +++++++-- .../model/signalhandlerproperty.cpp | 54 +++++++++++++++--- .../designercore/model/variantproperty.cpp | 44 +++++++++++--- 10 files changed, 243 insertions(+), 74 deletions(-) diff --git a/src/plugins/qmldesigner/libs/designercore/include/nodeabstractproperty.h b/src/plugins/qmldesigner/libs/designercore/include/nodeabstractproperty.h index 1790810f8b9..7483874a46e 100644 --- a/src/plugins/qmldesigner/libs/designercore/include/nodeabstractproperty.h +++ b/src/plugins/qmldesigner/libs/designercore/include/nodeabstractproperty.h @@ -18,20 +18,22 @@ class QMLDESIGNERCORE_EXPORT NodeAbstractProperty : public AbstractProperty friend Internal::ModelPrivate; 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); public: NodeAbstractProperty(); NodeAbstractProperty(const NodeAbstractProperty &property, AbstractView *view); - void reparentHere(const ModelNode &modelNode); - bool isEmpty() const; - int count() const; - int indexOf(const ModelNode &node) const; - NodeAbstractProperty parentProperty() const; + void reparentHere(const ModelNode &modelNode, SL sl = {}); + bool isEmpty(SL sl = {}) const; + int count(SL sl = {}) const; + int indexOf(const ModelNode &node, SL sl = {}) const; + NodeAbstractProperty parentProperty(SL sl = {}) const; - QList allSubNodes(); - QList directSubNodes() const; + QList allSubNodes(SL sl = {}); + QList directSubNodes(SL sl = {}) const; friend auto qHash(const NodeAbstractProperty &property) { qHash(AbstractProperty(property)); } diff --git a/src/plugins/qmldesigner/libs/designercore/include/nodelistproperty.h b/src/plugins/qmldesigner/libs/designercore/include/nodelistproperty.h index 3e6df272905..8499a806f12 100644 --- a/src/plugins/qmldesigner/libs/designercore/include/nodelistproperty.h +++ b/src/plugins/qmldesigner/libs/designercore/include/nodelistproperty.h @@ -157,6 +157,8 @@ class QMLDESIGNERCORE_EXPORT NodeListProperty final : public NodeAbstractPropert friend AbstractProperty; friend Internal::ModelPrivate; + using SL = ModelTracing::SourceLocation; + public: using value_type = ModelNode; using iterator = Internal::NodeListPropertyIterator; @@ -173,26 +175,28 @@ public: AbstractView *view) : NodeAbstractProperty(propertyName, internalNode, model, view) {} - QList toModelNodeList() const; - void slide(int, int) const; - void swap(int, int) const; - void reparentHere(const ModelNode &modelNode); - ModelNode at(int index) const; - void iterSwap(iterator &first, iterator &second); - iterator rotate(iterator first, iterator newFirst, iterator last); + + QList toModelNodeList(SL sl = {}) const; + void slide(int, int, SL sl = {}) const; + void swap(int, int, SL sl = {}) const; + void reparentHere(const ModelNode &modelNode, SL sl = {}); + ModelNode at(int index, SL sl = {}) const; + void iterSwap(iterator &first, iterator &second, SL sl = {}); + iterator rotate(iterator first, iterator newFirst, iterator last, SL sl = {}); template iterator rotate(Range &range, iterator newFirst) { return rotate(range.begin(), newFirst, range.end()); } - void reverse(iterator first, iterator last); + + void reverse(iterator first, iterator last, SL sl = {}); template void reverse(Range &range) { reverse(range.begin(), range.end()); } - static void reverseModelNodes(const QList &nodes); + static void reverseModelNodes(const QList &nodes, SL sl = {}); iterator begin(); iterator end(); diff --git a/src/plugins/qmldesigner/libs/designercore/include/nodeproperty.h b/src/plugins/qmldesigner/libs/designercore/include/nodeproperty.h index b9afe1d4188..af5b8d57777 100644 --- a/src/plugins/qmldesigner/libs/designercore/include/nodeproperty.h +++ b/src/plugins/qmldesigner/libs/designercore/include/nodeproperty.h @@ -16,12 +16,16 @@ class QMLDESIGNERCORE_EXPORT NodeProperty final : public NodeAbstractProperty friend Internal::ModelPrivate; friend AbstractProperty; -public: - void setModelNode(const ModelNode &modelNode); - ModelNode modelNode() const; + using SL = ModelTracing::SourceLocation; - void reparentHere(const ModelNode &modelNode); - void setDynamicTypeNameAndsetModelNode(const TypeName &typeName, const ModelNode &modelNode); +public: + 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(); diff --git a/src/plugins/qmldesigner/libs/designercore/include/signalhandlerproperty.h b/src/plugins/qmldesigner/libs/designercore/include/signalhandlerproperty.h index f76f1b0d90a..13fb54bad54 100644 --- a/src/plugins/qmldesigner/libs/designercore/include/signalhandlerproperty.h +++ b/src/plugins/qmldesigner/libs/designercore/include/signalhandlerproperty.h @@ -14,18 +14,20 @@ class QMLDESIGNERCORE_EXPORT SignalHandlerProperty final : public AbstractProper friend Internal::ModelPrivate; friend AbstractProperty; -public: - void setSource(const QString &source); - QString source() const; - QString sourceNormalizedWithBraces() const; + using SL = ModelTracing::SourceLocation; - 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(const SignalHandlerProperty &property, AbstractView *view); - static PropertyName prefixAdded(PropertyNameView propertyName); - static PropertyName prefixRemoved(PropertyNameView propertyName); + static PropertyName prefixAdded(PropertyNameView propertyName, SL sl = {}); + static PropertyName prefixRemoved(PropertyNameView propertyName, SL sl = {}); SignalHandlerProperty(PropertyNameView propertyName, const Internal::InternalNodePointer &internalNode, @@ -34,7 +36,7 @@ public: : 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 @@ -43,9 +45,11 @@ class QMLDESIGNERCORE_EXPORT SignalDeclarationProperty final : public AbstractPr friend Internal::ModelPrivate; friend AbstractProperty; + using SL = ModelTracing::SourceLocation; + public: - void setSignature(const QString &source); - QString signature() const; + void setSignature(const QString &source, SL sl = {}); + QString signature(SL sl = {}) const; SignalDeclarationProperty(); SignalDeclarationProperty(const SignalDeclarationProperty &property, AbstractView *view); diff --git a/src/plugins/qmldesigner/libs/designercore/include/variantproperty.h b/src/plugins/qmldesigner/libs/designercore/include/variantproperty.h index ae2fc1a7c45..dee5a440600 100644 --- a/src/plugins/qmldesigner/libs/designercore/include/variantproperty.h +++ b/src/plugins/qmldesigner/libs/designercore/include/variantproperty.h @@ -24,20 +24,24 @@ class QMLDESIGNERCORE_EXPORT VariantProperty final : public AbstractProperty friend Internal::ModelPrivate; friend AbstractProperty; + using SL = ModelTracing::SourceLocation; + public: - void setValue(const QVariant &value); - const QVariant &value() const; + void setValue(const QVariant &value, SL sl = {}); + const QVariant &value(SL sl = {}) const; const QVariant &operator->() const { return value(); } const QVariant &operator*() const { return value(); } - void setEnumeration(const EnumerationName &enumerationName); - const Enumeration &enumeration() const; - bool holdsEnumeration() const; + void setEnumeration(const EnumerationName &enumerationName, SL sl = {}); + const Enumeration &enumeration(SL sl = {}) const; + bool holdsEnumeration(SL sl = {}) const; - void setDynamicTypeNameAndValue(const TypeName &type, const QVariant &value); - void setDynamicTypeNameAndEnumeration(const TypeName &type, const EnumerationName &enumerationName); + void setDynamicTypeNameAndValue(const TypeName &type, const QVariant &value, SL sl = {}); + void setDynamicTypeNameAndEnumeration(const TypeName &type, + const EnumerationName &enumerationName, + SL sl = {}); VariantProperty(); VariantProperty(const VariantProperty &property, AbstractView *view); diff --git a/src/plugins/qmldesigner/libs/designercore/model/nodeabstractproperty.cpp b/src/plugins/qmldesigner/libs/designercore/model/nodeabstractproperty.cpp index bad9c95cb0b..faa05741215 100644 --- a/src/plugins/qmldesigner/libs/designercore/model/nodeabstractproperty.cpp +++ b/src/plugins/qmldesigner/libs/designercore/model/nodeabstractproperty.cpp @@ -25,8 +25,12 @@ NodeAbstractProperty::NodeAbstractProperty(const Internal::InternalNodeAbstractP : 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()) 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()) { Internal::InternalNodeAbstractProperty::Pointer property = internalNode()->nodeAbstractProperty( name()); @@ -98,8 +106,12 @@ bool NodeAbstractProperty::isEmpty() const 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()) { Internal::InternalNodeAbstractProperty::Pointer property = internalNode()->nodeAbstractProperty( name()); @@ -112,8 +124,12 @@ int NodeAbstractProperty::indexOf(const ModelNode &node) const 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()) return {}; @@ -123,8 +139,12 @@ NodeAbstractProperty NodeAbstractProperty::parentProperty() const 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()); if (!property) return 0; @@ -132,8 +152,12 @@ int NodeAbstractProperty::count() const return property->count(); } -QList NodeAbstractProperty::allSubNodes() +QList NodeAbstractProperty::allSubNodes(SL sl) { + NanotraceHR::Tracer tracer{"node abstract property all sub nodes", + ModelTracing::category(), + keyValue("caller location", sl)}; + if (!internalNode() || !internalNode()->isValid) return {}; @@ -162,8 +186,12 @@ QList NodeAbstractProperty::allSubNodes() return {}; } -QList NodeAbstractProperty::directSubNodes() const +QList NodeAbstractProperty::directSubNodes(SL sl) const { + NanotraceHR::Tracer tracer{"node abstract property direct sub nodes", + ModelTracing::category(), + keyValue("caller location", sl)}; + if (!internalNode() || !internalNode()->isValid) return {}; diff --git a/src/plugins/qmldesigner/libs/designercore/model/nodelistproperty.cpp b/src/plugins/qmldesigner/libs/designercore/model/nodelistproperty.cpp index 2428c6542ca..ebbf0ef60bb 100644 --- a/src/plugins/qmldesigner/libs/designercore/model/nodelistproperty.cpp +++ b/src/plugins/qmldesigner/libs/designercore/model/nodelistproperty.cpp @@ -50,8 +50,12 @@ static QList internalNodesToModelNodes(const auto &inputList, Model * return modelNodeList; } -QList NodeListProperty::toModelNodeList() const +QList NodeListProperty::toModelNodeList(SL sl) const { + NanotraceHR::Tracer tracer{"node list property to model node list", + ModelTracing::category(), + keyValue("caller location", sl)}; + if (!isValid()) return {}; @@ -61,8 +65,12 @@ QList NodeListProperty::toModelNodeList() const 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()); if (!isValid()) return; @@ -74,8 +82,12 @@ void NodeListProperty::slide(int from, int to) const 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) return; @@ -92,13 +104,21 @@ void NodeListProperty::swap(int from, int to) const 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); } -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()) return {}; @@ -108,8 +128,14 @@ ModelNode NodeListProperty::at(int index) const 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()) return; @@ -122,8 +148,13 @@ void NodeListProperty::iterSwap(NodeListProperty::iterator &first, NodeListPrope NodeListProperty::iterator NodeListProperty::rotate(NodeListProperty::iterator first, 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()) return {}; @@ -141,8 +172,12 @@ NodeListProperty::iterator NodeListProperty::rotate(NodeListProperty::iterator f 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()) return; @@ -156,8 +191,12 @@ void NodeListProperty::reverse(NodeListProperty::iterator first, NodeListPropert privateModel()->notifyNodeOrderChanged(m_internalNodeListProperty.get()); } -void NodeListProperty::reverseModelNodes(const QList &nodes) +void NodeListProperty::reverseModelNodes(const QList &nodes, SL sl) { + NanotraceHR::Tracer tracer{"node list property reverse model nodes", + ModelTracing::category(), + keyValue("caller location", sl)}; + ModelNode firstNode = nodes.first(); if (!firstNode.isValid()) return; diff --git a/src/plugins/qmldesigner/libs/designercore/model/nodeproperty.cpp b/src/plugins/qmldesigner/libs/designercore/model/nodeproperty.cpp index e8988c7433e..bd23b3f1843 100644 --- a/src/plugins/qmldesigner/libs/designercore/model/nodeproperty.cpp +++ b/src/plugins/qmldesigner/libs/designercore/model/nodeproperty.cpp @@ -10,8 +10,12 @@ namespace QmlDesigner { 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()) return; @@ -33,8 +37,12 @@ void NodeProperty::setModelNode(const ModelNode &modelNode) 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()) return {}; @@ -45,13 +53,23 @@ ModelNode NodeProperty::modelNode() const 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); } -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()) return; diff --git a/src/plugins/qmldesigner/libs/designercore/model/signalhandlerproperty.cpp b/src/plugins/qmldesigner/libs/designercore/model/signalhandlerproperty.cpp index e02ca7b6dd3..6beaa9214ee 100644 --- a/src/plugins/qmldesigner/libs/designercore/model/signalhandlerproperty.cpp +++ b/src/plugins/qmldesigner/libs/designercore/model/signalhandlerproperty.cpp @@ -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()); if (!isValid()) return; @@ -44,8 +48,12 @@ void SignalHandlerProperty::setSource(const QString &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()) return {}; @@ -55,13 +63,21 @@ QString SignalHandlerProperty::source() const 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()); } -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('.')) return false; @@ -74,8 +90,12 @@ bool SignalHandlerProperty::useNewFunctionSyntax() 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); if (propertyName.startsWith("on")) return propertyName.toByteArray(); @@ -87,8 +107,12 @@ PropertyName SignalHandlerProperty::prefixAdded(PropertyNameView propertyName) 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); if (!nameAsString.startsWith("on")) return propertyName.toByteArray(); @@ -100,8 +124,12 @@ PropertyName SignalHandlerProperty::prefixRemoved(PropertyNameView propertyName) 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*?.*?)*?\\}$"); const QString trimmed = source.trimmed(); @@ -120,8 +148,12 @@ SignalDeclarationProperty::SignalDeclarationProperty(const SignalDeclarationProp : 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()); if (!isValid()) return; @@ -145,8 +177,12 @@ void SignalDeclarationProperty::setSignature(const QString &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()) return {}; diff --git a/src/plugins/qmldesigner/libs/designercore/model/variantproperty.cpp b/src/plugins/qmldesigner/libs/designercore/model/variantproperty.cpp index bf49c3678ab..edf79f990e7 100644 --- a/src/plugins/qmldesigner/libs/designercore/model/variantproperty.cpp +++ b/src/plugins/qmldesigner/libs/designercore/model/variantproperty.cpp @@ -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()) return; @@ -47,8 +51,12 @@ void VariantProperty::setValue(const QVariant &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()) { auto property = internalNode()->variantProperty(name()); if (property) @@ -60,13 +68,21 @@ const QVariant &VariantProperty::value() const 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))); } -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(&value())) return *enumeration; @@ -75,13 +91,21 @@ const Enumeration &VariantProperty::enumeration() const 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(); } -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()) return; @@ -104,8 +128,14 @@ void VariantProperty::setDynamicTypeNameAndValue(const TypeName &type, const QVa 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))); }