fix: ISSUE #I66N4Y 关闭动画播放时快速按Alt+F4可反复关闭动画而关不掉商店

动画执行标志位仅在动画结束后被置为不再执行,需要提前

Log: 修改 BaseWidgetOpacity::closeEvent,动画开始执行就修改标志位
This commit is contained in:
zty199 2022-12-19 10:55:03 +08:00
parent 27c95991c5
commit ba331cb3fb

@ -13,6 +13,8 @@ BaseWidgetOpacity::BaseWidgetOpacity(QWidget *parent) : DBlurEffectWidget(parent
void BaseWidgetOpacity::closeEvent(QCloseEvent *event) void BaseWidgetOpacity::closeEvent(QCloseEvent *event)
{ {
if (!closeWindowAnimation) { if (!closeWindowAnimation) {
closeWindowAnimation = true;
QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity"); QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity");
animation->setEasingCurve(QEasingCurve::OutQuart); animation->setEasingCurve(QEasingCurve::OutQuart);
animation->setDuration(500); animation->setDuration(500);
@ -25,7 +27,6 @@ void BaseWidgetOpacity::closeEvent(QCloseEvent *event)
}); });
QObject::connect(animation, &QPropertyAnimation::finished, this, [=](){ QObject::connect(animation, &QPropertyAnimation::finished, this, [=](){
closeWindowAnimation = true;
this->close(); this->close();
}); });