mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-04 17:15:29 +08:00
添加支持windows系统窗口win7-win10(area、blur)、win11(mica、mica-alt)效果切换,修改夜间模式切换动画效果,支持动画打断;
This commit is contained in:
@ -25,13 +25,32 @@ void CircularReveal::paint(QPainter *painter) {
|
||||
path.moveTo(_center.x(), _center.y());
|
||||
path.addEllipse(QPointF(_center.x(), _center.y()), _radius, _radius);
|
||||
painter->setCompositionMode(QPainter::CompositionMode_Clear);
|
||||
painter->fillPath(path, Qt::black);
|
||||
if(_darkToLight){
|
||||
painter->fillPath(path, Qt::white);
|
||||
}else{
|
||||
QPainterPath outerRect;
|
||||
outerRect.addRect(0, 0, width(), height());
|
||||
outerRect = outerRect.subtracted(path);
|
||||
painter->fillPath(outerRect, Qt::black);
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
[[maybe_unused]] void CircularReveal::start(int w, int h, const QPoint ¢er, int radius) {
|
||||
_anim->setStartValue(0);
|
||||
_anim->setEndValue(radius);
|
||||
if (_anim->state() == QAbstractAnimation::Running) {
|
||||
_anim->stop();
|
||||
int currentRadius = _radius;
|
||||
_anim->setStartValue(currentRadius);
|
||||
_anim->setEndValue(_darkToLight ? 0 : radius);
|
||||
} else {
|
||||
if(_darkToLight){
|
||||
_anim->setStartValue(radius);
|
||||
_anim->setEndValue(0);
|
||||
}else{
|
||||
_anim->setStartValue(0);
|
||||
_anim->setEndValue(radius);
|
||||
}
|
||||
}
|
||||
_center = center;
|
||||
_grabResult = _target->grabToImage(QSize(w, h));
|
||||
connect(_grabResult.data(), &QQuickItemGrabResult::ready, this,
|
||||
|
@ -10,6 +10,7 @@ class CircularReveal : public QQuickPaintedItem {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY_AUTO_P(QQuickItem *, target)
|
||||
Q_PROPERTY_AUTO(int, radius)
|
||||
Q_PROPERTY_AUTO(bool, darkToLight)
|
||||
public:
|
||||
explicit CircularReveal(QQuickItem *parent = nullptr);
|
||||
void paint(QPainter *painter) override;
|
||||
|
Reference in New Issue
Block a user