Fix broken timeline header position in some cases

parent 2e0fbcd8
Pipeline #15745 passed with stage
in 16 minutes and 16 seconds
...@@ -38,10 +38,8 @@ Rectangle { ...@@ -38,10 +38,8 @@ Rectangle {
property int iconSize: buttonSize - 4 property int iconSize: buttonSize - 4
property string trackTag property string trackTag
property int thumbsFormat: 0 property int thumbsFormat: 0
property int collapsedHeight: buttonSize
border.width: 1 border.width: 1
border.color: root.frameColor border.color: root.frameColor
signal clicked()
function pulseLockButton() { function pulseLockButton() {
flashLock.restart(); flashLock.restart();
...@@ -82,7 +80,7 @@ Rectangle { ...@@ -82,7 +80,7 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressed: { onPressed: {
parent.clicked() timeline.activeTrack = trackId
if (mouse.button == Qt.RightButton) { if (mouse.button == Qt.RightButton) {
root.showHeaderMenu() root.showHeaderMenu()
} }
...@@ -197,7 +195,7 @@ Rectangle { ...@@ -197,7 +195,7 @@ Rectangle {
//icon.height: trackHeadRoot.iconSize //icon.height: trackHeadRoot.iconSize
icon.name: trackHeadRoot.collapsed ? 'arrow-right' : 'arrow-down' icon.name: trackHeadRoot.collapsed ? 'arrow-right' : 'arrow-down'
onClicked: { onClicked: {
trackHeadRoot.myTrackHeight = trackHeadRoot.collapsed ? Math.max(collapsedHeight * 1.5, controller.getTrackProperty(trackId, "kdenlive:trackheight")) : collapsedHeight trackHeadRoot.myTrackHeight = trackHeadRoot.collapsed ? Math.max(root.collapsedHeight * 1.5, controller.getTrackProperty(trackId, "kdenlive:trackheight")) : root.collapsedHeight
} }
ToolTip { ToolTip {
visible: expandButton.hovered visible: expandButton.hovered
...@@ -419,7 +417,7 @@ Rectangle { ...@@ -419,7 +417,7 @@ Rectangle {
} }
onClicked: { onClicked: {
timeline.showTrackAsset(trackId) timeline.showTrackAsset(trackId)
trackHeadRoot.clicked() timeline.activeTrack = trackId
trackHeadRoot.focus = true trackHeadRoot.focus = true
} }
onEntered: { onEntered: {
...@@ -497,7 +495,7 @@ Rectangle { ...@@ -497,7 +495,7 @@ Rectangle {
cursorShape: Qt.SizeVerCursor cursorShape: Qt.SizeVerCursor
drag.target: parent drag.target: parent
drag.axis: Drag.YAxis drag.axis: Drag.YAxis
drag.minimumY: trackHeadRoot.collapsedHeight - resizer.height drag.minimumY: root.collapsedHeight - resizer.height
property double startY property double startY
property double originalY property double originalY
drag.smoothed: false drag.smoothed: false
...@@ -522,7 +520,7 @@ Rectangle { ...@@ -522,7 +520,7 @@ Rectangle {
if (mouse.buttons === Qt.LeftButton) { if (mouse.buttons === Qt.LeftButton) {
parent.opacity = 0.5 parent.opacity = 0.5
var newHeight = originalY + (mapToItem(null, x, y).y - startY) var newHeight = originalY + (mapToItem(null, x, y).y - startY)
newHeight = Math.max(trackHeadRoot.collapsedHeight, newHeight) newHeight = Math.max(root.collapsedHeight, newHeight)
trackHeadRoot.myTrackHeight = newHeight trackHeadRoot.myTrackHeight = newHeight
} }
} }
......
...@@ -265,6 +265,7 @@ Rectangle { ...@@ -265,6 +265,7 @@ Rectangle {
property int scrollMin: scrollView.contentX / timeline.scaleFactor property int scrollMin: scrollView.contentX / timeline.scaleFactor
property int scrollMax: scrollMin + scrollView.contentItem.width / timeline.scaleFactor property int scrollMax: scrollMin + scrollView.contentItem.width / timeline.scaleFactor
property double dar: 16/9 property double dar: 16/9
property int collapsedHeight: baseUnit * 1.8
onSeekingFinishedChanged : { onSeekingFinishedChanged : {
playhead.opacity = seekingFinished ? 1 : 0.5 playhead.opacity = seekingFinished ? 1 : 0.5
...@@ -296,7 +297,10 @@ Rectangle { ...@@ -296,7 +297,10 @@ Rectangle {
if (tk.y < scrollView.contentY) { if (tk.y < scrollView.contentY) {
scrollView.contentY = Math.max(0, tk.y - scrollView.height / 3) scrollView.contentY = Math.max(0, tk.y - scrollView.height / 3)
} else if (tk.y + tk.height > scrollView.contentY + scrollView.contentItem.height) { } else if (tk.y + tk.height > scrollView.contentY + scrollView.contentItem.height) {
scrollView.contentY = Math.min(trackHeaders.height - scrollView.height + scrollView.ScrollBar.horizontal.height, tk.y - scrollView.height / 3) var newY = Math.min(trackHeaders.height - scrollView.height + scrollView.ScrollBar.horizontal.height, tk.y - scrollView.height / 3)
if (newY >= 0) {
scrollView.contentY = newY
}
} }
} }
...@@ -668,10 +672,6 @@ Rectangle { ...@@ -668,10 +672,6 @@ Rectangle {
// hack: change property to trigger transition adjustment // hack: change property to trigger transition adjustment
root.trackHeight = root.trackHeight === 1 ? 0 : 1 root.trackHeight = root.trackHeight === 1 ? 0 : 1
} }
onClicked: {
timeline.activeTrack = tracksRepeater.itemAt(index).trackInternalId
console.log('track name: ',index, ' = ', model.name,'/',tracksRepeater.itemAt(index).trackInternalId)
}
} }
} }
} }
...@@ -1165,7 +1165,7 @@ Rectangle { ...@@ -1165,7 +1165,7 @@ Rectangle {
width: tracksContainerArea.width width: tracksContainerArea.width
border.width: 1 border.width: 1
border.color: root.frameColor border.color: root.frameColor
height: Math.max(root.baseUnit * 2, model.trackHeight) height: Math.max(collapsedHeight, model.trackHeight)
color: tracksRepeater.itemAt(index) ? ((tracksRepeater.itemAt(index).trackInternalId === timeline.activeTrack) ? Qt.tint(getTrackColor(tracksRepeater.itemAt(index).isAudio, false), selectedTrackColor) : getTrackColor(tracksRepeater.itemAt(index).isAudio, false)) : 'red' color: tracksRepeater.itemAt(index) ? ((tracksRepeater.itemAt(index).trackInternalId === timeline.activeTrack) ? Qt.tint(getTrackColor(tracksRepeater.itemAt(index).isAudio, false), selectedTrackColor) : getTrackColor(tracksRepeater.itemAt(index).isAudio, false)) : 'red'
} }
} }
......
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