QmlDesigner: Use new validation approach in curve editor

Many validation tests can now be skipped.

Task-number: QDS-7454
Change-Id: I24aa4023808a42215a6e79c15f962128702ff51c
Reviewed-by: Knud Dollereder <knud.dollereder@qt.io>
This commit is contained in:
Marco Bubke
2022-08-31 10:21:55 +02:00
parent 7ffb66ade2
commit 432ed0a72d

View File

@@ -144,7 +144,6 @@ void CurveEditorView::variantPropertiesChanged([[maybe_unused]] const QList<Vari
for (const auto &property : propertyList) { for (const auto &property : propertyList) {
if ((property.name() == "frame" || property.name() == "value") if ((property.name() == "frame" || property.name() == "value")
&& property.parentModelNode().type() == "QtQuick.Timeline.Keyframe" && property.parentModelNode().type() == "QtQuick.Timeline.Keyframe"
&& property.parentModelNode().isValid()
&& property.parentModelNode().hasParentProperty()) { && property.parentModelNode().hasParentProperty()) {
const ModelNode framesNode = property.parentModelNode().parentProperty().parentModelNode(); const ModelNode framesNode = property.parentModelNode().parentProperty().parentModelNode();
if (QmlTimelineKeyframeGroup::isValidQmlTimelineKeyframeGroup(framesNode)) if (QmlTimelineKeyframeGroup::isValidQmlTimelineKeyframeGroup(framesNode))
@@ -166,7 +165,7 @@ void CurveEditorView::bindingPropertiesChanged([[maybe_unused]] const QList<Bind
void CurveEditorView::propertiesRemoved([[maybe_unused]] const QList<AbstractProperty> &propertyList) void CurveEditorView::propertiesRemoved([[maybe_unused]] const QList<AbstractProperty> &propertyList)
{ {
for (const auto &property : propertyList) { for (const auto &property : propertyList) {
if (property.name() == "keyframes" && property.parentModelNode().isValid()) { if (property.name() == "keyframes") {
ModelNode parent = property.parentModelNode(); ModelNode parent = property.parentModelNode();
if (dirtyfiesView(parent)) if (dirtyfiesView(parent))
updateKeyframes(); updateKeyframes();
@@ -260,10 +259,7 @@ ModelNode getTargetNode(PropertyTreeItem *item, const QmlTimeline &timeline)
QmlTimelineKeyframeGroup timelineKeyframeGroup(QmlTimeline &timeline, PropertyTreeItem *item) QmlTimelineKeyframeGroup timelineKeyframeGroup(QmlTimeline &timeline, PropertyTreeItem *item)
{ {
ModelNode node = getTargetNode(item, timeline); ModelNode node = getTargetNode(item, timeline);
if (node.isValid()) return timeline.keyframeGroup(node, item->name().toLatin1());
return timeline.keyframeGroup(node, item->name().toLatin1());
return QmlTimelineKeyframeGroup();
} }
void attachEasingCurve(const QmlTimelineKeyframeGroup &group, double frame, const QEasingCurve &curve) void attachEasingCurve(const QmlTimelineKeyframeGroup &group, double frame, const QEasingCurve &curve)
@@ -277,23 +273,21 @@ void attachEasingCurve(const QmlTimelineKeyframeGroup &group, double frame, cons
void commitAuxiliaryData(ModelNode &node, TreeItem *item) void commitAuxiliaryData(ModelNode &node, TreeItem *item)
{ {
if (node.isValid()) { if (item->locked())
if (item->locked()) node.setLocked(true);
node.setLocked(true); else
else node.setLocked(false);
node.setLocked(false);
if (item->pinned()) if (item->pinned())
node.setAuxiliaryData(pinnedProperty, true); node.setAuxiliaryData(pinnedProperty, true);
else else
node.removeAuxiliaryData(pinnedProperty); node.removeAuxiliaryData(pinnedProperty);
if (auto *pitem = item->asPropertyItem()) { if (auto *pitem = item->asPropertyItem()) {
if (pitem->hasUnified()) if (pitem->hasUnified())
node.setAuxiliaryData(unifiedProperty, pitem->unifyString()); node.setAuxiliaryData(unifiedProperty, pitem->unifyString());
else else
node.removeAuxiliaryData(unifiedProperty); node.removeAuxiliaryData(unifiedProperty);
}
} }
} }