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

Ensure all track tags have the same width if more than 10 tracks.

Fixes !173
parent 4c0f1d9a
Pipeline #49005 passed with stage
in 10 minutes and 56 seconds
......@@ -101,7 +101,7 @@ Rectangle {
background: Rectangle {
color: trackTarget.bgColor
}
width: 2 * root.trackTagWidth
width: 1.5 * root.baseUnit
height: trackHeadRoot.height
verticalAlignment: Text.AlignTop
horizontalAlignment: Text.AlignHCenter
......@@ -301,7 +301,7 @@ Rectangle {
background: Rectangle {
color: trackLed.bgColor
}
width: root.trackTagWidth * trackHeadRoot.trackTag.length
width: root.trackTagWidth
height: root.collapsedHeight - 2
y: 1
verticalAlignment: Text.AlignVCenter
......
......@@ -361,7 +361,7 @@ Rectangle {
property bool showSubtitles: false
property bool subtitlesLocked: timeline.subtitlesLocked
property bool subtitlesDisabled: timeline.subtitlesDisabled
property int trackTagWidth: fontMetrics.boundingRect("M").width
property int trackTagWidth: fontMetrics.boundingRect("M").width * (trackHeaderRepeater.count < 10 ? 2 : 3)
property bool scrollVertically: timeline.scrollVertically
onSeekingFinishedChanged : {
......@@ -782,7 +782,7 @@ Rectangle {
focusPolicy: Qt.NoFocus
property var modifier: 0
anchors.left: parent.left
anchors.leftMargin: 2 * root.trackTagWidth
anchors.leftMargin: 1.5 * root.baseUnit
width: root.collapsedHeight
height: root.collapsedHeight
contentItem: Item {
......
  • mentioned in issue #696 (closed)

    Toggle commit list
  • As @vivekkde noticed

    it is counting both audio and video track. Like if their are 2 audio tracks and 8 video tracks it will increase the size as total count is 10.

    Something like this solves it:

        function getAudioTracksCount(){
            var audioCount = 0;
            for (var i = 0; i < trackHeaderRepeater.count; i++) {
                if(trackHeaderRepeater.itemAt(i).isAudio) {
                    audioCount++;
                }
            }
            return audioCount;
        }
    property int trackTagWidth: fontMetrics.boundingRect("M").width * ((getAudioTracksCount() > 9) || (trackHeaderRepeater.count - getAudioTracksCount() > 9)  ? 3 : 2)
    
  • @jlskuz yes, as soon as there are more than 10 tracks are added the label gets enlarged.

    I think the correct term should be:
    if there are more than 10 videoTracks
    or more than 10 audioTracks
    then the label should be enlarged

    Edited by Eugen Mohr
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