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 "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);
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
@@ -3,17 +3,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "auxiliarydata.h"
|
||||
#include "abstractproperty.h"
|
||||
#include "qmldesignercorelib_global.h"
|
||||
#include "auxiliarydata.h"
|
||||
|
||||
#include <QPointer>
|
||||
#include <QList>
|
||||
#include <QVector>
|
||||
#include <QVariant>
|
||||
|
||||
#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;
|
||||
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) 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;
|
||||
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) 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;
|
||||
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);
|
||||
QStringList scriptFunctions() 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;
|
||||
QVariant toVariant(SL sl = {}) 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;
|
||||
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;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -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>
|
||||
|
@@ -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"))));
|
||||
|
@@ -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)),
|
||||
_,
|
||||
_));
|
||||
|
||||
|
Reference in New Issue
Block a user