Skip to content

Commit ba1ec27

Browse files
committed
1 parent d107e3a commit ba1ec27

File tree

4 files changed

+42
-4
lines changed

4 files changed

+42
-4
lines changed

src/models/multitrackmodel.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,23 @@ void MultitrackModel::setTrackHeight(int height)
618618
Settings.setTimelineTrackHeight(qBound(10, height, 150));
619619
m_tractor->set(kTrackHeightProperty, Settings.timelineTrackHeight());
620620
emit trackHeightChanged();
621+
emit modified();
622+
}
623+
}
624+
625+
int MultitrackModel::trackHeaderWidth() const
626+
{
627+
return (m_tractor && m_tractor->property_exists(kTrackHeaderWidthProperty))
628+
? m_tractor->get_int(kTrackHeaderWidthProperty)
629+
: 140;
630+
}
631+
632+
void MultitrackModel::setTrackHeaderWidth(int width)
633+
{
634+
if (m_tractor) {
635+
m_tractor->set(kTrackHeaderWidthProperty, width);
636+
emit trackHeaderWidthChanged();
637+
emit modified();
621638
}
622639
}
623640

@@ -3517,6 +3534,7 @@ void MultitrackModel::load()
35173534
emit created();
35183535
emit filteredChanged();
35193536
emit scaleFactorChanged();
3537+
emit trackHeaderWidthChanged();
35203538
}
35213539

35223540
void MultitrackModel::reload(bool asynchronous)
@@ -3620,6 +3638,7 @@ void MultitrackModel::close()
36203638
endResetModel();
36213639
emit closed();
36223640
emit filteredChanged();
3641+
emit trackHeaderWidthChanged();
36233642
}
36243643

36253644
int MultitrackModel::clipIndex(int trackIndex, int position)

src/models/multitrackmodel.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013-2024 Meltytech, LLC
2+
* Copyright (c) 2013-2025 Meltytech, LLC
33
*
44
* This program is free software: you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -47,6 +47,8 @@ class MultitrackModel : public QAbstractItemModel
4747
{
4848
Q_OBJECT
4949
Q_PROPERTY(int trackHeight READ trackHeight WRITE setTrackHeight NOTIFY trackHeightChanged)
50+
Q_PROPERTY(int trackHeaderWidth READ trackHeaderWidth WRITE setTrackHeaderWidth NOTIFY
51+
trackHeaderWidthChanged FINAL)
5052
Q_PROPERTY(double scaleFactor READ scaleFactor WRITE setScaleFactor NOTIFY scaleFactorChanged)
5153
Q_PROPERTY(bool filtered READ isFiltered NOTIFY filteredChanged)
5254

@@ -109,6 +111,8 @@ class MultitrackModel : public QAbstractItemModel
109111
bool trimClipOutValid(int trackIndex, int clipIndex, int delta, bool ripple);
110112
int trackHeight() const;
111113
void setTrackHeight(int height);
114+
int trackHeaderWidth() const;
115+
void setTrackHeaderWidth(int width);
112116
double scaleFactor() const;
113117
void setScaleFactor(double scale);
114118
bool isTransition(Mlt::Playlist &playlist, int clipIndex) const;
@@ -132,6 +136,7 @@ class MultitrackModel : public QAbstractItemModel
132136
void modified();
133137
void seeked(int position, bool seekPlayer = true);
134138
void trackHeightChanged();
139+
void trackHeaderWidthChanged();
135140
void scaleFactorChanged();
136141
void showStatusMessage(QString);
137142
void durationChanged();

src/qml/views/timeline/timeline.qml

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013-2024 Meltytech, LLC
2+
* Copyright (c) 2013-2025 Meltytech, LLC
33
*
44
* This program is free software: you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ import "Timeline.js" as Logic
2727
Rectangle {
2828
id: root
2929

30-
property int headerWidth: 140
30+
property int headerWidth: multitrack.trackHeaderWidth
3131
property color selectedTrackColor: Qt.rgba(0.8, 0.8, 0, 0.3)
3232
property alias trackCount: tracksRepeater.count
3333
property bool stopScrolling: false
@@ -380,6 +380,19 @@ Rectangle {
380380
anchors.top: parent.top
381381
anchors.topMargin: -rulerFlickable.height
382382
anchors.bottom: parent.bottom
383+
384+
MouseArea {
385+
anchors.fill: parent
386+
anchors.leftMargin: -5
387+
anchors.rightMargin: -5
388+
acceptedButtons: Qt.LeftButton
389+
drag.target: parent
390+
drag.axis: Drag.XAxis
391+
drag.minimumX: 140
392+
drag.maximumX: 500
393+
cursorShape: Qt.SizeHorCursor
394+
onPositionChanged: multitrack.trackHeaderWidth = Math.max(drag.minimumX, Math.min(drag.maximumX, parent.x))
395+
}
383396
}
384397
}
385398
}

src/shotcut_mlt_properties.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013-2024 Meltytech, LLC
2+
* Copyright (c) 2013-2025 Meltytech, LLC
33
*
44
* This program is free software: you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -38,6 +38,7 @@
3838
#define kShotcutVirtualClip "shotcut:virtual"
3939
#define kTimelineScaleProperty "shotcut:scaleFactor"
4040
#define kTrackHeightProperty "shotcut:trackHeight"
41+
#define kTrackHeaderWidthProperty "shotcut:trackHeaderWidth"
4142
#define kTrackNameProperty "shotcut:name"
4243
#define kTrackLockProperty "shotcut:lock"
4344
#define kVideoTrackProperty "shotcut:video"

0 commit comments

Comments
 (0)