I have found a similar question: Can you set the animation speed of a QTreeWidget?
I tried adding to the stylesheet:
QTreeWidget {
widget-animation-duration: 1000;
}
But the animation delay for collapse and expansion continued the same, I think the default value is 0.
CodePudding user response:
You can disable animations using isAnimated(), but as far as I know, it is impossible to speed up the animations.
CodePudding user response:
The only solution is to create a new class based on QTreeWidget and override the following methods:
<code>class TreeWidget(QTreeWidget):
def __init__(self, parent=None):
QTreeWidget.__init__(self, parent)
def collapseItem(self, itm):
self.collapseItem(itm, False)
def collapseAll(self):
self.collapseAll(False)
def expandItem(self, itm):
self.expandItem(itm, False)
def expandAll(self):
self.expandAll(False)
The problem is that the default animation is always used, to solve this problem you must use the alternative methods that do not have the animation, and if so then it is not necessary to expose them in the interface, so the solution is to override the methods of animation, in the code above the methods that do not have animation are used.