| 132 | } |
| 133 | |
| 134 | void SlidePage::slideOut(){ |
| 135 | if(curAni){ |
| 136 | curAni->stop(); |
| 137 | curAni->deleteLater(); |
| 138 | curAni = nullptr; |
| 139 | } |
| 140 | onShown = false; |
| 141 | sheildLayer->setEnabled(false); |
| 142 | QParallelAnimationGroup *outGroup = new QParallelAnimationGroup(this); |
| 143 | QPropertyAnimation *slideOutAni = new QPropertyAnimation(this, "pos", this); |
| 144 | slideOutAni->setStartValue(this->pos()); |
| 145 | slideOutAni->setEndValue(QPoint(-this->width() - 30, 0)); |
| 146 | slideOutAni->setDuration(1000); |
| 147 | slideOutAni->setEasingCurve(QEasingCurve::InOutExpo); |
| 148 | QPropertyAnimation *fadeOutAni = new QPropertyAnimation(opacity, "opacity", this); |
| 149 | fadeOutAni->setStartValue(opacity->opacity()); |
| 150 | fadeOutAni->setEndValue(0); |
| 151 | fadeOutAni->setDuration(750); |
| 152 | QPropertyAnimation *rotateAni = new QPropertyAnimation(backIcon, "rotationAngle", this); |
| 153 | rotateAni->setStartValue(360); |
| 154 | rotateAni->setEndValue(180); |
| 155 | rotateAni->setDuration(750); |
| 156 | rotateAni->setEasingCurve(QEasingCurve::InOutExpo); |
| 157 | outGroup->addAnimation(slideOutAni); |
| 158 | outGroup->addAnimation(fadeOutAni); |
| 159 | outGroup->addAnimation(rotateAni); |
| 160 | connect(outGroup, &QPropertyAnimation::finished, this, [=](){this->curAni = nullptr;pageContentContainer->scrollToTop();sheildLayer->hide();}); |
| 161 | connect(this, &SlidePage::sizeChange, slideOutAni, [=](){slideOutAni->setEndValue(QPoint(-this->width() - 30, 0));}); |
| 162 | outGroup->start(); |
| 163 | curAni = outGroup; |
| 164 | } |
no test coverage detected