I'm trying to fade out an entire row of a GridLayout when a user clicks a button. So far I've been able to loop each of the widgets on the specific row which is working but I'm struggling with creating a parallel animation for them all...
idx = self.parent().findChild(QGridLayout).indexOf(self)
location = self.parent().findChild(QGridLayout).getItemPosition(idx)
row, col = location[:2]
self.parent_grid = self.parent().findChild(QGridLayout)
col_count = self.parent().findChild(QGridLayout).columnCount()
print(col_count)
self.effects = []
self.animations = []
anim_group = QParallelAnimationGroup()
for i in range(col_count-1):
effect = QGraphicsOpacityEffect(self)
self.effects.append(effect)
self.parent_grid.itemAtPosition(row,i).widget().setGraphicsEffect(effect)
new_anim = QPropertyAnimation(effect, b"opacity")
new_anim.setDuration(1000)
new_anim.setStartValue(1)
new_anim.setEndValue(0)
new_anim.finished.connect(lambda: self.hide_widget(col_count, row))
self.animations.append(new_anim)
anim_group.addAnimation(new_anim)
anim_group.start()