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):
759
759
return False
760
760
return True
761
761
762
- @Slot (Edge )
762
+ @Slot (Edge , result = Edge )
763
763
def expandForLoop (self , currentEdge ):
764
764
""" Expand 'node' by creating all its output nodes. """
765
765
with self .groupedGraphModification ("Expand For Loop Node" ):
766
766
listAttribute = currentEdge .src .root
767
767
dst = currentEdge .dst
768
768
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
774
769
for i in range (1 , len (listAttribute )):
775
770
duplicates = self .duplicateNodesFrom (dst .node )
776
771
newNode = duplicates [0 ]
777
772
previousEdge = self .graph .edge (newNode .attribute (dst .name ))
778
773
self .replaceEdge (previousEdge , listAttribute .at (i ), previousEdge .dst )
779
774
775
+ # Last, replace the edge with the first element of the list
776
+ return self .replaceEdge (currentEdge , listAttribute .at (0 ), dst )
777
+
780
778
@Slot (Edge )
781
779
def collapseForLoop (self , currentEdge ):
782
780
""" Collapse 'node' by removing all its output nodes. """
Original file line number Diff line number Diff line change @@ -389,11 +389,22 @@ Item {
389
389
390
390
contentItem: Row {
391
391
IntSelector {
392
+ id: loopIterationSelector
392
393
tooltipText: " Iterations"
393
394
visible: edgeMenu .currentEdge && edgeMenu .forLoop
394
395
395
396
property var listAttr: edgeMenu .currentEdge ? edgeMenu .currentEdge .src .root : null
396
397
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
+
397
408
// We add 1 to the index because of human readable index (starting at 1)
398
409
value: listAttr ? listAttr .value .indexOf (edgeMenu .currentEdge .src ) + 1 : 0
399
410
range: { " min" : 1 , " max" : listAttr ? listAttr .value .count : 0 }
@@ -436,7 +447,7 @@ Item {
436
447
text: MaterialIcons .open_in_full
437
448
438
449
onClicked: {
439
- uigraph .expandForLoop (edgeMenu .currentEdge )
450
+ edgeMenu . currentEdge = uigraph .expandForLoop (edgeMenu .currentEdge )
440
451
canExpand = false
441
452
edgeMenu .close ()
442
453
}
Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ Item {
264
264
spacing: 3
265
265
266
266
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
268
268
height: ListView .view .height
269
269
anchors .verticalCenter : parent .verticalCenter
270
270
background: Rectangle {
You can’t perform that action at this time.
0 commit comments