Unsolved Smooth scaling QPixmap
-
I have a QTableView that has gotten kind of slow to paint when animate-expanding to a pre-set width (see screenshot):
I tried to fake-optimize it by temporarily hiding it and replacing it with a redesign of the widget to a QPixmap shown by a label. The rendering obviously stretches, but fine (see screenshot):
But even that is slow! I've tested with just showing the label as a top-level window and resizing using the mouse.
Can anyone think of a faster way to animate-resize a QPixmap of about that size? Or should my table rendering be reasonably fast when animate-resizing itself?
Thanks!
-
Hi,
How are you doing that animation ?
-
I you are asking about the animation of the container of the QTableView prior to the QPixmap fake-animation fix described, then like this:
self.expandAnimation = QPropertyAnimation(self, b'size')
If you are asking about the QPixmap resize animation, then I am using the same QPropertyAnimation as above but on every valueChanged signal I resize the label with QLabel.resize().
-
What are the parameters of the animation ?
-
@SGaist said in Smooth scaling QPixmap:
What are the parameters of the animation ?
Just this:
self.expandAnimation = QPropertyAnimation(self, b'size') self.expandAnimation.setDuration(util.ANIM_DURATION_MS) self.expandAnimation.setEasingCurve(util.ANIM_EASING)
-
What are
util.ANIM_DURATION_MS
andutil.ANIM_EASING
? -
@SGaist said in Smooth scaling QPixmap:
What are
util.ANIM_DURATION_MS
andutil.ANIM_EASING
?ANIM_DURATION_MS = 250 ANIM_EASING = QEasingCurve.OutQuad