| 596 | } |
| 597 | |
| 598 | static void fade(QWidget *widget, bool fadeOut) |
| 599 | { |
| 600 | const double fadeOutOpacity = 0.3; |
| 601 | // Don't use exactly 1.0 as for some reason this causes buttons in |
| 602 | // macroSplitter handle layout to not be redrawn unless mousing over |
| 603 | // them |
| 604 | const double fadeInOpacity = 0.99; |
| 605 | auto curEffect = widget->graphicsEffect(); |
| 606 | if (curEffect) { |
| 607 | auto curOpacity = |
| 608 | dynamic_cast<QGraphicsOpacityEffect *>(curEffect); |
| 609 | if (curOpacity && |
| 610 | ((fadeOut && DoubleEquals(curOpacity->opacity(), |
| 611 | fadeOutOpacity, 0.0001)) || |
| 612 | (!fadeOut && DoubleEquals(curOpacity->opacity(), |
| 613 | fadeInOpacity, 0.0001)))) { |
| 614 | return; |
| 615 | } |
| 616 | } else if (!fadeOut) { |
| 617 | return; |
| 618 | } |
| 619 | delete curEffect; |
| 620 | QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect(); |
| 621 | widget->setGraphicsEffect(opacityEffect); |
| 622 | QPropertyAnimation *animation = |
| 623 | new QPropertyAnimation(opacityEffect, "opacity"); |
| 624 | animation->setDuration(350); |
| 625 | animation->setStartValue(fadeOut ? fadeInOpacity : fadeOutOpacity); |
| 626 | animation->setEndValue(fadeOut ? fadeOutOpacity : fadeInOpacity); |
| 627 | animation->setEasingCurve(QEasingCurve::OutQuint); |
| 628 | animation->start(QPropertyAnimation::DeleteWhenStopped); |
| 629 | } |
| 630 | |
| 631 | static void fadeWidgets(const std::vector<QWidget *> &widgets, bool fadeOut) |
| 632 | { |
no test coverage detected