Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
0f2968db
Commit
0f2968db
authored
Oct 04, 2020
by
Jean-Baptiste Mardelle
Browse files
Fix track order in mixed track view
parent
25e5eb29
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinemodel.cpp
View file @
0f2968db
...
...
@@ -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
trackPos
;
}
return
isAudio
?
2
*
trackPos
:
2
*
(
vCount
+
1
-
trackPos
)
+
1
;
return
2
*
(
vCount
+
1
-
trackPos
)
+
1
;
}
QList
<
int
>
TimelineModel
::
getLowerTracksId
(
int
trackId
,
TrackType
type
)
const
...
...
@@ -2479,15 +2481,19 @@ bool TimelineModel::requestTrackInsertion(int position, int &id, const QString &
};
Fun
local_name_update
=
[
position
,
audioTrack
,
this
]()
{
if
(
audioTrack
)
{
for
(
int
i
=
0
;
i
<=
position
;
i
++
)
{
QModelIndex
ix
=
makeTrackIndexFromID
(
getTrackIndexFromPosition
(
i
));
emit
dataChanged
(
ix
,
ix
,
{
TimelineModel
::
TrackTagRole
});
}
if
(
KdenliveSettings
::
audiotracksbelow
()
==
0
)
{
_resetView
();
}
else
{
for
(
int
i
=
position
;
i
<
(
int
)
m_allTracks
.
size
();
i
++
)
{
QModelIndex
ix
=
makeTrackIndexFromID
(
getTrackIndexFromPosition
(
i
));
emit
dataChanged
(
ix
,
ix
,
{
TimelineModel
::
TrackTagRole
});
if
(
audioTrack
)
{
for
(
int
i
=
0
;
i
<=
position
;
i
++
)
{
QModelIndex
ix
=
makeTrackIndexFromID
(
getTrackIndexFromPosition
(
i
));
emit
dataChanged
(
ix
,
ix
,
{
TimelineModel
::
TrackTagRole
});
}
}
else
{
for
(
int
i
=
position
;
i
<
(
int
)
m_allTracks
.
size
();
i
++
)
{
QModelIndex
ix
=
makeTrackIndexFromID
(
getTrackIndexFromPosition
(
i
));
emit
dataChanged
(
ix
,
ix
,
{
TimelineModel
::
TrackTagRole
});
}
}
}
return
true
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment