[ui] GraphEditor: fix delete data issue with duplicate nodes

This commit is contained in:
Julien-Haudegond 2020-08-12 18:30:26 +02:00
parent de83294446
commit 02b9e34ba4

View file

@ -327,7 +327,19 @@ Item {
MenuSeparator {}
MenuItem {
text: "Delete Data" + (deleteFollowingButton.hovered ? " From Here" : "" ) + "..."
enabled: nodeMenu.currentNode ? !nodeMenu.currentNode.locked : false
enabled: {
if(!nodeMenu.currentNode)
return false
// Check if the current node is locked (needed because it does not belong to its own duplicates list)
if(nodeMenu.currentNode.locked)
return false
// Check if at least one of the duplicate nodes is locked
for(let i = 0; i < nodeMenu.currentNode.duplicates.count; ++i) {
if(nodeMenu.currentNode.duplicates.at(i).locked)
return false
}
return true
}
function showConfirmationDialog(deleteFollowing) {
var obj = deleteDataDialog.createObject(root,
@ -360,7 +372,7 @@ Item {
modal: false
header.visible: false
text: "Delete Data computed by '" + node.label + (deleteFollowing ? "' and following Nodes?" : "'?")
text: "Delete Data of '" + node.label + (deleteFollowing ? "' and following Nodes?" : "'?")
helperText: "Warning: This operation can not be undone."
standardButtons: Dialog.Yes | Dialog.Cancel