aboutsummaryrefslogtreecommitdiffstats
diff options
authorBurak Hancerli <burak.hancerli@qt.io>2025-04-07 12:45:44 +0200
committerBurak Hancerli <burak.hancerli@qt.io>2025-04-22 17:07:01 +0000
commite21a628c7df4ad39342b5185446f59d1791d4254 (patch)
tree69f1118c7e60b3247e341bbf59993c3c76370673
parentf2342f2563cf11bfddbcfbc7fdaac20363c33fc9 (diff)
QmlDesigner: Add trace points to modelnode
Task-number: QDS-15148 Change-Id: Ied23cefa319dfff8936cf91815454cb2558f3405 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp21
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp2
-rw-r--r--src/plugins/qmldesigner/components/scripteditor/propertytreemodel.cpp4
-rw-r--r--src/plugins/qmldesigner/components/scripteditor/scripteditorbackend.cpp6
-rw-r--r--src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp4
-rw-r--r--src/plugins/qmldesigner/components/transitioneditor/transitionform.cpp8
-rw-r--r--src/plugins/qmldesigner/libs/designercore/designercoreutils/functional.h5
-rw-r--r--src/plugins/qmldesigner/libs/designercore/include/modelnode.h260
-rw-r--r--src/plugins/qmldesigner/libs/designercore/model/modelnode.cpp1020
-rw-r--r--tests/unit/tests/matchers/property-matcher.h16
-rw-r--r--tests/unit/tests/unittests/designsystem/dsthemeqml-test.cpp6
-rw-r--r--tests/unit/tests/unittests/listmodeleditor/listmodeleditor-test.cpp11
12 files changed, 1043 insertions, 320 deletions
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp
index 6aef3705439..238ba83b4e2 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp
@@ -8,12 +8,13 @@
#include "propertyeditorvalue.h"
#include "propertyeditorwidget.h"
+#include "qmldesignerplugin.h"
#include <asset.h>
#include <auxiliarydataproperties.h>
#include <dynamicpropertiesmodel.h>
+#include <functional.h>
#include <nodemetainfo.h>
#include <qmldesignerconstants.h>
-#include "qmldesignerplugin.h"
#include <qmltimeline.h>
#include <rewritingexception.h>
@@ -863,11 +864,16 @@ void PropertyEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode)
const ModelNodes &allRemovedNodes = removedNode.allSubModelNodesAndThisNode();
- if (Utils::contains(allRemovedNodes, model()->qtQuick3DTextureMetaInfo(), &ModelNode::metaInfo))
+ using SL = ModelTracing::SourceLocation;
+ if (Utils::contains(allRemovedNodes,
+ model()->qtQuick3DTextureMetaInfo(),
+ bind_back(&ModelNode::metaInfo, SL{})))
m_textureAboutToBeRemoved = true;
if (m_qmlBackEndForCurrentType) {
- if (Utils::contains(allRemovedNodes, QLatin1String{Constants::MATERIAL_LIB_ID}, &ModelNode::id))
+ if (Utils::contains(allRemovedNodes,
+ QLatin1String{Constants::MATERIAL_LIB_ID},
+ bind_back(&ModelNode::id, SL{})))
m_qmlBackEndForCurrentType->contextObject()->setHasMaterialLibrary(false);
}
}
@@ -1262,12 +1268,17 @@ void PropertyEditorView::nodeReparented(const ModelNode &node,
if (node == activeNode())
m_qmlBackEndForCurrentType->backendAnchorBinding().setup(QmlItemNode(activeNode()));
+ using SL = const ModelTracing::SourceLocation;
const ModelNodes &allNodes = node.allSubModelNodesAndThisNode();
- if (Utils::contains(allNodes, model()->qtQuick3DTextureMetaInfo(), &ModelNode::metaInfo))
+ if (Utils::contains(allNodes,
+ model()->qtQuick3DTextureMetaInfo(),
+ bind_back(&ModelNode::metaInfo, SL{})))
m_qmlBackEndForCurrentType->refreshBackendModel();
if (m_qmlBackEndForCurrentType) {
- if (Utils::contains(allNodes, QLatin1String{Constants::MATERIAL_LIB_ID}, &ModelNode::id))
+ if (Utils::contains(allNodes,
+ QLatin1String{Constants::MATERIAL_LIB_ID},
+ bind_back(&ModelNode::id, SL{})))
m_qmlBackEndForCurrentType->contextObject()->setHasMaterialLibrary(true);
}
}
diff --git a/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp b/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp
index 07c7537c852..1f51e37ec7e 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/qmlmodelnodeproxy.cpp
@@ -120,7 +120,7 @@ QString QmlModelNodeProxy::simplifiedTypeName() const
static QList<int> toInternalIdList(const QList<ModelNode> &nodes)
{
- return Utils::transform(nodes, &ModelNode::internalId);
+ return Utils::transform(nodes, [](const ModelNode &node) { return node.internalId(); });
}
QList<int> QmlModelNodeProxy::allChildren(int internalId) const
diff --git a/src/plugins/qmldesigner/components/scripteditor/propertytreemodel.cpp b/src/plugins/qmldesigner/components/scripteditor/propertytreemodel.cpp
index b1892c9b557..86c6cf33b5b 100644
--- a/src/plugins/qmldesigner/components/scripteditor/propertytreemodel.cpp
+++ b/src/plugins/qmldesigner/components/scripteditor/propertytreemodel.cpp
@@ -7,6 +7,7 @@
#include <bindingproperty.h>
#include <designeralgorithm.h>
#include <exception.h>
+#include <functional.h>
#include <modelutils.h>
#include <nodeabstractproperty.h>
#include <nodelistproperty.h>
@@ -904,7 +905,8 @@ void PropertyTreeModelDelegate::setPropertyType(PropertyTreeModel::PropertyTypes
void PropertyTreeModelDelegate::setup(const QString &id, const QString &name, bool *nameExists)
{
m_model.resetModel();
- QStringList idLists = Utils::transform(m_model.nodeList(), &ModelNode::id);
+ using SL = ModelTracing::SourceLocation;
+ QStringList idLists = Utils::transform(m_model.nodeList(), bind_back(&ModelNode::id, SL{}));
if (!idLists.contains(id))
idLists.prepend(id);
diff --git a/src/plugins/qmldesigner/components/scripteditor/scripteditorbackend.cpp b/src/plugins/qmldesigner/components/scripteditor/scripteditorbackend.cpp
index 3bf324336b6..ae232fc8262 100644
--- a/src/plugins/qmldesigner/components/scripteditor/scripteditorbackend.cpp
+++ b/src/plugins/qmldesigner/components/scripteditor/scripteditorbackend.cpp
@@ -6,6 +6,7 @@
#include "scripteditorutils.h"
#include <abstractview.h>
+#include <functional.h>
#include <indentingtexteditormodifier.h>
#include <modelnodeoperations.h>
#include <nodelistproperty.h>
@@ -842,13 +843,14 @@ void StatementDelegate::setupChangeState()
&& !item.allStateNames().isEmpty();
});
- QStringList itemIds = Utils::transform(items, &ModelNode::id);
+ using SL = ModelTracing::SourceLocation;
+ QStringList itemIds = Utils::transform(items, bind_back(&ModelNode::id, SL{}));
const auto groups = m_view->allModelNodesOfType(model->qtQuickStateGroupMetaInfo());
const auto rootId = m_view->rootModelNode().id();
itemIds.removeAll(rootId);
- QStringList groupIds = Utils::transform(groups, &ModelNode::id);
+ QStringList groupIds = Utils::transform(groups, bind_back(&ModelNode::id, SL{}));
Utils::sort(itemIds);
Utils::sort(groupIds);
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp
index df969197d9a..680082b5419 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp
+++ b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp
@@ -6,6 +6,7 @@
#include <bindingproperty.h>
#include <designermcumanager.h>
+#include <functional.h>
#include <modelnode.h>
#include <modelnodeoperations.h>
#include <nodelistproperty.h>
@@ -276,8 +277,9 @@ QStringList StatesEditorModel::stateGroups() const
const auto groupMetaInfo = m_statesEditorView->model()->qtQuickStateGroupMetaInfo();
+ using SL = ModelTracing::SourceLocation;
auto stateGroups = Utils::transform(m_statesEditorView->allModelNodesOfType(groupMetaInfo),
- &ModelNode::displayName);
+ bind_back(&ModelNode::displayName, SL{}));
stateGroups.prepend(tr("Default"));
return stateGroups;
}
diff --git a/src/plugins/qmldesigner/components/transitioneditor/transitionform.cpp b/src/plugins/qmldesigner/components/transitioneditor/transitionform.cpp
index 683cdd8cfe1..120cfee28e1 100644
--- a/src/plugins/qmldesigner/components/transitioneditor/transitionform.cpp
+++ b/src/plugins/qmldesigner/components/transitioneditor/transitionform.cpp
@@ -7,13 +7,14 @@
#include <abstractview.h>
#include <bindingproperty.h>
+#include <dialogutils.h>
#include <exception>
+#include <functional.h>
#include <nodelistproperty.h>
#include <nodemetainfo.h>
+#include <qmlitemnode.h>
#include <rewritertransaction.h>
#include <variantproperty.h>
-#include <qmlitemnode.h>
-#include <dialogutils.h>
#include <coreplugin/messagebox.h>
@@ -220,8 +221,9 @@ void TransitionForm::setupStateGroups()
const auto groupMetaInfo = view->model()->qtQuickStateGroupMetaInfo();
+ using SL = ModelTracing::SourceLocation;
auto stateGroups = Utils::transform(view->allModelNodesOfType(groupMetaInfo),
- &ModelNode::displayName);
+ bind_back(&ModelNode::displayName, SL{}));
stateGroups.prepend(tr("Default"));
bool block = ui->stateGroupComboBox->blockSignals(true);
diff --git a/src/plugins/qmldesigner/libs/designercore/designercoreutils/functional.h b/src/plugins/qmldesigner/libs/designercore/designercoreutils/functional.h
index 66a0485c2f4..2c7d52738b1 100644
--- a/src/plugins/qmldesigner/libs/designercore/designercoreutils/functional.h
+++ b/src/plugins/qmldesigner/libs/designercore/designercoreutils/functional.h
@@ -29,4 +29,9 @@ inline constexpr auto makeEqual = [](auto... projections) {
};
};
+template<class Function, class Argument>
+inline constexpr auto bind_back(Function &&function, Argument &&argument)
+{
+ return std::bind(function, std::placeholders::_1, std::forward<Argument>(argument));
+}
} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/libs/designercore/include/modelnode.h b/src/plugins/qmldesigner/libs/designercore/include/modelnode.h
index 3053fe10258..5e0661b79bf 100644
--- a/src/plugins/qmldesigner/libs/designercore/include/modelnode.h
+++ b/src/plugins/qmldesigner/libs/designercore/include/modelnode.h
@@ -3,17 +3,10 @@
#pragma once
-#include "auxiliarydata.h"
#include "abstractproperty.h"
-#include "qmldesignercorelib_global.h"
-
-#include <QPointer>
-#include <QList>
-#include <QVector>
-#include <QVariant>
+#include "auxiliarydata.h"
-#include <memory>
-#include <optional>
+#include <tracing/qmldesignertracingsourcelocation.h>
QT_BEGIN_NAMESPACE
class QTextStream;
@@ -75,6 +68,8 @@ class QMLDESIGNERCORE_EXPORT ModelNode
friend NodeAbstractProperty;
friend NodeProperty;
+ using SL = ModelTracing::SourceLocation;
+
public:
enum NodeSourceType {
NodeWithoutSource = 0,
@@ -91,161 +86,172 @@ public:
ModelNode &operator=(ModelNode &&) noexcept = default;
~ModelNode() = default;
- TypeName type() const;
- QString simplifiedTypeName() const;
- QString displayName() const;
- int minorVersion() const;
- int majorVersion() const;
+ TypeName type(SL sl = {}) const;
+ QString simplifiedTypeName(SL sl = {}) const;
+ QString displayName(SL sl = {}) const;
+ int minorVersion(SL sl = {}) const;
+ int majorVersion(SL sl = {}) const;
bool isValid() const;
+
explicit operator bool() const { return isValid(); }
- bool isInHierarchy() const;
+ bool isInHierarchy(SL sl = {}) const;
- NodeAbstractProperty parentProperty() const;
- void setParentProperty(NodeAbstractProperty parent);
- void changeType(const TypeName &typeName, int majorVersion = -1, int minorVersion = -1);
- void setParentProperty(const ModelNode &newParentNode, const PropertyName &propertyName);
- bool hasParentProperty() const;
+ NodeAbstractProperty parentProperty(SL sl = {}) const;
+ void setParentProperty(NodeAbstractProperty parent, SL sl = {});
+ void changeType(const TypeName &typeName, int majorVersion = -1, int minorVersion = -1, SL sl = {});
+ void setParentProperty(const ModelNode &newParentNode,
+ const PropertyName &propertyName,
+ SL sl = {});
+ bool hasParentProperty(SL sl = {}) const;
- QList<ModelNode> directSubModelNodes() const;
- QList<ModelNode> directSubModelNodesOfType(const NodeMetaInfo &type) const;
- QList<ModelNode> subModelNodesOfType(const NodeMetaInfo &type) const;
+ QList<ModelNode> directSubModelNodes(SL sl = {}) const;
+ QList<ModelNode> directSubModelNodesOfType(const NodeMetaInfo &type, SL sl = {}) const;
+ QList<ModelNode> subModelNodesOfType(const NodeMetaInfo &type, SL sl = {}) const;
- QList<ModelNode> allSubModelNodes() const;
- QList<ModelNode> allSubModelNodesAndThisNode() const;
- bool hasAnySubModelNodes() const;
+ QList<ModelNode> allSubModelNodes(SL sl = {}) const;
+ QList<ModelNode> allSubModelNodesAndThisNode(SL sl = {}) const;
+ bool hasAnySubModelNodes(SL sl = {}) const;
//###
- AbstractProperty property(PropertyNameView name) const;
- VariantProperty variantProperty(PropertyNameView name) const;
- BindingProperty bindingProperty(PropertyNameView name) const;
- SignalHandlerProperty signalHandlerProperty(PropertyNameView name) const;
- SignalDeclarationProperty signalDeclarationProperty(PropertyNameView name) const;
- NodeListProperty nodeListProperty(PropertyNameView name) const;
- NodeProperty nodeProperty(PropertyNameView name) const;
- NodeAbstractProperty nodeAbstractProperty(PropertyNameView name) const;
- NodeAbstractProperty defaultNodeAbstractProperty() const;
- NodeListProperty defaultNodeListProperty() const;
- NodeProperty defaultNodeProperty() const;
-
- void removeProperty(PropertyNameView name) const; //### also implement in AbstractProperty
- QList<AbstractProperty> properties() const;
- QList<VariantProperty> variantProperties() const;
- QList<NodeAbstractProperty> nodeAbstractProperties() const;
- QList<NodeProperty> nodeProperties() const;
- QList<NodeListProperty> nodeListProperties() const;
- QList<BindingProperty> bindingProperties() const;
- QList<SignalHandlerProperty> signalProperties() const;
- QList<AbstractProperty> dynamicProperties() const;
- PropertyNameList propertyNames() const;
-
- bool hasProperty(PropertyNameView name) const;
- bool hasVariantProperty(PropertyNameView name) const;
- bool hasBindingProperty(PropertyNameView name) const;
- bool hasSignalHandlerProperty(PropertyNameView name) const;
- bool hasNodeAbstractProperty(PropertyNameView name) const;
- bool hasDefaultNodeAbstractProperty() const;
- bool hasDefaultNodeListProperty() const;
- bool hasDefaultNodeProperty() const;
- bool hasNodeProperty(PropertyNameView name) const;
- bool hasNodeListProperty(PropertyNameView name) const;
- bool hasProperty(PropertyNameView name, PropertyType propertyType) const;
-
- void setScriptFunctions(const QStringList &scriptFunctionList);
- QStringList scriptFunctions() const;
+ AbstractProperty property(PropertyNameView name, SL sl = {}) const;
+ VariantProperty variantProperty(PropertyNameView name, SL sl = {}) const;
+ BindingProperty bindingProperty(PropertyNameView name, SL sl = {}) const;
+ SignalHandlerProperty signalHandlerProperty(PropertyNameView name, SL sl = {}) const;
+ SignalDeclarationProperty signalDeclarationProperty(PropertyNameView name, SL sl = {}) const;
+ NodeListProperty nodeListProperty(PropertyNameView name, SL sl = {}) const;
+ NodeProperty nodeProperty(PropertyNameView name, SL sl = {}) const;
+ NodeAbstractProperty nodeAbstractProperty(PropertyNameView name, SL sl = {}) const;
+ NodeAbstractProperty defaultNodeAbstractProperty(SL sl = {}) const;
+ NodeListProperty defaultNodeListProperty(SL sl = {}) const;
+ NodeProperty defaultNodeProperty(SL sl = {}) const;
+
+ void removeProperty(PropertyNameView name, SL sl = {}) const; //### also implement in AbstractProperty
+ QList<AbstractProperty> properties(SL sl = {}) const;
+ QList<VariantProperty> variantProperties(SL sl = {}) const;
+ QList<NodeAbstractProperty> nodeAbstractProperties(SL sl = {}) const;
+ QList<NodeProperty> nodeProperties(SL sl = {}) const;
+ QList<NodeListProperty> nodeListProperties(SL sl = {}) const;
+ QList<BindingProperty> bindingProperties(SL sl = {}) const;
+ QList<SignalHandlerProperty> signalProperties(SL sl = {}) const;
+ QList<AbstractProperty> dynamicProperties(SL sl = {}) const;
+ PropertyNameList propertyNames(SL sl = {}) const;
+
+ bool hasProperty(PropertyNameView name, SL sl = {}) const;
+ bool hasVariantProperty(PropertyNameView name, SL sl = {}) const;
+ bool hasBindingProperty(PropertyNameView name, SL sl = {}) const;
+ bool hasSignalHandlerProperty(PropertyNameView name, SL sl = {}) const;
+ bool hasNodeAbstractProperty(PropertyNameView name, SL sl = {}) const;
+ bool hasDefaultNodeAbstractProperty(SL sl = {}) const;
+ bool hasDefaultNodeListProperty(SL sl = {}) const;
+ bool hasDefaultNodeProperty(SL sl = {}) const;
+ bool hasNodeProperty(PropertyNameView name, SL sl = {}) const;
+ bool hasNodeListProperty(PropertyNameView name, SL sl = {}) const;
+ bool hasProperty(PropertyNameView name, PropertyType propertyType, SL sl = {}) const;
+
+ void setScriptFunctions(const QStringList &scriptFunctionList, SL sl = {});
+ QStringList scriptFunctions(SL sl = {}) const;
//###
- void destroy();
+ void destroy(SL sl = {});
- QString id() const;
- void ensureIdExists() const;
- [[nodiscard]] QString validId() const;
- void setIdWithRefactoring(const QString &id) const;
- void setIdWithoutRefactoring(const QString &id) const;
+ QString id(SL sl = {}) const;
+ void ensureIdExists(SL sl = {}) const;
+ [[nodiscard]] QString validId(SL sl = {}) const;
+ void setIdWithRefactoring(const QString &id, SL sl = {}) const;
+ void setIdWithoutRefactoring(const QString &id, SL sl = {}) const;
static bool isValidId(const QString &id);
static QString getIdValidityErrorMessage(const QString &id);
- bool hasId() const;
+ bool hasId(SL sl = {}) const;
Model *model() const;
AbstractView *view() const;
- NodeMetaInfo metaInfo() const;
- bool hasMetaInfo() const;
+ NodeMetaInfo metaInfo(SL sl = {}) const;
+ bool hasMetaInfo(SL sl = {}) const;
- bool isSelected() const;
- bool isRootNode() const;
+ bool isSelected(SL sl = {}) const;
+ bool isRootNode(SL sl = {}) const;
- bool isAncestorOf(const ModelNode &node) const;
- void selectNode();
- void deselectNode();
+ bool isAncestorOf(const ModelNode &node, SL sl = {}) const;
+ void selectNode(SL sl = {});
+ void deselectNode(SL sl = {});
static int variantTypeId();
- QVariant toVariant() const;
-
- std::optional<QVariant> auxiliaryData(AuxiliaryDataKeyView key) const;
- std::optional<QVariant> auxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name) const;
- QVariant auxiliaryDataWithDefault(AuxiliaryDataType type, Utils::SmallStringView name) const;
- QVariant auxiliaryDataWithDefault(AuxiliaryDataKeyView key) const;
- QVariant auxiliaryDataWithDefault(AuxiliaryDataKeyDefaultValue key) const;
- void setAuxiliaryData(AuxiliaryDataKeyView key, const QVariant &data) const;
- void setAuxiliaryDataWithoutLock(AuxiliaryDataKeyView key, const QVariant &data) const;
- void setAuxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name, const QVariant &data) const;
+ QVariant toVariant(SL sl = {}) const;
+
+ std::optional<QVariant> auxiliaryData(AuxiliaryDataKeyView key, SL sl = {}) const;
+ std::optional<QVariant> auxiliaryData(AuxiliaryDataType type,
+ Utils::SmallStringView name,
+ SL sl = {}) const;
+ QVariant auxiliaryDataWithDefault(AuxiliaryDataType type,
+ Utils::SmallStringView name,
+ SL sl = {}) const;
+ QVariant auxiliaryDataWithDefault(AuxiliaryDataKeyView key, SL sl = {}) const;
+ QVariant auxiliaryDataWithDefault(AuxiliaryDataKeyDefaultValue key, SL sl = {}) const;
+ void setAuxiliaryData(AuxiliaryDataKeyView key, const QVariant &data, SL sl = {}) const;
+ void setAuxiliaryDataWithoutLock(AuxiliaryDataKeyView key, const QVariant &data, SL sl = {}) const;
+ void setAuxiliaryData(AuxiliaryDataType type,
+ Utils::SmallStringView name,
+ const QVariant &data,
+ SL sl = {}) const;
void setAuxiliaryDataWithoutLock(AuxiliaryDataType type,
Utils::SmallStringView name,
- const QVariant &data) const;
- void removeAuxiliaryData(AuxiliaryDataKeyView key) const;
- void removeAuxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name) const;
- bool hasAuxiliaryData(AuxiliaryDataKeyView key) const;
- bool hasAuxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name) const;
+ const QVariant &data,
+ SL sl = {}) const;
+ void removeAuxiliaryData(AuxiliaryDataKeyView key, SL sl = {}) const;
+ void removeAuxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name, SL sl = {}) const;
+ bool hasAuxiliaryData(AuxiliaryDataKeyView key, SL sl = {}) const;
+ bool hasAuxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name, SL sl = {}) const;
bool hasAuxiliaryData(AuxiliaryDataType type) const;
- AuxiliaryDatasForType auxiliaryData(AuxiliaryDataType type) const;
- AuxiliaryDatasView auxiliaryData() const;
+ AuxiliaryDatasForType auxiliaryData(AuxiliaryDataType type, SL sl = {}) const;
+ AuxiliaryDatasView auxiliaryData(SL sl = {}) const;
- QString customId() const;
- bool hasCustomId() const;
- void setCustomId(const QString &str);
- void removeCustomId();
+ QString customId(SL sl = {}) const;
+ bool hasCustomId(SL sl = {}) const;
+ void setCustomId(const QString &str, SL sl = {});
+ void removeCustomId(SL sl = {});
- QVector<Comment> comments() const;
- bool hasComments() const;
- void setComments(const QVector<Comment> &coms);
- void addComment(const Comment &com);
- bool updateComment(const Comment &com, int position);
+ QVector<Comment> comments(SL sl = {}) const;
+ bool hasComments(SL sl = {}) const;
+ void setComments(const QVector<Comment> &coms, SL sl = {});
+ void addComment(const Comment &com, SL sl = {});
+ bool updateComment(const Comment &com, int position, SL sl = {});
- Annotation annotation() const;
- bool hasAnnotation() const;
- void setAnnotation(const Annotation &annotation);
- void removeAnnotation();
+ Annotation annotation(SL sl = {}) const;
+ bool hasAnnotation(SL sl = {}) const;
+ void setAnnotation(const Annotation &annotation, SL sl = {});
+ void removeAnnotation(SL sl = {});
- Annotation globalAnnotation() const;
- bool hasGlobalAnnotation() const;
- void setGlobalAnnotation(const Annotation &annotation);
- void removeGlobalAnnotation();
+ Annotation globalAnnotation(SL sl = {}) const;
+ bool hasGlobalAnnotation(SL sl = {}) const;
+ void setGlobalAnnotation(const Annotation &annotation, SL sl = {});
+ void removeGlobalAnnotation(SL sl = {});
- GlobalAnnotationStatus globalStatus() const;
- bool hasGlobalStatus() const;
- void setGlobalStatus(const GlobalAnnotationStatus &status);
- void removeGlobalStatus();
+ GlobalAnnotationStatus globalStatus(SL sl = {}) const;
+ bool hasGlobalStatus(SL sl = {}) const;
+ void setGlobalStatus(const GlobalAnnotationStatus &status, SL sl = {});
+ void removeGlobalStatus(SL sl = {});
- bool locked() const;
- void setLocked(bool value);
+ bool locked(SL sl = {}) const;
+ void setLocked(bool value, SL sl = {});
- qint32 internalId() const;
+ qint32 internalId(SL sl = {}) const;
- void setNodeSource(const QString&);
- void setNodeSource(const QString &newNodeSource, NodeSourceType type);
- QString nodeSource() const;
+ void setNodeSource(const QString &str, SL sl = {});
+ void setNodeSource(const QString &newNodeSource, NodeSourceType type, SL sl = {});
+ QString nodeSource(SL sl = {}) const;
- QString convertTypeToImportAlias() const;
+ QString convertTypeToImportAlias(SL sl = {}) const;
- NodeSourceType nodeSourceType() const;
+ NodeSourceType nodeSourceType(SL sl = {}) const;
- bool isComponent() const;
- QIcon typeIcon() const;
- QString behaviorPropertyName() const;
+ bool isComponent(SL sl = {}) const;
+ QIcon typeIcon(SL sl = {}) const;
+ QString behaviorPropertyName(SL sl = {}) const;
friend void swap(ModelNode &first, ModelNode &second) noexcept
{
@@ -273,7 +279,7 @@ private: // functions
template<typename Type, typename... PropertyType>
QList<Type> properties(PropertyType... type) const;
- bool hasLocked() const;
+ bool hasLocked(SL sl = {}) const;
private: // variables
Internal::InternalNodePointer m_internalNode;
diff --git a/src/plugins/qmldesigner/libs/designercore/model/modelnode.cpp b/src/plugins/qmldesigner/libs/designercore/model/modelnode.cpp
index ae8c2c6f33c..b7a968fae92 100644
--- a/src/plugins/qmldesigner/libs/designercore/model/modelnode.cpp
+++ b/src/plugins/qmldesigner/libs/designercore/model/modelnode.cpp
@@ -4,35 +4,25 @@
#include "modelnode.h"
#include "annotation.h"
-#include "bindingproperty.h"
#include "designercoretr.h"
#include "internalnode_p.h"
#include "model_p.h"
-#include "nodeabstractproperty.h"
#include "nodelistproperty.h"
#include "nodeproperty.h"
#include "signalhandlerproperty.h"
#include "variantproperty.h"
#include <auxiliarydataproperties.h>
-#include <model.h>
#include <modelutils.h>
-#include <nodemetainfo.h>
#include <rewriterview.h>
#include <utils/algorithm.h>
-#include <utils/array.h>
-
-#include <QHash>
-#include <QRegularExpression>
-#include <QSet>
-#include <QTextStream>
-
-#include <algorithm>
namespace QmlDesigner {
using namespace QmlDesigner::Internal;
+auto category = ModelTracing::category;
+
/*!
\class QmlDesigner::ModelNode
\ingroup CoreModel
@@ -73,23 +63,39 @@ ModelNode::ModelNode(const ModelNode &modelNode, AbstractView *view)
/*! \brief returns the name of node which is a short cut to a property like objectName
\return name of the node
*/
-QString ModelNode::id() const
+QString ModelNode::id(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node id",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_internalNode->id;
}
-void ModelNode::ensureIdExists() const
+void ModelNode::ensureIdExists(SL sl) const
{
if (!hasId())
setIdWithoutRefactoring(model()->generateNewId(simplifiedTypeName()));
+
+ NanotraceHR::Tracer tracer{"model node ensure id exists",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
}
-QString ModelNode::validId() const
+QString ModelNode::validId(SL sl) const
{
- ensureIdExists();
+ NanotraceHR::Tracer tracer{"model node valid id",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
+ ensureIdExists(sl);
return id();
}
@@ -126,32 +132,51 @@ QString ModelNode::getIdValidityErrorMessage(const QString &id)
return DesignerCore::Tr::tr("ID includes invalid characters (%1).").arg(id);
}
-bool ModelNode::hasId() const
+bool ModelNode::hasId(SL sl) const
{
if (!isValid())
return false;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has id",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return !m_internalNode->id.isEmpty();
}
-void ModelNode::setIdWithRefactoring(const QString &id) const
+void ModelNode::setIdWithRefactoring(const QString &id, SL sl) const
{
- if (isValid()) {
- if (model()->rewriterView() && !id.isEmpty()
- && !m_internalNode->id.isEmpty()) { // refactor the id if they are not empty
- model()->rewriterView()->renameId(m_internalNode->id, id);
- } else {
- setIdWithoutRefactoring(id);
- }
+ if (!isValid())
+ return;
+
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set id with refactoring",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
+ if (model()->rewriterView() && !id.isEmpty()
+ && !m_internalNode->id.isEmpty()) { // refactor the id if they are not empty
+ model()->rewriterView()->renameId(m_internalNode->id, id);
+ } else {
+ setIdWithoutRefactoring(id);
}
}
-void ModelNode::setIdWithoutRefactoring(const QString &id) const
+void ModelNode::setIdWithoutRefactoring(const QString &id, SL sl) const
{
Internal::WriteLocker locker(m_model.data());
if (!isValid())
return;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set id without refactoring",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
if (!isValidId(id))
return;
@@ -167,50 +192,77 @@ void ModelNode::setIdWithoutRefactoring(const QString &id) const
/*! \brief the fully-qualified type name of the node is represented as string
\return type of the node as a string
*/
-TypeName ModelNode::type() const
+TypeName ModelNode::type(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node type",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_internalNode->typeName;
}
/*! \brief minor number of the QML type
\return minor number
*/
-int ModelNode::minorVersion() const
+int ModelNode::minorVersion(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node minor version",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_internalNode->minorVersion;
}
/*! \brief major number of the QML type
\return major number
*/
-int ModelNode::majorVersion() const
+int ModelNode::majorVersion(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node major version",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_internalNode->majorVersion;
}
/*! \return the short-hand type name of the node. */
-QString ModelNode::simplifiedTypeName() const
+QString ModelNode::simplifiedTypeName(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node simplified type name",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return QString::fromUtf8(type().split('.').constLast());
}
-QString ModelNode::displayName() const
+QString ModelNode::displayName(SL sl) const
{
- if (hasId())
- return id();
- return simplifiedTypeName();
+ NanotraceHR::Tracer tracer{"model node display name",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
+ return hasId() ? id() : simplifiedTypeName();
}
/*! \brief Returns whether the node is valid
@@ -232,15 +284,22 @@ bool ModelNode::isValid() const
Will return true also for the root node itself.
*/
-bool ModelNode::isInHierarchy() const
+bool ModelNode::isInHierarchy(SL sl) const
{
if (!isValid())
return false;
+
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node is in hierarchy",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
if (isRootNode())
return true;
if (!hasParentProperty())
return false;
- return parentProperty().parentModelNode().isInHierarchy();
+ return parentProperty().parentModelNode().isInHierarchy(sl);
}
/*!
@@ -252,11 +311,17 @@ bool ModelNode::isInHierarchy() const
\return the property containing this ModelNode
*/
-NodeAbstractProperty ModelNode::parentProperty() const
+NodeAbstractProperty ModelNode::parentProperty(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node parent property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
if (!m_internalNode->parentProperty())
return {};
@@ -284,11 +349,17 @@ parentNode4 == parentNode1; -> true
*/
-void ModelNode::setParentProperty(NodeAbstractProperty parent)
+void ModelNode::setParentProperty(NodeAbstractProperty parent, SL sl)
{
if (!isValid())
return;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set parent property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
if (!parent.parentModelNode().isValid())
return;
@@ -301,28 +372,45 @@ void ModelNode::setParentProperty(NodeAbstractProperty parent)
parent.reparentHere(*this);
}
-void ModelNode::changeType(const TypeName &typeName, int majorVersion, int minorVersion)
+void ModelNode::changeType(const TypeName &typeName, int majorVersion, int minorVersion, SL sl)
{
if (!isValid())
return;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node change type",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
model()->d->changeNodeType(m_internalNode, typeName, majorVersion, minorVersion);
}
-void ModelNode::setParentProperty(const ModelNode &newParentNode, const PropertyName &propertyName)
+void ModelNode::setParentProperty(const ModelNode &newParentNode, const PropertyName &propertyName, SL sl)
{
- setParentProperty(newParentNode.nodeAbstractProperty(propertyName));
+ NanotraceHR::Tracer tracer{"model node set parent property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
+ setParentProperty(newParentNode.nodeAbstractProperty(propertyName), sl);
}
/*! \brief test if there is a parent for this node
\return true is this node has a parent
\see childNodes parentNode setParentNode hasChildNodes Model::undo
*/
-bool ModelNode::hasParentProperty() const
+bool ModelNode::hasParentProperty(SL sl) const
{
if (!isValid())
return false;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has parent property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
if (!m_internalNode->parentProperty())
return false;
@@ -339,27 +427,44 @@ bool ModelNode::hasParentProperty() const
\return BindingProperty named name
*/
-BindingProperty ModelNode::bindingProperty(PropertyNameView name) const
+BindingProperty ModelNode::bindingProperty(PropertyNameView name, SL sl) const
{
if (!isValid())
return {};
+ NanotraceHR::Tracer tracer{"model node binding property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return BindingProperty(name, m_internalNode, model(), view());
}
-SignalHandlerProperty ModelNode::signalHandlerProperty(PropertyNameView name) const
+SignalHandlerProperty ModelNode::signalHandlerProperty(PropertyNameView name, SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node signal handler property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return SignalHandlerProperty(name, m_internalNode, model(), view());
}
-SignalDeclarationProperty ModelNode::signalDeclarationProperty(PropertyNameView name) const
+SignalDeclarationProperty ModelNode::signalDeclarationProperty(PropertyNameView name, SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node signal declaration property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return SignalDeclarationProperty(name, m_internalNode, model(), view());
}
@@ -373,11 +478,17 @@ SignalDeclarationProperty ModelNode::signalDeclarationProperty(PropertyNameView
\return NodeProperty named name
*/
-NodeProperty ModelNode::nodeProperty(PropertyNameView name) const
+NodeProperty ModelNode::nodeProperty(PropertyNameView name, SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node node property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return NodeProperty(name, m_internalNode, model(), view());
}
@@ -391,34 +502,61 @@ NodeProperty ModelNode::nodeProperty(PropertyNameView name) const
\return NodeListProperty named name
*/
-NodeListProperty ModelNode::nodeListProperty(PropertyNameView name) const
+NodeListProperty ModelNode::nodeListProperty(PropertyNameView name, SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node node list property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return NodeListProperty(name, m_internalNode, model(), view());
}
-NodeAbstractProperty ModelNode::nodeAbstractProperty(PropertyNameView name) const
+NodeAbstractProperty ModelNode::nodeAbstractProperty(PropertyNameView name, SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node node abstract property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return NodeAbstractProperty(name, m_internalNode, model(), view());
}
-NodeAbstractProperty ModelNode::defaultNodeAbstractProperty() const
+NodeAbstractProperty ModelNode::defaultNodeAbstractProperty(SL sl) const
{
+ NanotraceHR::Tracer tracer{"model node default node abstract property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return nodeAbstractProperty(metaInfo().defaultPropertyName());
}
-NodeListProperty ModelNode::defaultNodeListProperty() const
+NodeListProperty ModelNode::defaultNodeListProperty(SL sl) const
{
+ NanotraceHR::Tracer tracer{"model node default node list property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return nodeListProperty(metaInfo().defaultPropertyName());
}
-NodeProperty ModelNode::defaultNodeProperty() const
+NodeProperty ModelNode::defaultNodeProperty(SL sl) const
{
+ NanotraceHR::Tracer tracer{"model node default node property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return nodeProperty(metaInfo().defaultPropertyName());
}
@@ -432,19 +570,30 @@ NodeProperty ModelNode::defaultNodeProperty() const
\return VariantProperty named name
*/
-VariantProperty ModelNode::variantProperty(PropertyNameView name) const
+VariantProperty ModelNode::variantProperty(PropertyNameView name, SL sl) const
{
if (!isValid())
return {};
+ NanotraceHR::Tracer tracer{"model node variant property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return VariantProperty(name, m_internalNode, model(), view());
}
-AbstractProperty ModelNode::property(PropertyNameView name) const
+AbstractProperty ModelNode::property(PropertyNameView name, SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return AbstractProperty(name, m_internalNode, model(), view());
}
@@ -463,11 +612,17 @@ It is searching only in the local Property.
The list of properties
*/
-QList<AbstractProperty> ModelNode::properties() const
+QList<AbstractProperty> ModelNode::properties(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node properties",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
QList<AbstractProperty> propertyList;
const QList<PropertyName> propertyNames = m_internalNode->propertyNameList();
@@ -485,23 +640,47 @@ QList<AbstractProperty> ModelNode::properties() const
The list of all properties containing just an atomic value.
*/
-QList<VariantProperty> ModelNode::variantProperties() const
+QList<VariantProperty> ModelNode::variantProperties(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node variant property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return properties<VariantProperty>(PropertyType::Variant);
}
-QList<NodeAbstractProperty> ModelNode::nodeAbstractProperties() const
+QList<NodeAbstractProperty> ModelNode::nodeAbstractProperties(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node node abstract property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return properties<NodeAbstractProperty>(PropertyType::Node, PropertyType::NodeList);
}
-QList<NodeProperty> ModelNode::nodeProperties() const
+QList<NodeProperty> ModelNode::nodeProperties(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node node property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return properties<NodeProperty>(PropertyType::Node);
}
-QList<NodeListProperty> ModelNode::nodeListProperties() const
+QList<NodeListProperty> ModelNode::nodeListProperties(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node node list property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return properties<NodeListProperty>(PropertyType::NodeList);
}
@@ -511,21 +690,39 @@ QList<NodeListProperty> ModelNode::nodeListProperties() const
The list of all properties containing an expression.
*/
-QList<BindingProperty> ModelNode::bindingProperties() const
+QList<BindingProperty> ModelNode::bindingProperties(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node binding property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return properties<BindingProperty>(PropertyType::Binding);
}
-QList<SignalHandlerProperty> ModelNode::signalProperties() const
+QList<SignalHandlerProperty> ModelNode::signalProperties(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node signal handler property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return properties<SignalHandlerProperty>(PropertyType::SignalHandler);
}
-QList<AbstractProperty> ModelNode::dynamicProperties() const
+QList<AbstractProperty> ModelNode::dynamicProperties(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node dynamic property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
QList<AbstractProperty> properties;
for (const auto &propertyEntry : *m_internalNode.get()) {
@@ -546,11 +743,17 @@ Does nothing if the node state does not set this property.
\see addProperty property properties hasProperties
*/
-void ModelNode::removeProperty(PropertyNameView name) const
+void ModelNode::removeProperty(PropertyNameView name, SL sl) const
{
if (!isValid())
return;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node remove property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
if (!model()->d->propertyNameIsValid(name))
return;
@@ -587,11 +790,17 @@ static void removeModelNodeFromSelection(const ModelNode &node)
/*! \brief complete removes this ModelNode from the Model
*/
-void ModelNode::destroy()
+void ModelNode::destroy(SL sl)
{
if (!isValid())
return;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node destroy",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
if (isRootNode())
return;
@@ -626,23 +835,41 @@ The list contains every ModelNode that belongs to one of this ModelNodes
properties.
\return a list of all ModelNodes that are direct children
*/
-QList<ModelNode> ModelNode::directSubModelNodes() const
+QList<ModelNode> ModelNode::directSubModelNodes(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node direct sub model nodes",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return toModelNodeList(m_internalNode->allDirectSubNodes(), model(), view());
}
-QList<ModelNode> ModelNode::directSubModelNodesOfType(const NodeMetaInfo &type) const
+QList<ModelNode> ModelNode::directSubModelNodesOfType(const NodeMetaInfo &type, SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node direct sub model nodes of type",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return Utils::filtered(directSubModelNodes(), [&](const ModelNode &node) {
return node.metaInfo().isValid() && node.metaInfo().isBasedOn(type);
});
}
-QList<ModelNode> ModelNode::subModelNodesOfType(const NodeMetaInfo &type) const
+QList<ModelNode> ModelNode::subModelNodesOfType(const NodeMetaInfo &type, SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node sub model nodes of type",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return Utils::filtered(allSubModelNodes(), [&](const ModelNode &node) {
return node.metaInfo().isValid() && node.metaInfo().isBasedOn(type);
});
@@ -655,16 +882,28 @@ All children in this list will be implicitly removed if this ModelNode is destro
\return a list of all ModelNodes that are direct or indirect children
*/
-QList<ModelNode> ModelNode::allSubModelNodes() const
+QList<ModelNode> ModelNode::allSubModelNodes(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node all sub model nodes",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return toModelNodeList(internalNode()->allSubNodes(), model(), view());
}
-QList<ModelNode> ModelNode::allSubModelNodesAndThisNode() const
+QList<ModelNode> ModelNode::allSubModelNodesAndThisNode(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node all sub model nodes and this node",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
QList<ModelNode> modelNodeList;
modelNodeList.append(*this);
modelNodeList.append(allSubModelNodes());
@@ -678,17 +917,29 @@ QList<ModelNode> ModelNode::allSubModelNodesAndThisNode() const
\return if this ModelNode has any child ModelNodes
*/
-bool ModelNode::hasAnySubModelNodes() const
+bool ModelNode::hasAnySubModelNodes(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has any sub model nodes",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return !nodeAbstractProperties().isEmpty();
}
-NodeMetaInfo ModelNode::metaInfo() const
+NodeMetaInfo ModelNode::metaInfo([[maybe_unused]] SL sl) const
{
if (!isValid())
return {};
#ifdef QDS_USE_PROJECTSTORAGE
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node meta info",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return NodeMetaInfo(m_internalNode->typeId, m_model->projectStorage());
#else
return NodeMetaInfo(m_model->metaInfoProxyModel(),
@@ -698,33 +949,51 @@ NodeMetaInfo ModelNode::metaInfo() const
#endif
}
-bool ModelNode::hasMetaInfo() const
+bool ModelNode::hasMetaInfo(SL sl) const
{
if (!isValid())
return false;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has meta info",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return model()->hasNodeMetaInfo(type(), majorVersion(), minorVersion());
}
/*! \brief has a node the selection of the model
\return true if the node his selection
*/
-bool ModelNode::isSelected() const
+bool ModelNode::isSelected(SL sl) const
{
if (!isValid())
return false;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node is selected",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return model()->d->selectedNodes().contains(internalNode());
}
/*! \briefis this node the root node of the model
\return true if it is the root node
*/
-bool ModelNode::isRootNode() const
+bool ModelNode::isRootNode(SL sl) const
{
if (!isValid())
return false;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node is root node",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_model->d->rootNode() == m_internalNode;
}
@@ -735,11 +1004,17 @@ The list of properties set in this state.
\see addProperty property changePropertyValue removeProperty hasProperties
*/
-PropertyNameList ModelNode::propertyNames() const
+PropertyNameList ModelNode::propertyNames(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node property names",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_internalNode->propertyNameList();
}
@@ -765,33 +1040,63 @@ QList<Type> ModelNode::properties(PropertyType... type) const
return properties;
}
-/*! \brief test a if a property is set for this node
-\return true if property a property ins this or a ancestor state exists
+/*! \brief test if a property is set for this node
+\return true if property a property in this or a ancestor state exists
*/
-bool ModelNode::hasProperty(PropertyNameView name) const
+bool ModelNode::hasProperty(PropertyNameView name, SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return isValid() && m_internalNode->property(name);
}
-bool ModelNode::hasVariantProperty(PropertyNameView name) const
+bool ModelNode::hasVariantProperty(PropertyNameView name, SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has variant property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return hasProperty(name, PropertyType::Variant);
}
-bool ModelNode::hasBindingProperty(PropertyNameView name) const
+bool ModelNode::hasBindingProperty(PropertyNameView name, SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has binding property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return hasProperty(name, PropertyType::Binding);
}
-bool ModelNode::hasSignalHandlerProperty(PropertyNameView name) const
+bool ModelNode::hasSignalHandlerProperty(PropertyNameView name, SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has signal handler property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return hasProperty(name, PropertyType::SignalHandler);
}
-bool ModelNode::hasNodeAbstractProperty(PropertyNameView name) const
+bool ModelNode::hasNodeAbstractProperty(PropertyNameView name, SL sl) const
{
if (!isValid())
- return false;
+ return {};
+
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has node abstract property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
if (auto property = m_internalNode->property(name))
return property->isNodeAbstractProperty();
@@ -799,38 +1104,74 @@ bool ModelNode::hasNodeAbstractProperty(PropertyNameView name) const
return false;
}
-bool ModelNode::hasDefaultNodeAbstractProperty() const
+bool ModelNode::hasDefaultNodeAbstractProperty(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has default node abstract property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
auto defaultPropertyName = metaInfo().defaultPropertyName();
return hasNodeAbstractProperty(defaultPropertyName);
}
-bool ModelNode::hasDefaultNodeListProperty() const
+bool ModelNode::hasDefaultNodeListProperty(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has default node list property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
auto defaultPropertyName = metaInfo().defaultPropertyName();
return hasNodeListProperty(defaultPropertyName);
}
-bool ModelNode::hasDefaultNodeProperty() const
+bool ModelNode::hasDefaultNodeProperty(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has default node property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
auto defaultPropertyName = metaInfo().defaultPropertyName();
return hasNodeProperty(defaultPropertyName);
}
-bool ModelNode::hasNodeProperty(PropertyNameView name) const
+bool ModelNode::hasNodeProperty(PropertyNameView name, SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has node property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return hasProperty(name, PropertyType::Node);
}
-bool ModelNode::hasNodeListProperty(PropertyNameView name) const
+bool ModelNode::hasNodeListProperty(PropertyNameView name, SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has node list property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return hasProperty(name, PropertyType::NodeList);
}
-bool ModelNode::hasProperty(PropertyNameView name, PropertyType propertyType) const
+bool ModelNode::hasProperty(PropertyNameView name, PropertyType propertyType, SL sl) const
{
if (!isValid())
- return false;
+ return {};
+
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has property",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
if (auto property = m_internalNode->property(name))
return property->type() == propertyType;
@@ -852,8 +1193,14 @@ static bool recursiveAncestor(const ModelNode &possibleAncestor, const ModelNode
return false;
}
-bool ModelNode::isAncestorOf(const ModelNode &node) const
+bool ModelNode::isAncestorOf(const ModelNode &node, SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node is ancestor of",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return recursiveAncestor(*this, node);
}
@@ -882,22 +1229,34 @@ QTextStream &operator<<(QTextStream &stream, const ModelNode &modelNode)
return stream;
}
-void ModelNode::selectNode()
+void ModelNode::selectNode(SL sl)
{
if (!isValid())
return;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node select node",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
QList<ModelNode> selectedNodeList;
selectedNodeList.append(*this);
model()->setSelectedModelNodes(selectedNodeList);
}
-void ModelNode::deselectNode()
+void ModelNode::deselectNode(SL sl)
{
if (!isValid())
return;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node deselect node",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
auto selectedNodes = model()->d->selectedNodes();
selectedNodes.removeAll(internalNode());
model()->d->setSelectedNodes(selectedNodes);
@@ -908,34 +1267,74 @@ int ModelNode::variantTypeId()
return qMetaTypeId<ModelNode>();
}
-QVariant ModelNode::toVariant() const
+QVariant ModelNode::toVariant(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node to variant",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return QVariant::fromValue(*this);
}
-std::optional<QVariant> ModelNode::auxiliaryData(AuxiliaryDataKeyView key) const
+std::optional<QVariant> ModelNode::auxiliaryData(AuxiliaryDataKeyView key, SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node auxiliary data",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_internalNode->auxiliaryData(key);
}
-std::optional<QVariant> ModelNode::auxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name) const
+std::optional<QVariant> ModelNode::auxiliaryData(AuxiliaryDataType type,
+ Utils::SmallStringView name,
+ SL sl) const
{
+ if (!isValid())
+ return {};
+
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node auxiliary data with name",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return auxiliaryData({type, name});
}
-QVariant ModelNode::auxiliaryDataWithDefault(AuxiliaryDataType type, Utils::SmallStringView name) const
+QVariant ModelNode::auxiliaryDataWithDefault(AuxiliaryDataType type,
+ Utils::SmallStringView name,
+ SL sl) const
{
+ if (!isValid())
+ return {};
+
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node auxiliary data with default 1",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return auxiliaryDataWithDefault({type, name});
}
-QVariant ModelNode::auxiliaryDataWithDefault(AuxiliaryDataKeyView key) const
+QVariant ModelNode::auxiliaryDataWithDefault(AuxiliaryDataKeyView key, SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node auxiliary data with default 2",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
auto data = m_internalNode->auxiliaryData(key);
if (data)
@@ -944,11 +1343,17 @@ QVariant ModelNode::auxiliaryDataWithDefault(AuxiliaryDataKeyView key) const
return {};
}
-QVariant ModelNode::auxiliaryDataWithDefault(AuxiliaryDataKeyDefaultValue key) const
+QVariant ModelNode::auxiliaryDataWithDefault(AuxiliaryDataKeyDefaultValue key, SL sl) const
{
if (!isValid())
return toQVariant(key.defaultValue);
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node auxiliary data with default 3",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
auto data = m_internalNode->auxiliaryData(key);
if (data)
@@ -959,69 +1364,123 @@ QVariant ModelNode::auxiliaryDataWithDefault(AuxiliaryDataKeyDefaultValue key) c
void ModelNode::setAuxiliaryData(AuxiliaryDataType type,
Utils::SmallStringView name,
- const QVariant &data) const
+ const QVariant &data,
+ SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set auxiliary data with type",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
setAuxiliaryData({type, name}, data);
}
-void ModelNode::setAuxiliaryData(AuxiliaryDataKeyView key, const QVariant &data) const
+void ModelNode::setAuxiliaryData(AuxiliaryDataKeyView key, const QVariant &data, SL sl) const
{
- if (isValid()) {
- if (key.type == AuxiliaryDataType::Persistent)
- ensureIdExists();
- Internal::WriteLocker locker(m_model.data());
- m_model->d->setAuxiliaryData(internalNode(), key, data);
- }
+ if (!isValid())
+ return;
+
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set auxiliary data with key",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
+ if (key.type == AuxiliaryDataType::Persistent)
+ ensureIdExists();
+ Internal::WriteLocker locker(m_model.data());
+ m_model->d->setAuxiliaryData(internalNode(), key, data);
}
-void ModelNode::setAuxiliaryDataWithoutLock(AuxiliaryDataKeyView key, const QVariant &data) const
+void ModelNode::setAuxiliaryDataWithoutLock(AuxiliaryDataKeyView key, const QVariant &data, SL sl) const
{
- if (isValid()) {
- if (key.type == AuxiliaryDataType::Persistent)
- ensureIdExists();
+ if (!isValid())
+ return;
- m_model->d->setAuxiliaryData(internalNode(), key, data);
- }
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set auxiliary data without lock with key",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
+ if (key.type == AuxiliaryDataType::Persistent)
+ ensureIdExists();
+
+ m_model->d->setAuxiliaryData(internalNode(), key, data);
}
void ModelNode::setAuxiliaryDataWithoutLock(AuxiliaryDataType type,
Utils::SmallStringView name,
- const QVariant &data) const
+ const QVariant &data,
+ SL sl) const
{
- if (isValid()) {
- if (type == AuxiliaryDataType::Persistent)
- ensureIdExists();
+ if (!isValid())
+ return;
- m_model->d->setAuxiliaryData(internalNode(), {type, name}, data);
- }
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set auxiliary data without lock with type",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
+ if (type == AuxiliaryDataType::Persistent)
+ ensureIdExists();
+
+ m_model->d->setAuxiliaryData(internalNode(), {type, name}, data);
}
-void ModelNode::removeAuxiliaryData(AuxiliaryDataKeyView key) const
+void ModelNode::removeAuxiliaryData(AuxiliaryDataKeyView key, SL sl) const
{
- if (isValid()) {
- if (key.type == AuxiliaryDataType::Persistent)
- ensureIdExists();
+ if (!isValid())
+ return;
- Internal::WriteLocker locker(m_model.data());
- m_model->d->removeAuxiliaryData(internalNode(), key);
- }
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node remove auxiliary data with key",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
+ if (key.type == AuxiliaryDataType::Persistent)
+ ensureIdExists();
+
+ Internal::WriteLocker locker(m_model.data());
+ m_model->d->removeAuxiliaryData(internalNode(), key);
}
-void ModelNode::removeAuxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name) const
+void ModelNode::removeAuxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name, SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node remove auxiliary data with type",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
removeAuxiliaryData({type, name});
}
-bool ModelNode::hasAuxiliaryData(AuxiliaryDataKeyView key) const
+bool ModelNode::hasAuxiliaryData(AuxiliaryDataKeyView key, SL sl) const
{
if (!isValid())
return false;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has auxiliary data with key",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_internalNode->hasAuxiliaryData(key);
}
-bool ModelNode::hasAuxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name) const
+bool ModelNode::hasAuxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name, SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has auxiliary data with type",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return hasAuxiliaryData({type, name});
}
@@ -1030,78 +1489,150 @@ bool ModelNode::hasAuxiliaryData(AuxiliaryDataType type) const
if (!isValid())
return false;
+ // using NanotraceHR::keyValue;
+ // NanotraceHR::Tracer tracer{"model node has auxiliary data with type",
+ // category(),
+ // keyValue("type id", m_internalNode->typeId),
+ // keyValue("caller location", sl)};
+
return m_internalNode->hasAuxiliaryData(type);
}
-AuxiliaryDatasForType ModelNode::auxiliaryData(AuxiliaryDataType type) const
+AuxiliaryDatasForType ModelNode::auxiliaryData(AuxiliaryDataType type, SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node auxiliary data with type",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_internalNode->auxiliaryData(type);
}
-AuxiliaryDatasView ModelNode::auxiliaryData() const
+AuxiliaryDatasView ModelNode::auxiliaryData(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node auxiliary data with sl",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_internalNode->auxiliaryData();
}
-QString ModelNode::customId() const
+QString ModelNode::customId(SL sl) const
{
auto data = auxiliaryData(customIdProperty);
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node custom id",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
if (data)
return data->toString();
return {};
}
-bool ModelNode::hasCustomId() const
+bool ModelNode::hasCustomId(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has custom id",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return hasAuxiliaryData(customIdProperty);
}
-void ModelNode::setCustomId(const QString &str)
+void ModelNode::setCustomId(const QString &str, SL sl)
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set custom id",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
setAuxiliaryData(customIdProperty, QVariant::fromValue(str));
}
-void ModelNode::removeCustomId()
+void ModelNode::removeCustomId(SL sl)
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node remove custom id",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
removeAuxiliaryData(customIdProperty);
}
-QVector<Comment> ModelNode::comments() const
+QVector<Comment> ModelNode::comments(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node comments",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return annotation().comments();
}
-bool ModelNode::hasComments() const
+bool ModelNode::hasComments(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has comments",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return annotation().hasComments();
}
-void ModelNode::setComments(const QVector<Comment> &coms)
+void ModelNode::setComments(const QVector<Comment> &coms, SL sl)
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set comments",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
Annotation anno = annotation();
anno.setComments(coms);
setAnnotation(anno);
}
-void ModelNode::addComment(const Comment &com)
+void ModelNode::addComment(const Comment &com, SL sl)
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node add comment",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
Annotation anno = annotation();
anno.addComment(com);
setAnnotation(anno);
}
-bool ModelNode::updateComment(const Comment &com, int position)
+bool ModelNode::updateComment(const Comment &com, int position, SL sl)
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node update comment",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
bool result = false;
if (hasAnnotation()) {
Annotation anno = annotation();
@@ -1115,8 +1646,14 @@ bool ModelNode::updateComment(const Comment &com, int position)
return result;
}
-Annotation ModelNode::annotation() const
+Annotation ModelNode::annotation(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node annotation",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
auto data = auxiliaryData(annotationProperty);
if (data)
@@ -1125,23 +1662,47 @@ Annotation ModelNode::annotation() const
return {};
}
-bool ModelNode::hasAnnotation() const
+bool ModelNode::hasAnnotation(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has annotation",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return hasAuxiliaryData(annotationProperty);
}
-void ModelNode::setAnnotation(const Annotation &annotation)
+void ModelNode::setAnnotation(const Annotation &annotation, SL sl)
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set annotation",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
setAuxiliaryData(annotationProperty, QVariant::fromValue(annotation.toQString()));
}
-void ModelNode::removeAnnotation()
+void ModelNode::removeAnnotation(SL sl)
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node remove annotation",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
removeAuxiliaryData(annotationProperty);
}
-Annotation ModelNode::globalAnnotation() const
+Annotation ModelNode::globalAnnotation(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node global annotation",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
Annotation result;
ModelNode root = m_model->rootModelNode();
@@ -1153,24 +1714,47 @@ Annotation ModelNode::globalAnnotation() const
return {};
}
-bool ModelNode::hasGlobalAnnotation() const
+bool ModelNode::hasGlobalAnnotation(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has global annotation",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_model->rootModelNode().hasAuxiliaryData(globalAnnotationProperty);
}
-void ModelNode::setGlobalAnnotation(const Annotation &annotation)
+void ModelNode::setGlobalAnnotation(const Annotation &annotation, SL sl)
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set global annotation",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
m_model->rootModelNode().setAuxiliaryData(globalAnnotationProperty,
QVariant::fromValue(annotation.toQString()));
}
-void ModelNode::removeGlobalAnnotation()
+void ModelNode::removeGlobalAnnotation(SL sl)
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node remove global annotation",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
m_model->rootModelNode().removeAuxiliaryData(globalAnnotationProperty);
}
-GlobalAnnotationStatus ModelNode::globalStatus() const
+GlobalAnnotationStatus ModelNode::globalStatus(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node global status",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
GlobalAnnotationStatus result;
ModelNode root = m_model->rootModelNode();
@@ -1182,26 +1766,50 @@ GlobalAnnotationStatus ModelNode::globalStatus() const
return result;
}
-bool ModelNode::hasGlobalStatus() const
+bool ModelNode::hasGlobalStatus(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has global status",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_model->rootModelNode().hasAuxiliaryData(globalAnnotationStatus);
}
-void ModelNode::setGlobalStatus(const GlobalAnnotationStatus &status)
+void ModelNode::setGlobalStatus(const GlobalAnnotationStatus &status, SL sl)
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set global status",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
m_model->rootModelNode().setAuxiliaryData(globalAnnotationStatus,
QVariant::fromValue(status.toQString()));
}
-void ModelNode::removeGlobalStatus()
+void ModelNode::removeGlobalStatus(SL sl)
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node remove global status",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
if (hasGlobalStatus()) {
m_model->rootModelNode().removeAuxiliaryData(globalAnnotationStatus);
}
}
-bool ModelNode::locked() const
+bool ModelNode::locked(SL sl) const
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node locked",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
auto data = auxiliaryData(lockedProperty);
if (data)
@@ -1210,13 +1818,25 @@ bool ModelNode::locked() const
return false;
}
-bool ModelNode::hasLocked() const
+bool ModelNode::hasLocked(SL sl) const
{
- return hasAuxiliaryData(lockedProperty);
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node has locked",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
+ return hasAuxiliaryData(lockedProperty, sl);
}
-void ModelNode::setLocked(bool value)
+void ModelNode::setLocked(bool value, SL sl)
{
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set locked",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
if (value) {
setAuxiliaryData(lockedProperty, true);
// Remove newly locked node and all its descendants from potential selection
@@ -1230,50 +1850,80 @@ void ModelNode::setLocked(bool value)
}
}
-void ModelNode::setScriptFunctions(const QStringList &scriptFunctionList)
+void ModelNode::setScriptFunctions(const QStringList &scriptFunctionList, SL sl)
{
if (!isValid())
return;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set script functions",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
model()->d->setScriptFunctions(m_internalNode, scriptFunctionList);
}
-QStringList ModelNode::scriptFunctions() const
+QStringList ModelNode::scriptFunctions(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node script functions",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_internalNode->scriptFunctions;
}
-qint32 ModelNode::internalId() const
+qint32 ModelNode::internalId(SL sl) const
{
if (!m_internalNode)
return -1;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node internal id",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_internalNode->internalId;
}
-void ModelNode::setNodeSource(const QString &newNodeSource)
+void ModelNode::setNodeSource(const QString &newNodeSource, SL sl)
{
Internal::WriteLocker locker(m_model.data());
if (!isValid())
return;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set node source",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
if (m_internalNode->nodeSource == newNodeSource)
return;
m_model.data()->d->setNodeSource(m_internalNode, newNodeSource);
}
-void ModelNode::setNodeSource(const QString &newNodeSource, NodeSourceType type)
+void ModelNode::setNodeSource(const QString &newNodeSource, NodeSourceType type, SL sl)
{
Internal::WriteLocker locker(m_model.data());
if (!isValid())
return;
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node set node source with type",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
if (m_internalNode->nodeSourceType == type && m_internalNode->nodeSource == newNodeSource)
return;
@@ -1281,37 +1931,61 @@ void ModelNode::setNodeSource(const QString &newNodeSource, NodeSourceType type)
m_model.data()->d->setNodeSource(m_internalNode, newNodeSource);
}
-QString ModelNode::nodeSource() const
+QString ModelNode::nodeSource(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node node source",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_internalNode->nodeSource;
}
-QString ModelNode::convertTypeToImportAlias() const
+QString ModelNode::convertTypeToImportAlias(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node convert type to import alias",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
if (model()->rewriterView())
return model()->rewriterView()->convertTypeToImportAlias(QString::fromLatin1(type()));
return QString::fromLatin1(type());
}
-ModelNode::NodeSourceType ModelNode::nodeSourceType() const
+ModelNode::NodeSourceType ModelNode::nodeSourceType(SL sl) const
{
if (!isValid())
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node node source type",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return static_cast<ModelNode::NodeSourceType>(m_internalNode->nodeSourceType);
}
-bool ModelNode::isComponent() const
+bool ModelNode::isComponent(SL sl) const
{
if (!isValid())
- return false;
+ return {};
+
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node is component",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
if (!metaInfo().isValid())
return false;
@@ -1364,12 +2038,18 @@ bool ModelNode::isComponent() const
return false;
}
-QIcon ModelNode::typeIcon() const
+QIcon ModelNode::typeIcon([[maybe_unused]] SL sl) const
{
#ifdef QDS_USE_PROJECTSTORAGE
if (!isValid())
return QIcon(QStringLiteral(":/ItemLibrary/images/item-invalid-icon.png"));
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node type icon",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
if (auto iconPath = metaInfo().iconPath(); iconPath.size())
return QIcon(iconPath.toQString());
else
@@ -1391,11 +2071,17 @@ QIcon ModelNode::typeIcon() const
#endif
}
-QString ModelNode::behaviorPropertyName() const
+QString ModelNode::behaviorPropertyName(SL sl) const
{
if (!m_internalNode)
return {};
+ using NanotraceHR::keyValue;
+ NanotraceHR::Tracer tracer{"model node behavior property name",
+ category(),
+ keyValue("type id", m_internalNode->typeId),
+ keyValue("caller location", sl)};
+
return m_internalNode->behaviorPropertyName;
}
diff --git a/tests/unit/tests/matchers/property-matcher.h b/tests/unit/tests/matchers/property-matcher.h
index 561a94cb69e..33922872bc7 100644
--- a/tests/unit/tests/matchers/property-matcher.h
+++ b/tests/unit/tests/matchers/property-matcher.h
@@ -17,7 +17,7 @@ class PropertyMatcher
public:
PropertyMatcher(Property property, const Matcher &matcher, Arguments... arguments)
: m_property(property)
- , matcher_(matcher)
+ , m_matcher(matcher)
, m_whose_property()
, m_arguments{arguments...}
{}
@@ -27,7 +27,7 @@ public:
const Matcher &matcher,
Arguments... arguments)
: m_property(property)
- , matcher_(matcher)
+ , m_matcher(matcher)
, m_whose_property(whose_property)
, m_arguments{arguments...}
{}
@@ -35,13 +35,13 @@ public:
void DescribeTo(::std::ostream *os) const
{
*os << "is an object " << m_whose_property;
- matcher_.DescribeTo(os);
+ m_matcher.DescribeTo(os);
}
void DescribeNegationTo(::std::ostream *os) const
{
*os << "is an object " << m_whose_property;
- matcher_.DescribeNegationTo(os);
+ m_matcher.DescribeNegationTo(os);
}
template<typename T>
@@ -52,14 +52,14 @@ public:
auto result = std::apply(
[&](auto &&...arguments) { return std::invoke(m_property, value, arguments...); },
m_arguments);
- return MatchPrintAndExplain(result, matcher_, listener);
+ return m_matcher.MatchAndExplain(result, listener->stream());
}
private:
Property m_property;
- const Matcher matcher_;
- const std::string m_whose_property;
- const std::tuple<Arguments...> m_arguments;
+ Matcher m_matcher;
+ std::string m_whose_property;
+ std::tuple<Arguments...> m_arguments;
};
template<typename PropertyMatcher>
diff --git a/tests/unit/tests/unittests/designsystem/dsthemeqml-test.cpp b/tests/unit/tests/unittests/designsystem/dsthemeqml-test.cpp
index 91205aeba18..48fb66eb97d 100644
--- a/tests/unit/tests/unittests/designsystem/dsthemeqml-test.cpp
+++ b/tests/unit/tests/unittests/designsystem/dsthemeqml-test.cpp
@@ -24,6 +24,8 @@ using QmlDesigner::Import;
using QmlDesigner::ModelNode;
using QmlDesigner::ThemeProperty;
+constexpr QmlDesigner::ModelTracing::SourceLocation sl;
+
namespace {
std::string formatedPropStr(std::string tag, const QByteArray &name, const QVariant &value)
{
@@ -136,7 +138,7 @@ TEST_P(DesignSystemQmlTest, group_aliase_properties_are_generated)
// assert
ASSERT_THAT(rootNode,
- AllOf(Property("ModelNode::type", &ModelNode::type, Eq("QtObject")),
+ AllOf(Property("ModelNode::type", &ModelNode::type, Eq("QtObject"), sl),
HasBindingProperty(groupName, binding),
HasBindingProperty("currentTheme", darkThemeName),
HasNodeProperty(darkThemeName, "QtObject")));
@@ -154,7 +156,7 @@ TEST_P(DesignSystemQmlTest, empty_groups_generate_no_group_aliase_properties)
// assert
ASSERT_THAT(rootNode,
- AllOf(Property("ModelNode::type", &ModelNode::type, Eq("QtObject")),
+ AllOf(Property("ModelNode::type", &ModelNode::type, Eq("QtObject"), sl),
Not(HasBindingProperty(groupName, binding)),
Not(HasBindingProperty("currentTheme", darkThemeName)),
Not(HasNodeProperty(darkThemeName, "QtObject"))));
diff --git a/tests/unit/tests/unittests/listmodeleditor/listmodeleditor-test.cpp b/tests/unit/tests/unittests/listmodeleditor/listmodeleditor-test.cpp
index 9fd89d5e78d..5b704599bb1 100644
--- a/tests/unit/tests/unittests/listmodeleditor/listmodeleditor-test.cpp
+++ b/tests/unit/tests/unittests/listmodeleditor/listmodeleditor-test.cpp
@@ -27,6 +27,8 @@ using QmlDesigner::PropertyDeclarationId;
using QmlDesigner::TypeId;
namespace Info = QmlDesigner::Storage::Info;
+constexpr QmlDesigner::ModelTracing::SourceLocation sl;
+
MATCHER_P2(HasItem,
name,
value,
@@ -388,10 +390,13 @@ TEST_F(ListModelEditor, add_row_creates_new_model_node_and_reparents)
{
model.setListModel(listModelNode);
- EXPECT_CALL(mockView, nodeCreated(Property("ModelNode::type", &ModelNode::type, Eq("ListElement"))));
EXPECT_CALL(mockView,
- nodeReparented(Property("ModelNode::type", &ModelNode::type, Eq("ListElement")),
- Property("AbstractProperty::parentModelNode", &AbstractProperty::parentModelNode, Eq(listModelNode)),
+ nodeCreated(Property("ModelNode::type", &ModelNode::type, Eq("ListElement"), sl)));
+ EXPECT_CALL(mockView,
+ nodeReparented(Property("ModelNode::type", &ModelNode::type, Eq("ListElement"), sl),
+ Property("AbstractProperty::parentModelNode",
+ &AbstractProperty::parentModelNode,
+ Eq(listModelNode)),
_,
_));
close