forked from qt-creator/qt-creator
QmlDesigner: Add trace points to modelnode
Task-number: QDS-15148 Change-Id: Ied23cefa319dfff8936cf91815454cb2558f3405 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -8,12 +8,13 @@
|
|||||||
#include "propertyeditorvalue.h"
|
#include "propertyeditorvalue.h"
|
||||||
#include "propertyeditorwidget.h"
|
#include "propertyeditorwidget.h"
|
||||||
|
|
||||||
|
#include "qmldesignerplugin.h"
|
||||||
#include <asset.h>
|
#include <asset.h>
|
||||||
#include <auxiliarydataproperties.h>
|
#include <auxiliarydataproperties.h>
|
||||||
#include <dynamicpropertiesmodel.h>
|
#include <dynamicpropertiesmodel.h>
|
||||||
|
#include <functional.h>
|
||||||
#include <nodemetainfo.h>
|
#include <nodemetainfo.h>
|
||||||
#include <qmldesignerconstants.h>
|
#include <qmldesignerconstants.h>
|
||||||
#include "qmldesignerplugin.h"
|
|
||||||
#include <qmltimeline.h>
|
#include <qmltimeline.h>
|
||||||
|
|
||||||
#include <rewritingexception.h>
|
#include <rewritingexception.h>
|
||||||
@@ -863,11 +864,16 @@ void PropertyEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode)
|
|||||||
|
|
||||||
const ModelNodes &allRemovedNodes = removedNode.allSubModelNodesAndThisNode();
|
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;
|
m_textureAboutToBeRemoved = true;
|
||||||
|
|
||||||
if (m_qmlBackEndForCurrentType) {
|
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);
|
m_qmlBackEndForCurrentType->contextObject()->setHasMaterialLibrary(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1262,12 +1268,17 @@ void PropertyEditorView::nodeReparented(const ModelNode &node,
|
|||||||
if (node == activeNode())
|
if (node == activeNode())
|
||||||
m_qmlBackEndForCurrentType->backendAnchorBinding().setup(QmlItemNode(activeNode()));
|
m_qmlBackEndForCurrentType->backendAnchorBinding().setup(QmlItemNode(activeNode()));
|
||||||
|
|
||||||
|
using SL = const ModelTracing::SourceLocation;
|
||||||
const ModelNodes &allNodes = node.allSubModelNodesAndThisNode();
|
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();
|
m_qmlBackEndForCurrentType->refreshBackendModel();
|
||||||
|
|
||||||
if (m_qmlBackEndForCurrentType) {
|
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);
|
m_qmlBackEndForCurrentType->contextObject()->setHasMaterialLibrary(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -120,7 +120,7 @@ QString QmlModelNodeProxy::simplifiedTypeName() const
|
|||||||
|
|
||||||
static QList<int> toInternalIdList(const QList<ModelNode> &nodes)
|
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
|
QList<int> QmlModelNodeProxy::allChildren(int internalId) const
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
#include <bindingproperty.h>
|
#include <bindingproperty.h>
|
||||||
#include <designeralgorithm.h>
|
#include <designeralgorithm.h>
|
||||||
#include <exception.h>
|
#include <exception.h>
|
||||||
|
#include <functional.h>
|
||||||
#include <modelutils.h>
|
#include <modelutils.h>
|
||||||
#include <nodeabstractproperty.h>
|
#include <nodeabstractproperty.h>
|
||||||
#include <nodelistproperty.h>
|
#include <nodelistproperty.h>
|
||||||
@@ -904,7 +905,8 @@ void PropertyTreeModelDelegate::setPropertyType(PropertyTreeModel::PropertyTypes
|
|||||||
void PropertyTreeModelDelegate::setup(const QString &id, const QString &name, bool *nameExists)
|
void PropertyTreeModelDelegate::setup(const QString &id, const QString &name, bool *nameExists)
|
||||||
{
|
{
|
||||||
m_model.resetModel();
|
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))
|
if (!idLists.contains(id))
|
||||||
idLists.prepend(id);
|
idLists.prepend(id);
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
#include "scripteditorutils.h"
|
#include "scripteditorutils.h"
|
||||||
|
|
||||||
#include <abstractview.h>
|
#include <abstractview.h>
|
||||||
|
#include <functional.h>
|
||||||
#include <indentingtexteditormodifier.h>
|
#include <indentingtexteditormodifier.h>
|
||||||
#include <modelnodeoperations.h>
|
#include <modelnodeoperations.h>
|
||||||
#include <nodelistproperty.h>
|
#include <nodelistproperty.h>
|
||||||
@@ -842,13 +843,14 @@ void StatementDelegate::setupChangeState()
|
|||||||
&& !item.allStateNames().isEmpty();
|
&& !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 groups = m_view->allModelNodesOfType(model->qtQuickStateGroupMetaInfo());
|
||||||
|
|
||||||
const auto rootId = m_view->rootModelNode().id();
|
const auto rootId = m_view->rootModelNode().id();
|
||||||
itemIds.removeAll(rootId);
|
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(itemIds);
|
||||||
Utils::sort(groupIds);
|
Utils::sort(groupIds);
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <bindingproperty.h>
|
#include <bindingproperty.h>
|
||||||
#include <designermcumanager.h>
|
#include <designermcumanager.h>
|
||||||
|
#include <functional.h>
|
||||||
#include <modelnode.h>
|
#include <modelnode.h>
|
||||||
#include <modelnodeoperations.h>
|
#include <modelnodeoperations.h>
|
||||||
#include <nodelistproperty.h>
|
#include <nodelistproperty.h>
|
||||||
@@ -276,8 +277,9 @@ QStringList StatesEditorModel::stateGroups() const
|
|||||||
|
|
||||||
const auto groupMetaInfo = m_statesEditorView->model()->qtQuickStateGroupMetaInfo();
|
const auto groupMetaInfo = m_statesEditorView->model()->qtQuickStateGroupMetaInfo();
|
||||||
|
|
||||||
|
using SL = ModelTracing::SourceLocation;
|
||||||
auto stateGroups = Utils::transform(m_statesEditorView->allModelNodesOfType(groupMetaInfo),
|
auto stateGroups = Utils::transform(m_statesEditorView->allModelNodesOfType(groupMetaInfo),
|
||||||
&ModelNode::displayName);
|
bind_back(&ModelNode::displayName, SL{}));
|
||||||
stateGroups.prepend(tr("Default"));
|
stateGroups.prepend(tr("Default"));
|
||||||
return stateGroups;
|
return stateGroups;
|
||||||
}
|
}
|
||||||
|
@@ -7,13 +7,14 @@
|
|||||||
|
|
||||||
#include <abstractview.h>
|
#include <abstractview.h>
|
||||||
#include <bindingproperty.h>
|
#include <bindingproperty.h>
|
||||||
|
#include <dialogutils.h>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <functional.h>
|
||||||
#include <nodelistproperty.h>
|
#include <nodelistproperty.h>
|
||||||
#include <nodemetainfo.h>
|
#include <nodemetainfo.h>
|
||||||
|
#include <qmlitemnode.h>
|
||||||
#include <rewritertransaction.h>
|
#include <rewritertransaction.h>
|
||||||
#include <variantproperty.h>
|
#include <variantproperty.h>
|
||||||
#include <qmlitemnode.h>
|
|
||||||
#include <dialogutils.h>
|
|
||||||
|
|
||||||
#include <coreplugin/messagebox.h>
|
#include <coreplugin/messagebox.h>
|
||||||
|
|
||||||
@@ -220,8 +221,9 @@ void TransitionForm::setupStateGroups()
|
|||||||
|
|
||||||
const auto groupMetaInfo = view->model()->qtQuickStateGroupMetaInfo();
|
const auto groupMetaInfo = view->model()->qtQuickStateGroupMetaInfo();
|
||||||
|
|
||||||
|
using SL = ModelTracing::SourceLocation;
|
||||||
auto stateGroups = Utils::transform(view->allModelNodesOfType(groupMetaInfo),
|
auto stateGroups = Utils::transform(view->allModelNodesOfType(groupMetaInfo),
|
||||||
&ModelNode::displayName);
|
bind_back(&ModelNode::displayName, SL{}));
|
||||||
stateGroups.prepend(tr("Default"));
|
stateGroups.prepend(tr("Default"));
|
||||||
|
|
||||||
bool block = ui->stateGroupComboBox->blockSignals(true);
|
bool block = ui->stateGroupComboBox->blockSignals(true);
|
||||||
|
@@ -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
|
} // namespace QmlDesigner
|
||||||
|
@@ -3,17 +3,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "auxiliarydata.h"
|
|
||||||
#include "abstractproperty.h"
|
#include "abstractproperty.h"
|
||||||
#include "qmldesignercorelib_global.h"
|
#include "auxiliarydata.h"
|
||||||
|
|
||||||
#include <QPointer>
|
#include <tracing/qmldesignertracingsourcelocation.h>
|
||||||
#include <QList>
|
|
||||||
#include <QVector>
|
|
||||||
#include <QVariant>
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <optional>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QTextStream;
|
class QTextStream;
|
||||||
@@ -75,6 +68,8 @@ class QMLDESIGNERCORE_EXPORT ModelNode
|
|||||||
friend NodeAbstractProperty;
|
friend NodeAbstractProperty;
|
||||||
friend NodeProperty;
|
friend NodeProperty;
|
||||||
|
|
||||||
|
using SL = ModelTracing::SourceLocation;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeSourceType {
|
enum NodeSourceType {
|
||||||
NodeWithoutSource = 0,
|
NodeWithoutSource = 0,
|
||||||
@@ -91,161 +86,172 @@ public:
|
|||||||
ModelNode &operator=(ModelNode &&) noexcept = default;
|
ModelNode &operator=(ModelNode &&) noexcept = default;
|
||||||
~ModelNode() = default;
|
~ModelNode() = default;
|
||||||
|
|
||||||
TypeName type() const;
|
TypeName type(SL sl = {}) const;
|
||||||
QString simplifiedTypeName() const;
|
QString simplifiedTypeName(SL sl = {}) const;
|
||||||
QString displayName() const;
|
QString displayName(SL sl = {}) const;
|
||||||
int minorVersion() const;
|
int minorVersion(SL sl = {}) const;
|
||||||
int majorVersion() const;
|
int majorVersion(SL sl = {}) const;
|
||||||
|
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
explicit operator bool() const { return isValid(); }
|
explicit operator bool() const { return isValid(); }
|
||||||
bool isInHierarchy() const;
|
|
||||||
|
|
||||||
|
bool isInHierarchy(SL sl = {}) const;
|
||||||
|
|
||||||
NodeAbstractProperty parentProperty() const;
|
NodeAbstractProperty parentProperty(SL sl = {}) const;
|
||||||
void setParentProperty(NodeAbstractProperty parent);
|
void setParentProperty(NodeAbstractProperty parent, SL sl = {});
|
||||||
void changeType(const TypeName &typeName, int majorVersion = -1, int minorVersion = -1);
|
void changeType(const TypeName &typeName, int majorVersion = -1, int minorVersion = -1, SL sl = {});
|
||||||
void setParentProperty(const ModelNode &newParentNode, const PropertyName &propertyName);
|
void setParentProperty(const ModelNode &newParentNode,
|
||||||
bool hasParentProperty() const;
|
const PropertyName &propertyName,
|
||||||
|
SL sl = {});
|
||||||
|
bool hasParentProperty(SL sl = {}) const;
|
||||||
|
|
||||||
QList<ModelNode> directSubModelNodes() const;
|
QList<ModelNode> directSubModelNodes(SL sl = {}) const;
|
||||||
QList<ModelNode> directSubModelNodesOfType(const NodeMetaInfo &type) const;
|
QList<ModelNode> directSubModelNodesOfType(const NodeMetaInfo &type, SL sl = {}) const;
|
||||||
QList<ModelNode> subModelNodesOfType(const NodeMetaInfo &type) const;
|
QList<ModelNode> subModelNodesOfType(const NodeMetaInfo &type, SL sl = {}) const;
|
||||||
|
|
||||||
QList<ModelNode> allSubModelNodes() const;
|
QList<ModelNode> allSubModelNodes(SL sl = {}) const;
|
||||||
QList<ModelNode> allSubModelNodesAndThisNode() const;
|
QList<ModelNode> allSubModelNodesAndThisNode(SL sl = {}) const;
|
||||||
bool hasAnySubModelNodes() const;
|
bool hasAnySubModelNodes(SL sl = {}) const;
|
||||||
|
|
||||||
//###
|
//###
|
||||||
|
|
||||||
AbstractProperty property(PropertyNameView name) const;
|
AbstractProperty property(PropertyNameView name, SL sl = {}) const;
|
||||||
VariantProperty variantProperty(PropertyNameView name) const;
|
VariantProperty variantProperty(PropertyNameView name, SL sl = {}) const;
|
||||||
BindingProperty bindingProperty(PropertyNameView name) const;
|
BindingProperty bindingProperty(PropertyNameView name, SL sl = {}) const;
|
||||||
SignalHandlerProperty signalHandlerProperty(PropertyNameView name) const;
|
SignalHandlerProperty signalHandlerProperty(PropertyNameView name, SL sl = {}) const;
|
||||||
SignalDeclarationProperty signalDeclarationProperty(PropertyNameView name) const;
|
SignalDeclarationProperty signalDeclarationProperty(PropertyNameView name, SL sl = {}) const;
|
||||||
NodeListProperty nodeListProperty(PropertyNameView name) const;
|
NodeListProperty nodeListProperty(PropertyNameView name, SL sl = {}) const;
|
||||||
NodeProperty nodeProperty(PropertyNameView name) const;
|
NodeProperty nodeProperty(PropertyNameView name, SL sl = {}) const;
|
||||||
NodeAbstractProperty nodeAbstractProperty(PropertyNameView name) const;
|
NodeAbstractProperty nodeAbstractProperty(PropertyNameView name, SL sl = {}) const;
|
||||||
NodeAbstractProperty defaultNodeAbstractProperty() const;
|
NodeAbstractProperty defaultNodeAbstractProperty(SL sl = {}) const;
|
||||||
NodeListProperty defaultNodeListProperty() const;
|
NodeListProperty defaultNodeListProperty(SL sl = {}) const;
|
||||||
NodeProperty defaultNodeProperty() const;
|
NodeProperty defaultNodeProperty(SL sl = {}) const;
|
||||||
|
|
||||||
void removeProperty(PropertyNameView name) const; //### also implement in AbstractProperty
|
void removeProperty(PropertyNameView name, SL sl = {}) const; //### also implement in AbstractProperty
|
||||||
QList<AbstractProperty> properties() const;
|
QList<AbstractProperty> properties(SL sl = {}) const;
|
||||||
QList<VariantProperty> variantProperties() const;
|
QList<VariantProperty> variantProperties(SL sl = {}) const;
|
||||||
QList<NodeAbstractProperty> nodeAbstractProperties() const;
|
QList<NodeAbstractProperty> nodeAbstractProperties(SL sl = {}) const;
|
||||||
QList<NodeProperty> nodeProperties() const;
|
QList<NodeProperty> nodeProperties(SL sl = {}) const;
|
||||||
QList<NodeListProperty> nodeListProperties() const;
|
QList<NodeListProperty> nodeListProperties(SL sl = {}) const;
|
||||||
QList<BindingProperty> bindingProperties() const;
|
QList<BindingProperty> bindingProperties(SL sl = {}) const;
|
||||||
QList<SignalHandlerProperty> signalProperties() const;
|
QList<SignalHandlerProperty> signalProperties(SL sl = {}) const;
|
||||||
QList<AbstractProperty> dynamicProperties() const;
|
QList<AbstractProperty> dynamicProperties(SL sl = {}) const;
|
||||||
PropertyNameList propertyNames() const;
|
PropertyNameList propertyNames(SL sl = {}) const;
|
||||||
|
|
||||||
bool hasProperty(PropertyNameView name) const;
|
bool hasProperty(PropertyNameView name, SL sl = {}) const;
|
||||||
bool hasVariantProperty(PropertyNameView name) const;
|
bool hasVariantProperty(PropertyNameView name, SL sl = {}) const;
|
||||||
bool hasBindingProperty(PropertyNameView name) const;
|
bool hasBindingProperty(PropertyNameView name, SL sl = {}) const;
|
||||||
bool hasSignalHandlerProperty(PropertyNameView name) const;
|
bool hasSignalHandlerProperty(PropertyNameView name, SL sl = {}) const;
|
||||||
bool hasNodeAbstractProperty(PropertyNameView name) const;
|
bool hasNodeAbstractProperty(PropertyNameView name, SL sl = {}) const;
|
||||||
bool hasDefaultNodeAbstractProperty() const;
|
bool hasDefaultNodeAbstractProperty(SL sl = {}) const;
|
||||||
bool hasDefaultNodeListProperty() const;
|
bool hasDefaultNodeListProperty(SL sl = {}) const;
|
||||||
bool hasDefaultNodeProperty() const;
|
bool hasDefaultNodeProperty(SL sl = {}) const;
|
||||||
bool hasNodeProperty(PropertyNameView name) const;
|
bool hasNodeProperty(PropertyNameView name, SL sl = {}) const;
|
||||||
bool hasNodeListProperty(PropertyNameView name) const;
|
bool hasNodeListProperty(PropertyNameView name, SL sl = {}) const;
|
||||||
bool hasProperty(PropertyNameView name, PropertyType propertyType) const;
|
bool hasProperty(PropertyNameView name, PropertyType propertyType, SL sl = {}) const;
|
||||||
|
|
||||||
void setScriptFunctions(const QStringList &scriptFunctionList);
|
void setScriptFunctions(const QStringList &scriptFunctionList, SL sl = {});
|
||||||
QStringList scriptFunctions() const;
|
QStringList scriptFunctions(SL sl = {}) const;
|
||||||
|
|
||||||
//###
|
//###
|
||||||
void destroy();
|
void destroy(SL sl = {});
|
||||||
|
|
||||||
QString id() const;
|
QString id(SL sl = {}) const;
|
||||||
void ensureIdExists() const;
|
void ensureIdExists(SL sl = {}) const;
|
||||||
[[nodiscard]] QString validId() const;
|
[[nodiscard]] QString validId(SL sl = {}) const;
|
||||||
void setIdWithRefactoring(const QString &id) const;
|
void setIdWithRefactoring(const QString &id, SL sl = {}) const;
|
||||||
void setIdWithoutRefactoring(const QString &id) const;
|
void setIdWithoutRefactoring(const QString &id, SL sl = {}) const;
|
||||||
static bool isValidId(const QString &id);
|
static bool isValidId(const QString &id);
|
||||||
static QString getIdValidityErrorMessage(const QString &id);
|
static QString getIdValidityErrorMessage(const QString &id);
|
||||||
|
|
||||||
bool hasId() const;
|
bool hasId(SL sl = {}) const;
|
||||||
|
|
||||||
Model *model() const;
|
Model *model() const;
|
||||||
AbstractView *view() const;
|
AbstractView *view() const;
|
||||||
|
|
||||||
NodeMetaInfo metaInfo() const;
|
NodeMetaInfo metaInfo(SL sl = {}) const;
|
||||||
bool hasMetaInfo() const;
|
bool hasMetaInfo(SL sl = {}) const;
|
||||||
|
|
||||||
bool isSelected() const;
|
bool isSelected(SL sl = {}) const;
|
||||||
bool isRootNode() const;
|
bool isRootNode(SL sl = {}) const;
|
||||||
|
|
||||||
bool isAncestorOf(const ModelNode &node) const;
|
bool isAncestorOf(const ModelNode &node, SL sl = {}) const;
|
||||||
void selectNode();
|
void selectNode(SL sl = {});
|
||||||
void deselectNode();
|
void deselectNode(SL sl = {});
|
||||||
|
|
||||||
static int variantTypeId();
|
static int variantTypeId();
|
||||||
QVariant toVariant() const;
|
QVariant toVariant(SL sl = {}) const;
|
||||||
|
|
||||||
std::optional<QVariant> auxiliaryData(AuxiliaryDataKeyView key) const;
|
std::optional<QVariant> auxiliaryData(AuxiliaryDataKeyView key, SL sl = {}) const;
|
||||||
std::optional<QVariant> auxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name) const;
|
std::optional<QVariant> auxiliaryData(AuxiliaryDataType type,
|
||||||
QVariant auxiliaryDataWithDefault(AuxiliaryDataType type, Utils::SmallStringView name) const;
|
Utils::SmallStringView name,
|
||||||
QVariant auxiliaryDataWithDefault(AuxiliaryDataKeyView key) const;
|
SL sl = {}) const;
|
||||||
QVariant auxiliaryDataWithDefault(AuxiliaryDataKeyDefaultValue key) const;
|
QVariant auxiliaryDataWithDefault(AuxiliaryDataType type,
|
||||||
void setAuxiliaryData(AuxiliaryDataKeyView key, const QVariant &data) const;
|
Utils::SmallStringView name,
|
||||||
void setAuxiliaryDataWithoutLock(AuxiliaryDataKeyView key, const QVariant &data) const;
|
SL sl = {}) const;
|
||||||
void setAuxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name, const QVariant &data) 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,
|
void setAuxiliaryDataWithoutLock(AuxiliaryDataType type,
|
||||||
Utils::SmallStringView name,
|
Utils::SmallStringView name,
|
||||||
const QVariant &data) const;
|
const QVariant &data,
|
||||||
void removeAuxiliaryData(AuxiliaryDataKeyView key) const;
|
SL sl = {}) const;
|
||||||
void removeAuxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name) const;
|
void removeAuxiliaryData(AuxiliaryDataKeyView key, SL sl = {}) const;
|
||||||
bool hasAuxiliaryData(AuxiliaryDataKeyView key) const;
|
void removeAuxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name, SL sl = {}) const;
|
||||||
bool hasAuxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name) const;
|
bool hasAuxiliaryData(AuxiliaryDataKeyView key, SL sl = {}) const;
|
||||||
|
bool hasAuxiliaryData(AuxiliaryDataType type, Utils::SmallStringView name, SL sl = {}) const;
|
||||||
bool hasAuxiliaryData(AuxiliaryDataType type) const;
|
bool hasAuxiliaryData(AuxiliaryDataType type) const;
|
||||||
AuxiliaryDatasForType auxiliaryData(AuxiliaryDataType type) const;
|
AuxiliaryDatasForType auxiliaryData(AuxiliaryDataType type, SL sl = {}) const;
|
||||||
AuxiliaryDatasView auxiliaryData() const;
|
AuxiliaryDatasView auxiliaryData(SL sl = {}) const;
|
||||||
|
|
||||||
QString customId() const;
|
QString customId(SL sl = {}) const;
|
||||||
bool hasCustomId() const;
|
bool hasCustomId(SL sl = {}) const;
|
||||||
void setCustomId(const QString &str);
|
void setCustomId(const QString &str, SL sl = {});
|
||||||
void removeCustomId();
|
void removeCustomId(SL sl = {});
|
||||||
|
|
||||||
QVector<Comment> comments() const;
|
QVector<Comment> comments(SL sl = {}) const;
|
||||||
bool hasComments() const;
|
bool hasComments(SL sl = {}) const;
|
||||||
void setComments(const QVector<Comment> &coms);
|
void setComments(const QVector<Comment> &coms, SL sl = {});
|
||||||
void addComment(const Comment &com);
|
void addComment(const Comment &com, SL sl = {});
|
||||||
bool updateComment(const Comment &com, int position);
|
bool updateComment(const Comment &com, int position, SL sl = {});
|
||||||
|
|
||||||
Annotation annotation() const;
|
Annotation annotation(SL sl = {}) const;
|
||||||
bool hasAnnotation() const;
|
bool hasAnnotation(SL sl = {}) const;
|
||||||
void setAnnotation(const Annotation &annotation);
|
void setAnnotation(const Annotation &annotation, SL sl = {});
|
||||||
void removeAnnotation();
|
void removeAnnotation(SL sl = {});
|
||||||
|
|
||||||
Annotation globalAnnotation() const;
|
Annotation globalAnnotation(SL sl = {}) const;
|
||||||
bool hasGlobalAnnotation() const;
|
bool hasGlobalAnnotation(SL sl = {}) const;
|
||||||
void setGlobalAnnotation(const Annotation &annotation);
|
void setGlobalAnnotation(const Annotation &annotation, SL sl = {});
|
||||||
void removeGlobalAnnotation();
|
void removeGlobalAnnotation(SL sl = {});
|
||||||
|
|
||||||
GlobalAnnotationStatus globalStatus() const;
|
GlobalAnnotationStatus globalStatus(SL sl = {}) const;
|
||||||
bool hasGlobalStatus() const;
|
bool hasGlobalStatus(SL sl = {}) const;
|
||||||
void setGlobalStatus(const GlobalAnnotationStatus &status);
|
void setGlobalStatus(const GlobalAnnotationStatus &status, SL sl = {});
|
||||||
void removeGlobalStatus();
|
void removeGlobalStatus(SL sl = {});
|
||||||
|
|
||||||
bool locked() const;
|
bool locked(SL sl = {}) const;
|
||||||
void setLocked(bool value);
|
void setLocked(bool value, SL sl = {});
|
||||||
|
|
||||||
qint32 internalId() const;
|
qint32 internalId(SL sl = {}) const;
|
||||||
|
|
||||||
void setNodeSource(const QString&);
|
void setNodeSource(const QString &str, SL sl = {});
|
||||||
void setNodeSource(const QString &newNodeSource, NodeSourceType type);
|
void setNodeSource(const QString &newNodeSource, NodeSourceType type, SL sl = {});
|
||||||
QString nodeSource() const;
|
QString nodeSource(SL sl = {}) const;
|
||||||
|
|
||||||
QString convertTypeToImportAlias() const;
|
QString convertTypeToImportAlias(SL sl = {}) const;
|
||||||
|
|
||||||
NodeSourceType nodeSourceType() const;
|
NodeSourceType nodeSourceType(SL sl = {}) const;
|
||||||
|
|
||||||
bool isComponent() const;
|
bool isComponent(SL sl = {}) const;
|
||||||
QIcon typeIcon() const;
|
QIcon typeIcon(SL sl = {}) const;
|
||||||
QString behaviorPropertyName() const;
|
QString behaviorPropertyName(SL sl = {}) const;
|
||||||
|
|
||||||
friend void swap(ModelNode &first, ModelNode &second) noexcept
|
friend void swap(ModelNode &first, ModelNode &second) noexcept
|
||||||
{
|
{
|
||||||
@@ -273,7 +279,7 @@ private: // functions
|
|||||||
|
|
||||||
template<typename Type, typename... PropertyType>
|
template<typename Type, typename... PropertyType>
|
||||||
QList<Type> properties(PropertyType... type) const;
|
QList<Type> properties(PropertyType... type) const;
|
||||||
bool hasLocked() const;
|
bool hasLocked(SL sl = {}) const;
|
||||||
|
|
||||||
private: // variables
|
private: // variables
|
||||||
Internal::InternalNodePointer m_internalNode;
|
Internal::InternalNodePointer m_internalNode;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -17,7 +17,7 @@ class PropertyMatcher
|
|||||||
public:
|
public:
|
||||||
PropertyMatcher(Property property, const Matcher &matcher, Arguments... arguments)
|
PropertyMatcher(Property property, const Matcher &matcher, Arguments... arguments)
|
||||||
: m_property(property)
|
: m_property(property)
|
||||||
, matcher_(matcher)
|
, m_matcher(matcher)
|
||||||
, m_whose_property()
|
, m_whose_property()
|
||||||
, m_arguments{arguments...}
|
, m_arguments{arguments...}
|
||||||
{}
|
{}
|
||||||
@@ -27,7 +27,7 @@ public:
|
|||||||
const Matcher &matcher,
|
const Matcher &matcher,
|
||||||
Arguments... arguments)
|
Arguments... arguments)
|
||||||
: m_property(property)
|
: m_property(property)
|
||||||
, matcher_(matcher)
|
, m_matcher(matcher)
|
||||||
, m_whose_property(whose_property)
|
, m_whose_property(whose_property)
|
||||||
, m_arguments{arguments...}
|
, m_arguments{arguments...}
|
||||||
{}
|
{}
|
||||||
@@ -35,13 +35,13 @@ public:
|
|||||||
void DescribeTo(::std::ostream *os) const
|
void DescribeTo(::std::ostream *os) const
|
||||||
{
|
{
|
||||||
*os << "is an object " << m_whose_property;
|
*os << "is an object " << m_whose_property;
|
||||||
matcher_.DescribeTo(os);
|
m_matcher.DescribeTo(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DescribeNegationTo(::std::ostream *os) const
|
void DescribeNegationTo(::std::ostream *os) const
|
||||||
{
|
{
|
||||||
*os << "is an object " << m_whose_property;
|
*os << "is an object " << m_whose_property;
|
||||||
matcher_.DescribeNegationTo(os);
|
m_matcher.DescribeNegationTo(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@@ -52,14 +52,14 @@ public:
|
|||||||
auto result = std::apply(
|
auto result = std::apply(
|
||||||
[&](auto &&...arguments) { return std::invoke(m_property, value, arguments...); },
|
[&](auto &&...arguments) { return std::invoke(m_property, value, arguments...); },
|
||||||
m_arguments);
|
m_arguments);
|
||||||
return MatchPrintAndExplain(result, matcher_, listener);
|
return m_matcher.MatchAndExplain(result, listener->stream());
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Property m_property;
|
Property m_property;
|
||||||
const Matcher matcher_;
|
Matcher m_matcher;
|
||||||
const std::string m_whose_property;
|
std::string m_whose_property;
|
||||||
const std::tuple<Arguments...> m_arguments;
|
std::tuple<Arguments...> m_arguments;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename PropertyMatcher>
|
template<typename PropertyMatcher>
|
||||||
|
@@ -24,6 +24,8 @@ using QmlDesigner::Import;
|
|||||||
using QmlDesigner::ModelNode;
|
using QmlDesigner::ModelNode;
|
||||||
using QmlDesigner::ThemeProperty;
|
using QmlDesigner::ThemeProperty;
|
||||||
|
|
||||||
|
constexpr QmlDesigner::ModelTracing::SourceLocation sl;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
std::string formatedPropStr(std::string tag, const QByteArray &name, const QVariant &value)
|
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
|
||||||
ASSERT_THAT(rootNode,
|
ASSERT_THAT(rootNode,
|
||||||
AllOf(Property("ModelNode::type", &ModelNode::type, Eq("QtObject")),
|
AllOf(Property("ModelNode::type", &ModelNode::type, Eq("QtObject"), sl),
|
||||||
HasBindingProperty(groupName, binding),
|
HasBindingProperty(groupName, binding),
|
||||||
HasBindingProperty("currentTheme", darkThemeName),
|
HasBindingProperty("currentTheme", darkThemeName),
|
||||||
HasNodeProperty(darkThemeName, "QtObject")));
|
HasNodeProperty(darkThemeName, "QtObject")));
|
||||||
@@ -154,7 +156,7 @@ TEST_P(DesignSystemQmlTest, empty_groups_generate_no_group_aliase_properties)
|
|||||||
|
|
||||||
// assert
|
// assert
|
||||||
ASSERT_THAT(rootNode,
|
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(groupName, binding)),
|
||||||
Not(HasBindingProperty("currentTheme", darkThemeName)),
|
Not(HasBindingProperty("currentTheme", darkThemeName)),
|
||||||
Not(HasNodeProperty(darkThemeName, "QtObject"))));
|
Not(HasNodeProperty(darkThemeName, "QtObject"))));
|
||||||
|
@@ -27,6 +27,8 @@ using QmlDesigner::PropertyDeclarationId;
|
|||||||
using QmlDesigner::TypeId;
|
using QmlDesigner::TypeId;
|
||||||
namespace Info = QmlDesigner::Storage::Info;
|
namespace Info = QmlDesigner::Storage::Info;
|
||||||
|
|
||||||
|
constexpr QmlDesigner::ModelTracing::SourceLocation sl;
|
||||||
|
|
||||||
MATCHER_P2(HasItem,
|
MATCHER_P2(HasItem,
|
||||||
name,
|
name,
|
||||||
value,
|
value,
|
||||||
@@ -388,10 +390,13 @@ TEST_F(ListModelEditor, add_row_creates_new_model_node_and_reparents)
|
|||||||
{
|
{
|
||||||
model.setListModel(listModelNode);
|
model.setListModel(listModelNode);
|
||||||
|
|
||||||
EXPECT_CALL(mockView, nodeCreated(Property("ModelNode::type", &ModelNode::type, Eq("ListElement"))));
|
|
||||||
EXPECT_CALL(mockView,
|
EXPECT_CALL(mockView,
|
||||||
nodeReparented(Property("ModelNode::type", &ModelNode::type, Eq("ListElement")),
|
nodeCreated(Property("ModelNode::type", &ModelNode::type, Eq("ListElement"), sl)));
|
||||||
Property("AbstractProperty::parentModelNode", &AbstractProperty::parentModelNode, Eq(listModelNode)),
|
EXPECT_CALL(mockView,
|
||||||
|
nodeReparented(Property("ModelNode::type", &ModelNode::type, Eq("ListElement"), sl),
|
||||||
|
Property("AbstractProperty::parentModelNode",
|
||||||
|
&AbstractProperty::parentModelNode,
|
||||||
|
Eq(listModelNode)),
|
||||||
_,
|
_,
|
||||||
_));
|
_));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user