| 65 | } |
| 66 | |
| 67 | void Collapsible::toggle(bool collapsed) |
| 68 | { |
| 69 | if (!content) |
| 70 | return; |
| 71 | |
| 72 | int height = content->size().height(); |
| 73 | if (height) |
| 74 | contentHeight = height; |
| 75 | |
| 76 | if (collapsed) |
| 77 | { |
| 78 | content->setMinimumHeight(0); |
| 79 | content->setMaximumHeight(0); |
| 80 | toggleButton->setArrowType(Qt::ArrowType::DownArrow); |
| 81 | animgroup->setDirection(QAbstractAnimation::Forward); |
| 82 | } |
| 83 | else |
| 84 | { |
| 85 | toggleButton->setArrowType(Qt::ArrowType::RightArrow); |
| 86 | animgroup->setDirection(QAbstractAnimation::Backward); |
| 87 | } |
| 88 | |
| 89 | for (int i = 0, n = animgroup->animationCount(); i < n; i++) |
| 90 | { |
| 91 | QPropertyAnimation *anim; |
| 92 | anim = (QPropertyAnimation*) animgroup->animationAt(i); |
| 93 | anim->setStartValue(0); |
| 94 | anim->setEndValue(contentHeight); |
| 95 | anim->setDuration(200); |
| 96 | } |
| 97 | |
| 98 | animgroup->start(); |
| 99 | } |
| 100 | |
| 101 | void Collapsible::finishAnimation() |
| 102 | { |
nothing calls this directly
no outgoing calls
no test coverage detected