Unsolved How do I animate the position change of a Widget while using a layout manager?
Basically what I am trying to do is animate a widget I created, I want it to have a startValue of (0,0) or somewhere off the screen. But I want the end value to be where the widget is located on the QGridLayout manger that I am using, lets say for example with widget is located at the row/column of (17,6). How can I make that value into the endValue? Here is an example of what I have tried so far.
print ("POS: ", self.Play_label.pos()) geometry_play = self.Play_label.geometry() print ("mapp: ", self.Play_label.mapToGlobal(QPoint(0,0))) print ("play geo: ", geometry_play) #grid.addWidget(self.Play_label, 5, 5) print ("layout type: ", self.Play_label.layout()) self.animation = QPropertyAnimation(grid, b"geometry") self.animation.setDuration(3000) self.animation.setStartValue(QRect(0,0,150,150)) self.animation.setEndValue(geometry_play) #print ("Value: ", self.animation.currentValue()) #self.animation.valueChanged.connect(self.Play_label.changeImageSize) #self.animation.setTargetObject(self.Play_label) self.animation.start()
I attempt to use the geometry of the widget for the endValue() but this does not move the widget to the correct position, and if i print out the geometry the x and y coordinates are both set to zero, and also If i try to use pos() on the widget it also returns (0,0) Is this because I am using a layout method? Is it possible to somehow get the static position of the widget when it is in a layout manager? If so how would I do that?
Is there some build in QPropertyAnimation method that can animate the position change of the layout method? Or would it be easier to try to find the static coordinates of the widget?
I apologize in advance I know this is a lot im trying to figure out if my error is in me trying to get the coordinates of the widget when its in the layout, or me trying to find a way that QPropertyAnimation handles layout manager movement animation? Im not sure which way to go about doing this?
Any advice would be greatly appreciated, thank you.