| 417 | } |
| 418 | |
| 419 | void MyGraphicsVexItem::onReleaseEffect(){ |
| 420 | stopAnimation(); |
| 421 | QTimeLine *timeLine = new QTimeLine(300, this); |
| 422 | timeLine->setFrameRange(0, 100); |
| 423 | QEasingCurve curve = QEasingCurve::OutBounce; |
| 424 | qreal baseRadius = this->rect().width() / 2; |
| 425 | qreal difRadius = (state & ON_HOVER) == 0 ? radius - baseRadius : radius * 1.25 - baseRadius; |
| 426 | connect(timeLine, &QTimeLine::frameChanged, [=](int frame){ |
| 427 | qreal curProgress = curve.valueForProgress(frame / 100.0); |
| 428 | qreal curRadius = baseRadius + difRadius * curProgress; |
| 429 | this->setRect(QRectF(center.x() - curRadius, center.y() - curRadius, curRadius * 2, curRadius * 2)); |
| 430 | }); |
| 431 | curAnimation = timeLine; |
| 432 | startAnimation(); |
| 433 | } |
| 434 | |
| 435 | void MyGraphicsVexItem::startAnimation(){ |
| 436 | if(curAnimation != nullptr){ |
nothing calls this directly
no outgoing calls
no test coverage detected