Antialias Click-Effects on Buttons (#4473)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
nerix
2023-05-07 13:26:55 +02:00
committed by GitHub
parent 4dd290e4e5
commit 91f4b86436
2 changed files with 7 additions and 11 deletions
+1
View File
@@ -6,6 +6,7 @@
- Minor: Added `/shield` and `/shieldoff` commands to toggle shield mode. (#4580) - Minor: Added `/shield` and `/shieldoff` commands to toggle shield mode. (#4580)
- Bugfix: Fixed the menu warping on macOS on Qt6. (#4595) - Bugfix: Fixed the menu warping on macOS on Qt6. (#4595)
- Bugfix: Fixed link tooltips not showing unless the thumbnail setting was enabled. (#4597) - Bugfix: Fixed link tooltips not showing unless the thumbnail setting was enabled. (#4597)
- Bugfix: Fixed click effects on buttons not being antialiased. (#4473)
- Dev: Added the ability to control the `followRedirect` mode for requests. (#4594) - Dev: Added the ability to control the `followRedirect` mode for requests. (#4594)
## 2.4.3 ## 2.4.3
+6 -11
View File
@@ -203,17 +203,12 @@ void Button::fancyPaint(QPainter &painter)
for (auto effect : this->clickEffects_) for (auto effect : this->clickEffects_)
{ {
QRadialGradient gradient(effect.position.x(), effect.position.y(), painter.setPen(Qt::NoPen);
effect.progress * qreal(width()) * 2, painter.setBrush(QColor(c.red(), c.green(), c.blue(),
effect.position.x(), effect.position.y()); int((1 - effect.progress) * 95)));
painter.drawEllipse(QPointF(effect.position),
gradient.setColorAt(0, QColor(c.red(), c.green(), c.blue(), effect.progress * qreal(width()) * 2,
int((1 - effect.progress) * 95))); effect.progress * qreal(width()) * 2);
gradient.setColorAt(0.9999, QColor(c.red(), c.green(), c.blue(),
int((1 - effect.progress) * 95)));
gradient.setColorAt(1, QColor(c.red(), c.green(), c.blue(), int(0)));
painter.fillRect(this->rect(), gradient);
} }
} }