File tree Expand file tree Collapse file tree 3 files changed +17
-8
lines changed Expand file tree Collapse file tree 3 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -759,24 +759,22 @@ def canExpandForLoop(self, currentEdge):
759759 return False
760760 return True
761761
762- @Slot (Edge )
762+ @Slot (Edge , result = Edge )
763763 def expandForLoop (self , currentEdge ):
764764 """ Expand 'node' by creating all its output nodes. """
765765 with self .groupedGraphModification ("Expand For Loop Node" ):
766766 listAttribute = currentEdge .src .root
767767 dst = currentEdge .dst
768768
769- # First, replace the edge with the first element of the list
770- currentEdge = self .replaceEdge (currentEdge , listAttribute .at (0 ), dst )
771-
772- srcIndex = listAttribute .index (currentEdge .src )
773- dst = currentEdge .dst
774769 for i in range (1 , len (listAttribute )):
775770 duplicates = self .duplicateNodesFrom (dst .node )
776771 newNode = duplicates [0 ]
777772 previousEdge = self .graph .edge (newNode .attribute (dst .name ))
778773 self .replaceEdge (previousEdge , listAttribute .at (i ), previousEdge .dst )
779774
775+ # Last, replace the edge with the first element of the list
776+ return self .replaceEdge (currentEdge , listAttribute .at (0 ), dst )
777+
780778 @Slot (Edge )
781779 def collapseForLoop (self , currentEdge ):
782780 """ Collapse 'node' by removing all its output nodes. """
Original file line number Diff line number Diff line change @@ -389,11 +389,22 @@ Item {
389389
390390 contentItem: Row {
391391 IntSelector {
392+ id: loopIterationSelector
392393 tooltipText: " Iterations"
393394 visible: edgeMenu .currentEdge && edgeMenu .forLoop
394395
395396 property var listAttr: edgeMenu .currentEdge ? edgeMenu .currentEdge .src .root : null
396397
398+ Connections {
399+ target: edgeMenu
400+ function onCurrentEdgeChanged () {
401+ if (edgeMenu .currentEdge ) {
402+ loopIterationSelector .listAttr = edgeMenu .currentEdge .src .root
403+ loopIterationSelector .value = loopIterationSelector .listAttr ? loopIterationSelector .listAttr .value .indexOf (edgeMenu .currentEdge .src ) + 1 : 0
404+ }
405+ }
406+ }
407+
397408 // We add 1 to the index because of human readable index (starting at 1)
398409 value: listAttr ? listAttr .value .indexOf (edgeMenu .currentEdge .src ) + 1 : 0
399410 range: { " min" : 1 , " max" : listAttr ? listAttr .value .count : 0 }
@@ -436,7 +447,7 @@ Item {
436447 text: MaterialIcons .open_in_full
437448
438449 onClicked: {
439- uigraph .expandForLoop (edgeMenu .currentEdge )
450+ edgeMenu . currentEdge = uigraph .expandForLoop (edgeMenu .currentEdge )
440451 canExpand = false
441452 edgeMenu .close ()
442453 }
Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ Item {
264264 spacing: 3
265265
266266 delegate: Label {
267- width: (ListView .view .width / ListView .view .model .count ) - 3
267+ width: ListView . view . model ? (ListView .view .width / ListView .view .model .count ) - 3 : 0
268268 height: ListView .view .height
269269 anchors .verticalCenter : parent .verticalCenter
270270 background: Rectangle {
You can’t perform that action at this time.
0 commit comments