MCPcopy Create free account
hub / github.com/RGAA-Software/GoDesk / ExecAnimation

Method ExecAnimation

src/client/ui/switch_button.cpp:94–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92 }
93
94 void SwitchButton::ExecAnimation(bool selected) {
95 if (selected) {
96 // left => right
97 auto anim = new QPropertyAnimation();
98 anim->setStartValue(left_point_);
99 anim->setEndValue(right_point_);
100 connect(anim, &QPropertyAnimation::valueChanged, this, [=, this](const QVariant &value) {
101 thumb_point_ = value.toInt();
102 update();
103 });
104 connect(anim, &QPropertyAnimation::finished, this, [=]() {
105 anim->deleteLater();
106 });
107 anim->setEasingCurve(QEasingCurve::OutCubic);
108 anim->setDuration(300);
109 anim->start();
110 } else {
111 // right => left
112 auto anim = new QPropertyAnimation();
113 anim->setStartValue(right_point_);
114 anim->setEndValue(left_point_);
115 connect(anim, &QPropertyAnimation::valueChanged, this, [=, this](const QVariant &value) {
116 thumb_point_ = value.toInt();
117 update();
118 });
119 connect(anim, &QPropertyAnimation::finished, this, [=]() {
120 anim->deleteLater();
121 });
122 anim->setEasingCurve(QEasingCurve::OutCubic);
123 anim->setDuration(300);
124 anim->start();
125 }
126 }
127
128}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected