Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Make timeline context menu appear on mouse press, not after a click

parent 788397c5
......@@ -243,7 +243,18 @@ Rectangle {
if (!clipRoot.selected) {
clipRoot.clicked(clipRoot, mouse.modifiers == Qt.ShiftModifier)
}
drag.target = clipRoot
if (mouse.button == Qt.LeftButton) {
drag.target = clipRoot
} else if (mouse.button == Qt.RightButton) {
drag.target = undefined
clipMenu.clipId = clipRoot.clipId
clipMenu.clipStatus = clipRoot.clipStatus
clipMenu.grouped = clipRoot.grouped
clipMenu.trackId = clipRoot.trackId
clipMenu.canBeAudio = clipRoot.canBeAudio
clipMenu.canBeVideo = clipRoot.canBeVideo
clipMenu.popup()
}
}
onPositionChanged: {
if (pressed && mouse.buttons === Qt.LeftButton) {
......@@ -258,30 +269,21 @@ Rectangle {
}
onReleased: {
root.stopScrolling = false
var delta = clipRoot.x - startX
drag.target = undefined
cursorShape = Qt.OpenHandCursor
if (trackId !== originalTrackId) {
var track = Logic.getTrackById(trackId)
parent.moved(clipRoot)
reparent(track)
originalX = clipRoot.x
clipRoot.y = 0
originalTrackId = trackId
} else if (delta != 0) {
parent.dropped(clipRoot)
originalX = clipRoot.x
}
}
onClicked: {
if (mouse.button == Qt.RightButton) {
clipMenu.clipId = clipRoot.clipId
clipMenu.clipStatus = clipRoot.clipStatus
clipMenu.grouped = clipRoot.grouped
clipMenu.trackId = clipRoot.trackId
clipMenu.canBeAudio = clipRoot.canBeAudio
clipMenu.canBeVideo = clipRoot.canBeVideo
clipMenu.popup()
if (mouse.button == Qt.LeftButton) {
var delta = clipRoot.x - startX
drag.target = undefined
cursorShape = Qt.OpenHandCursor
if (trackId !== originalTrackId) {
var track = Logic.getTrackById(trackId)
parent.moved(clipRoot)
reparent(track)
originalX = clipRoot.x
clipRoot.y = 0
originalTrackId = trackId
} else if (delta != 0) {
parent.dropped(clipRoot)
originalX = clipRoot.x
}
}
}
onDoubleClicked: {
......
import QtQuick 2.6
import QtQuick.Controls 1.4 as OLD
import QtQuick.Controls 2.2
import com.enums 1.0
OLD.Menu {
Menu {
id: clipMenu
property int clipId
property int clipStatus
......@@ -10,72 +10,68 @@ OLD.Menu {
property bool grouped
property bool canBeAudio
property bool canBeVideo
function show() {
//mergeItem.visible = timeline.mergeClipWithNext(trackIndex, index, true)
menu.popup()
}
OLD.MenuItem {
MenuItem {
visible: true
text: i18n('Copy')
onTriggered: root.copiedClip = clipId
}
OLD.MenuItem {
MenuItem {
visible: !grouped && timeline.selection.length > 1
text: i18n('Group')
onTriggered: timeline.triggerAction('group_clip')
}
OLD.MenuItem {
MenuItem {
visible: grouped
text: i18n('Ungroup')
onTriggered: timeline.unGroupSelection(clipId)
}
OLD.MenuItem {
MenuItem {
visible: root.copiedClip != -1 && root.copiedClip != clipId
text: i18n('Paste Effects')
onTriggered: timeline.pasteEffects(clipId, root.copiedClip)
}
OLD.MenuSeparator {
MenuSeparator {
visible: true
}
OLD.MenuItem {
MenuItem {
text: i18n('Split Audio')
onTriggered: timeline.splitAudio(clipId)
visible: !grouped && canBeAudio && clipStatus == ClipState.VideoOnly
}
OLD.MenuItem {
MenuItem {
text: i18n('Split Video')
onTriggered: timeline.splitVideo(clipId)
visible: !grouped && canBeVideo && clipStatus == ClipState.AudioOnly
}
OLD.MenuItem {
MenuItem {
text: i18n('Remove')
onTriggered: timeline.triggerAction('delete_timeline_clip')
}
OLD.MenuItem {
MenuItem {
visible: true
text: i18n('Extract')
onTriggered: timeline.extract(clipId)
}
OLD.MenuSeparator {
MenuSeparator {
visible: true
}
OLD.MenuItem {
MenuItem {
visible: true
text: i18n('Change Speed')
onTriggered: timeline.changeItemSpeed(clipId, -1)
}
OLD.MenuItem {
MenuItem {
text: i18n('Clip in Project Bin')
onTriggered: timeline.triggerAction('clip_in_project_tree')
}
OLD.MenuItem {
MenuItem {
visible: true
text: i18n('Split At Playhead')
onTriggered: timeline.triggerAction('cut_timeline_clip')
}
OLD.MenuItem {
MenuItem {
visible: true
text: clipStatus != ClipState.Disabled ? i18n('Disable clip') : i18n('Enable clip')
onTriggered: timeline.switchEnableState(clipId)
......
......@@ -214,7 +214,6 @@ Item {
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
propagateComposedEvents: true
cursorShape: (trimInMouseArea.drag.active || trimOutMouseArea.drag.active)? Qt.SizeHorCursor :
drag.active? Qt.ClosedHandCursor : Qt.OpenHandCursor
onPressed: {
......@@ -223,12 +222,12 @@ Item {
if (!compositionRoot.selected) {
compositionRoot.clicked(compositionRoot, false)
}
}
onClicked: {
compositionMenu.clipId = compositionRoot.clipId
compositionMenu.grouped = compositionRoot.grouped
compositionMenu.trackId = compositionRoot.trackId
compositionMenu.popup()
if (mouse.button == Qt.RightButton) {
compositionMenu.clipId = compositionRoot.clipId
compositionMenu.grouped = compositionRoot.grouped
compositionMenu.trackId = compositionRoot.trackId
compositionMenu.popup()
}
}
}
}
......
import QtQuick 2.6
import QtQuick.Controls 1.4
import QtQuick.Controls 2.2
Menu {
id: compositionMenu
......
......@@ -87,16 +87,18 @@ Rectangle {
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
onPressed: {
parent.clicked()
if (mouse.button == Qt.RightButton) {
headerMenu.popup()
}
}
onClicked: {
parent.forceActiveFocus()
nameEdit.visible = false
if (mouse.button == Qt.LeftButton) {
timeline.showTrackAsset(trackId)
}
else if (mouse.button == Qt.RightButton) {
headerMenu.popup()
}
}
}
ColumnLayout {
......
......@@ -621,10 +621,7 @@ Rectangle {
var y = mouse.y - ruler.height
timeline.cutClipUnderCursor((scrollView.flickableItem.contentX + mouse.x) / timeline.scaleFactor, tracksRepeater.itemAt(Logic.getTrackIndexFromPos(y)).trackId)
}
}
}
onClicked: {
if (mouse.button & Qt.RightButton) {
} else if (mouse.button & Qt.RightButton) {
menu.clickedX = mouse.x
menu.clickedY = mouse.y
if (mouse.y > ruler.height) {
......
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