Commit 24b91d02 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix resize failure leaving clip at wrong size

parent a438a5c3
Pipeline #4288 passed with stage
in 14 minutes and 6 seconds
......@@ -199,8 +199,8 @@ bool ClipModel::requestResize(int size, bool right, Fun &undo, Fun &redo, bool l
};
if (operation()) {
// Now, we are in the state in which the timeline should be when we try to revert current action. So we can build the reverse action from here
QVector<int> roles{TimelineModel::DurationRole};
if (m_currentTrackId != -1) {
QVector<int> roles{TimelineModel::DurationRole};
if (!right) {
roles.push_back(TimelineModel::StartRole);
roles.push_back(TimelineModel::InPointRole);
......@@ -208,15 +208,16 @@ bool ClipModel::requestResize(int size, bool right, Fun &undo, Fun &redo, bool l
roles.push_back(TimelineModel::OutPointRole);
}
if (auto ptr = m_parent.lock()) {
QModelIndex ix = ptr->makeClipIndexFromID(m_id);
// TODO: integrate in undo
ptr->dataChanged(ix, ix, roles);
track_reverse = ptr->getTrackById(m_currentTrackId)->requestClipResize_lambda(m_id, old_in, old_out, right);
}
}
Fun reverse = [this, old_in, old_out, track_reverse]() {
Fun reverse = [this, old_in, old_out, track_reverse, roles]() {
if (track_reverse()) {
setInOut(old_in, old_out);
if (auto ptr = m_parent.lock()) {
QModelIndex ix = ptr->makeClipIndexFromID(m_id);
ptr->dataChanged(ix, ix, roles);
}
return true;
}
return false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment