Commit 0f2968db authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix track order in mixed track view

parent 25e5eb29
......@@ -409,14 +409,16 @@ int TimelineModel::getTrackSortValue(int trackId, int separated) const
trackPos = audioTrack ? aCount : vCount;
}
}
int trackDiff = qMax(0, aCount - vCount);
if (trackDiff > 0) {
// more audio tracks, keep them below
if (isAudio && trackPos > vCount) {
return -trackPos;
if (isAudio) {
if (aCount > vCount && (trackPos - 1 > aCount - vCount)) {
return (aCount - vCount + 1) + 2 * (trackPos - (aCount - vCount +1));
}
if (aCount == vCount) {
return 2 * trackPos;
}
return isAudio ? 2 * trackPos : 2 * (vCount + 1 - trackPos) + 1;
return trackPos;
}
return 2 * (vCount + 1 - trackPos) + 1;
}
QList<int> TimelineModel::getLowerTracksId(int trackId, TrackType type) const
......@@ -2479,6 +2481,9 @@ bool TimelineModel::requestTrackInsertion(int position, int &id, const QString &
};
Fun local_name_update = [position, audioTrack, this]() {
if (KdenliveSettings::audiotracksbelow() == 0) {
_resetView();
} else {
if (audioTrack) {
for (int i = 0; i <= position; i++) {
QModelIndex ix = makeTrackIndexFromID(getTrackIndexFromPosition(i));
......@@ -2490,6 +2495,7 @@ bool TimelineModel::requestTrackInsertion(int position, int &id, const QString &
emit dataChanged(ix, ix, {TimelineModel::TrackTagRole});
}
}
}
return true;
};
......
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