Changeset View
Changeset View
Standalone View
Standalone View
src/kcollapsiblegroupbox.cpp
Show First 20 Lines • Show All 116 Lines • ▼ Show 20 Line(s) | 114 | { | |||
---|---|---|---|---|---|
117 | } | 117 | } | ||
118 | 118 | | |||
119 | d->isExpanded = expanded; | 119 | d->isExpanded = expanded; | ||
120 | emit expandedChanged(); | 120 | emit expandedChanged(); | ||
121 | 121 | | |||
122 | d->updateChildrenFocus(expanded); | 122 | d->updateChildrenFocus(expanded); | ||
123 | 123 | | |||
124 | d->animation->setDirection(expanded ? QTimeLine::Forward : QTimeLine::Backward); | 124 | d->animation->setDirection(expanded ? QTimeLine::Forward : QTimeLine::Backward); | ||
125 | #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) | ||||
126 | // QTimeLine::duration() must be > 0 | ||||
127 | const int duration = qMax(1, style()->styleHint(QStyle::SH_Widget_Animation_Duration)); | ||||
128 | d->animation->setDuration(duration); | ||||
129 | #else | ||||
130 | d->animation->setDuration(style()->styleHint(QStyle::SH_Widget_Animate, nullptr, this) ? 500 : 1); | ||||
131 | #endif | ||||
125 | d->animation->start(); | 132 | d->animation->start(); | ||
126 | 133 | | |||
127 | //when going from collapsed to expanded changing the child visibility calls an updateGeometry | 134 | //when going from collapsed to expanded changing the child visibility calls an updateGeometry | ||
128 | //which calls sizeHint with expanded true before the first frame of the animation kicks in | 135 | //which calls sizeHint with expanded true before the first frame of the animation kicks in | ||
129 | //trigger an effective frame 0 | 136 | //trigger an effective frame 0 | ||
130 | if (expanded) { | 137 | if (expanded) { | ||
131 | setFixedHeight(d->headerSize.height()); | 138 | setFixedHeight(d->headerSize.height()); | ||
132 | } | 139 | } | ||
▲ Show 20 Lines • Show All 234 Lines • Show Last 20 Lines |