forked from qt-creator/qt-creator
QmlDesigner: Fix adding keyframe
Keyframes were always added on the selected model node instead of the modelnode belonging to the property. Task-number: QDS-12622 Change-Id: Iae44cfecd862d79b14c062854d5f329da595f729 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
@@ -103,7 +103,7 @@ Item {
|
||||
StudioControls.MenuItem {
|
||||
text: qsTr("Insert Keyframe")
|
||||
enabled: hasActiveTimeline
|
||||
onTriggered: insertKeyframe(backendValue.name)
|
||||
onTriggered: backendValue.insertKeyframe()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -548,6 +548,23 @@ void PropertyEditorValue::setForceBound(bool b)
|
||||
emit isBoundChanged();
|
||||
}
|
||||
|
||||
void PropertyEditorValue::insertKeyframe()
|
||||
{
|
||||
if (!m_modelNode.isValid())
|
||||
return;
|
||||
|
||||
/*If we add more code here we have to forward the property editor view */
|
||||
AbstractView *view = m_modelNode.view();
|
||||
|
||||
QmlTimeline timeline = view->currentTimeline();
|
||||
|
||||
QTC_ASSERT(timeline.isValid(), return );
|
||||
QTC_ASSERT(m_modelNode.isValid(), return );
|
||||
|
||||
view->executeInTransaction("PropertyEditorContextObject::insertKeyframe",
|
||||
[&] { timeline.insertKeyframe(m_modelNode, name()); });
|
||||
}
|
||||
|
||||
QStringList PropertyEditorValue::generateStringList(const QString &string) const
|
||||
{
|
||||
QString copy = string;
|
||||
|
@@ -172,6 +172,8 @@ public:
|
||||
|
||||
Q_INVOKABLE void setForceBound(bool b);
|
||||
|
||||
Q_INVOKABLE void insertKeyframe();
|
||||
|
||||
public slots:
|
||||
void resetValue();
|
||||
void setEnumeration(const QString &scope, const QString &name);
|
||||
|
Reference in New Issue
Block a user