Commit d54a0fef authored by luyikei's avatar luyikei

Implement MarkerContextMenu

parent ed4b2265
...@@ -34,6 +34,18 @@ Rectangle { ...@@ -34,6 +34,18 @@ Rectangle {
drag.target: marker drag.target: marker
drag.axis: Drag.XAxis drag.axis: Drag.XAxis
drag.minimumX: 0 drag.minimumX: 0
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
if ( mouse.button & Qt.RightButton ) {
markerContextMenu.popup();
}
}
}
MarkerContextMenu {
id: markerContextMenu
marker: marker
} }
} }
} }
......
import QtQuick 2.0
import QtQuick.Controls 1.4
import QtQuick.Dialogs 1.2
Menu {
id: markerContextMenu
title: "Edit"
property var marker
MenuItem {
text: "Delete"
onTriggered: {
removeMarkerDialog.visible = true;
}
}
MessageDialog {
id: removeMarkerDialog
title: "VLMC"
text: qsTr( "Do you really want to remove the marker?" )
icon: StandardIcon.Question
standardButtons: StandardButton.Yes | StandardButton.No
onYes: {
removeMarker( marker.position );
}
}
}
...@@ -203,6 +203,24 @@ Rectangle { ...@@ -203,6 +203,24 @@ Rectangle {
} ); } );
} }
function findMarker( pos ) {
for ( var i = 0; i < markers.count; ++i ) {
if ( markers.get( i )["position"] === pos ) {
return markers.get( i );
}
}
return null;
}
function removeMarker( pos ) {
for ( var i = 0; i < markers.count; ++i ) {
if ( markers.get( i )["position"] === pos ) {
markers.remove( i );
return;
}
}
}
function addGroup( clips ) { function addGroup( clips ) {
groups.push( clips ); groups.push( clips );
} }
......
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
<file>Clip.qml</file> <file>Clip.qml</file>
<file>ClipContextMenu.qml</file> <file>ClipContextMenu.qml</file>
<file>PropertyButton.qml</file> <file>PropertyButton.qml</file>
<file>MarkerContextMenu.qml</file>
</qresource> </qresource>
</RCC> </RCC>
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