Update the curveeditor when changing keyframes in the text editor

Fixes: QDS-10062
Change-Id: Ie0364d095f17ba6b5f16bd8fbf9abddfca2f26db
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Knud Dollereder
2023-06-27 16:35:57 +02:00
parent 3d5ceb795d
commit db78fa9cf8

View File

@@ -68,7 +68,8 @@ void CurveEditorView::modelAboutToBeDetached(Model *model)
bool dirtyfiesView(const ModelNode &node) bool dirtyfiesView(const ModelNode &node)
{ {
return QmlTimeline::isValidQmlTimeline(node) return (node.type() == "QtQuick.Timeline.Keyframe" && node.hasParentProperty())
|| QmlTimeline::isValidQmlTimeline(node)
|| QmlTimelineKeyframeGroup::isValidQmlTimelineKeyframeGroup(node); || QmlTimelineKeyframeGroup::isValidQmlTimelineKeyframeGroup(node);
} }
@@ -143,36 +144,27 @@ void CurveEditorView::variantPropertiesChanged([[maybe_unused]] const QList<Vari
[[maybe_unused]] PropertyChangeFlags propertyChange) [[maybe_unused]] PropertyChangeFlags propertyChange)
{ {
for (const auto &property : propertyList) { for (const auto &property : propertyList) {
if ((property.name() == "frame" || property.name() == "value") if (dirtyfiesView(property.parentModelNode()))
&& property.parentModelNode().type() == "QtQuick.Timeline.Keyframe"
&& property.parentModelNode().hasParentProperty()) {
const ModelNode framesNode = property.parentModelNode().parentProperty().parentModelNode();
if (QmlTimelineKeyframeGroup::isValidQmlTimelineKeyframeGroup(framesNode))
updateKeyframes(); updateKeyframes();
} }
} }
}
void CurveEditorView::bindingPropertiesChanged([[maybe_unused]] const QList<BindingProperty> &propertyList, void CurveEditorView::bindingPropertiesChanged([[maybe_unused]] const QList<BindingProperty> &propertyList,
[[maybe_unused]] PropertyChangeFlags propertyChange) [[maybe_unused]] PropertyChangeFlags propertyChange)
{ {
for (const auto &property : propertyList) { for (const auto &property : propertyList) {
if (property.name() == "easing.bezierCurve") { if (dirtyfiesView(property.parentModelNode()))
updateKeyframes(); updateKeyframes();
} }
} }
}
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") { if (dirtyfiesView(property.parentModelNode()))
ModelNode parent = property.parentModelNode();
if (dirtyfiesView(parent))
updateKeyframes(); updateKeyframes();
} }
} }
}
QmlTimeline CurveEditorView::activeTimeline() const QmlTimeline CurveEditorView::activeTimeline() const
{ {