3

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.

Cesar
  • 41
  • 2
  • 5
  • 16
  • I think you can't do this because you don't have access, but you can create your custom tree widget based on qt source code and there you set what animation you like. I mean if it is so important for you create your class for implementing treewidget – Parisa.H.R Oct 27 '22 at 07:33
  • The answer of the similar question indeed states that "widget-animation-duration" exists, but that it is only used to enable/disable the animation of a `QTreeView`. – m7913d Oct 30 '22 at 12:07
  • So, your best option is probably to alter the Qt source code, to correctly use the duration settings of the stylesheet or to expose it as a C++ member function of `QTreeView`. See also the research in the answer of the similar question. – m7913d Oct 30 '22 at 12:21
  • @m7913d that part of the source affects all widgets not only the `QtreeWidget` – Cesar Oct 30 '22 at 23:19
  • What do you mean with "that part of the source"? Which part? – m7913d Oct 30 '22 at 23:57
  • @m7913d `if (const int animationDuration = style()->styleHint(QStyle::SH_Widget_Animation_Duration, 0, this)) { d->currentAnimation.setDuration(animationDuration);` – Cesar Oct 31 '22 at 00:18
  • That code is found inside `QColumnView` and `QWidgetAnimator` only. Those classes are not related to `QTreeView` or 'all widgets'. – m7913d Oct 31 '22 at 10:30

1 Answers1

0

You can disable animations using isAnimated(), but as far as I know, it is impossible to speed up the animations.