MCPcopy Create free account
hub / github.com/Cubitect/cubiomes-viewer / toggle

Method toggle

src/widgets.cpp:67–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void 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
101void Collapsible::finishAnimation()
102{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected