45 lines
1.5 KiB
Diff
45 lines
1.5 KiB
Diff
|
From 953939b4727cf46b1e100e29f020e735c2cf92f5 Mon Sep 17 00:00:00 2001
|
||
|
From: Christoph Feck <cfeck@kde.org>
|
||
|
Date: Wed, 26 Sep 2018 22:25:23 +0200
|
||
|
Subject: [KCollapsibleGroupBox] Respect style's widget animation duration
|
||
|
|
||
|
Query QStyle::SH_Widget_Animation_Duration style hint.
|
||
|
|
||
|
QTimeLine requires a duration > 0, so use 1 [ms] to make
|
||
|
the animation as fast as possible when disabled.
|
||
|
|
||
|
BUG: 397103
|
||
|
FIXED-IN: 5.51.0
|
||
|
|
||
|
Reviewed by: ngraham, elvisangelaccio
|
||
|
|
||
|
Differential Revision: https://phabricator.kde.org/D15611
|
||
|
---
|
||
|
src/kcollapsiblegroupbox.cpp | 7 +++++++
|
||
|
1 file changed, 7 insertions(+)
|
||
|
|
||
|
Rebased by Antonio Larrosa <alarrosa@suse.com> to recover this patch
|
||
|
which was later removed by upstream
|
||
|
|
||
|
diff --git a/src/kcollapsiblegroupbox.cpp b/src/kcollapsiblegroupbox.cpp
|
||
|
index e44ef2a..ad9a918 100644
|
||
|
--- a/src/kcollapsiblegroupbox.cpp
|
||
|
+++ b/src/kcollapsiblegroupbox.cpp
|
||
|
@@ -122,9 +122,13 @@ void KCollapsibleGroupBox::setExpanded(bool expanded)
|
||
|
d->updateChildrenFocus(expanded);
|
||
|
|
||
|
d->animation->setDirection(expanded ? QTimeLine::Forward : QTimeLine::Backward);
|
||
|
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||
|
// QTimeLine::duration() must be > 0
|
||
|
const int duration = qMax(1, style()->styleHint(QStyle::SH_Widget_Animation_Duration));
|
||
|
d->animation->setDuration(duration);
|
||
|
+#else
|
||
|
+ d->animation->setDuration(style()->styleHint(QStyle::SH_Widget_Animate, nullptr, this) ? 500 : 1);
|
||
|
+#endif
|
||
|
d->animation->start();
|
||
|
|
||
|
//when going from collapsed to expanded changing the child visibility calls an updateGeometry
|
||
|
--
|
||
|
cgit v1.1
|
||
|
|