c749d642cf
- Add title/description search with Ctrl+F and a result dialog\n- Support daily/weekly/monthly recurring blocks with conflict skipping\n- Add CPack NSIS packaging, MinGW release preset, and deploy script\n- Add window/view/list/dialog fade animations\n- Document multi-device conflict behavior and update validation screenshots
47 lines
1.3 KiB
C++
47 lines
1.3 KiB
C++
#include "AnimationUtils.h"
|
|
|
|
#include <QGraphicsOpacityEffect>
|
|
#include <QPropertyAnimation>
|
|
#include <QWidget>
|
|
|
|
namespace AnimationUtils
|
|
{
|
|
void fadeIn(QWidget* widget, int durationMs)
|
|
{
|
|
if (!widget)
|
|
{
|
|
return;
|
|
}
|
|
widget->setGraphicsEffect(nullptr);
|
|
auto* effect = new QGraphicsOpacityEffect(widget);
|
|
effect->setOpacity(0.0);
|
|
widget->setGraphicsEffect(effect);
|
|
auto* animation = new QPropertyAnimation(effect, "opacity", widget);
|
|
animation->setDuration(durationMs);
|
|
animation->setStartValue(0.0);
|
|
animation->setEndValue(1.0);
|
|
animation->setEasingCurve(QEasingCurve::OutCubic);
|
|
QObject::connect(animation, &QPropertyAnimation::finished, widget, [widget, animation]() {
|
|
widget->setGraphicsEffect(nullptr);
|
|
animation->deleteLater();
|
|
});
|
|
animation->start();
|
|
}
|
|
|
|
void fadeWindow(QWidget* window, int durationMs)
|
|
{
|
|
if (!window)
|
|
{
|
|
return;
|
|
}
|
|
auto* animation = new QPropertyAnimation(window, "windowOpacity", window);
|
|
animation->setDuration(durationMs);
|
|
animation->setStartValue(0.0);
|
|
animation->setEndValue(1.0);
|
|
animation->setEasingCurve(QEasingCurve::OutCubic);
|
|
QObject::connect(animation, &QPropertyAnimation::finished, animation, &QPropertyAnimation::deleteLater);
|
|
window->setWindowOpacity(0.0);
|
|
animation->start();
|
|
}
|
|
} // namespace AnimationUtils
|