@@ -113,9 +113,14 @@ Item {
113113 }
114114 } else if (event .key === Qt .Key_D ) {
115115 duplicateNode (event .modifiers === Qt .AltModifier )
116- } else if (event .key === Qt .Key_X && event .modifiers === Qt .ControlModifier ) {
117- copyNodes ()
118- uigraph .removeSelectedNodes ()
116+ } else if (event .key === Qt .Key_X ) {
117+ if (event .modifiers === Qt .ControlModifier ) {
118+ copyNodes ()
119+ uigraph .removeSelectedNodes ()
120+ }
121+ else {
122+ uigraph .disconnectSelectedNodes ()
123+ }
119124 } else if (event .key === Qt .Key_C ) {
120125 if (event .modifiers === Qt .ControlModifier ) {
121126 copyNodes ()
@@ -138,6 +143,7 @@ Item {
138143 id: mouseArea
139144 anchors .fill : parent
140145 property double factor: 1.15
146+ property bool removingEdges: false ;
141147 // Activate multisampling for edges antialiasing
142148 layer .enabled : true
143149 layer .samples : 8
@@ -146,7 +152,7 @@ Item {
146152 acceptedButtons: Qt .LeftButton | Qt .RightButton | Qt .MiddleButton
147153 drag .threshold : 0
148154 drag .smoothed : false
149- cursorShape: drag .target == draggable ? Qt .ClosedHandCursor : Qt .ArrowCursor
155+ cursorShape: drag .target == draggable ? Qt .ClosedHandCursor : removingEdges ? Qt . CrossCursor : Qt .ArrowCursor
150156
151157 onWheel : function (wheel ) {
152158 var zoomFactor = wheel .angleDelta .y > 0 ? factor : 1 / factor
@@ -171,9 +177,15 @@ Item {
171177 if (mouse .button == Qt .MiddleButton || (mouse .button == Qt .LeftButton && mouse .modifiers & Qt .AltModifier )) {
172178 drag .target = draggable // start drag
173179 }
180+ if (mouse .button == Qt .LeftButton && (mouse .modifiers & Qt .ControlModifier ) && (mouse .modifiers & Qt .AltModifier )) {
181+ edgeSelectionLine .startSelection (mouse);
182+ removingEdges = true ;
183+ }
174184 }
175185
176186 onReleased: {
187+ removingEdges = false ;
188+ edgeSelectionLine .endSelection ()
177189 nodeSelectionBox .endSelection ();
178190 drag .target = null ;
179191 root .forceActiveFocus ()
@@ -497,7 +509,7 @@ Item {
497509 if (event .button ) {
498510 if (canEdit && (event .modifiers & Qt .AltModifier )) {
499511 uigraph .removeEdge (edge)
500- } else {
512+ } else if ( event . button == Qt . RightButton ) {
501513 edgeMenu .currentEdge = edge
502514 edgeMenu .forLoop = forLoop
503515 var spawnPosition = mouseArea .mapToItem (draggable, mouseArea .mouseX , mouseArea .mouseY )
@@ -726,6 +738,13 @@ Item {
726738 pasteNodes ()
727739 }
728740 }
741+ MenuItem {
742+ text: " Disconnect Node(s)" ;
743+ enabled: true ;
744+ ToolTip .text : " Disconnect all edges from the selected Node(s)" ;
745+ ToolTip .visible : hovered;
746+ onTriggered: uigraph .disconnectSelectedNodes ();
747+ }
729748 MenuItem {
730749 text: " Duplicate Node(s)" + (duplicateFollowingButton .hovered ? " From Here" : " " )
731750 enabled: true
@@ -858,6 +877,10 @@ Item {
858877 onAttributePinCreated : function (attribute , pin ) { registerAttributePin (attribute, pin) }
859878 onAttributePinDeleted : function (attribute , pin ) { unregisterAttributePin (attribute, pin) }
860879
880+ onShaked: {
881+ uigraph .disconnectSelectedNodes ();
882+ }
883+
861884 onPressed : function (mouse ) {
862885 nodeRepeater .updateSelectionOnClick = true ;
863886 nodeRepeater .ongoingDrag = true ;
@@ -953,6 +976,10 @@ Item {
953976 if (! selected || ! dragging) {
954977 return ;
955978 }
979+
980+ // Check for shake on the node
981+ checkForShake ();
982+
956983 // Compute offset between the delegate and the stored node position.
957984 const offset = Qt .point (x - node .x , y - node .y );
958985
@@ -999,6 +1026,16 @@ Item {
9991026 }
10001027 }
10011028
1029+ DelegateSelectionLine {
1030+ id: edgeSelectionLine
1031+ mouseArea: mouseArea
1032+ modelInstantiator: edgesRepeater
1033+ container: draggable
1034+ onDelegateSelectionEnded : function (selectedIndices , modifiers ) {
1035+ uigraph .deleteEdgesByIndices (selectedIndices);
1036+ }
1037+ }
1038+
10021039 DropArea {
10031040 id: dropArea
10041041 anchors .fill : parent
0 commit comments