Commit 816c9379 authored by Julius Künzel's avatar Julius Künzel
Browse files

Track name edit: fix focus issue, enable F2 shortcut

BUG: 440185
FIXED-IN: 21.12.0
parent 21cd9499
......@@ -58,6 +58,16 @@ function getTrackIndexFromId(id) {
return i
}
function getTrackHeaderById(id) {
var i = 0;
for (; i < trackHeaderRepeater.count; i++) {
if (trackHeaderRepeater.itemAt(i).trackId === id) {
return trackHeaderRepeater.itemAt(i);
}
}
return 0
}
function getTrackById(id) {
var i = 0;
for (; i < tracksRepeater.count; i++) {
......
......@@ -27,6 +27,12 @@ Rectangle {
border.width: 1
border.color: root.frameColor
function editName() {
nameEdit.visible = true
nameEdit.focus = true
nameEdit.selectAll()
}
onIsLockedChanged: {
flashLock.restart();
}
......@@ -521,11 +527,7 @@ Rectangle {
hoverEnabled: true
propagateComposedEvents: true
cursorShape: Qt.IBeamCursor
onDoubleClicked: {
nameEdit.visible = true
nameEdit.focus = true
nameEdit.selectAll()
}
onDoubleClicked: editName()
onClicked: {
timeline.showTrackAsset(trackId)
timeline.activeTrack = trackId
......@@ -573,6 +575,7 @@ Rectangle {
}*/
onEditingFinished: {
controller.setTrackName(trackId, text)
tracksArea.focus = true
visible = false
}
}
......
......@@ -359,6 +359,13 @@ Rectangle {
Keys.onUpPressed: {
root.moveSelectedTrack(-1)
}
Keys.onShortcutOverride: event.accepted = focus && event.key === Qt.Key_F2
Keys.onPressed: {
if (event.key == Qt.Key_F2) {
Logic.getTrackHeaderById(timeline.activeTrack).editName()
event.accepted = true;
}
}
property int activeTool: ProjectTool.SelectTool
property real baseUnit: Math.max(12, fontMetrics.font.pixelSize)
......
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