From 91f4b864367bec440dcd3fe498e2101a5c3447f0 Mon Sep 17 00:00:00 2001 From: nerix Date: Sun, 7 May 2023 13:26:55 +0200 Subject: [PATCH] Antialias Click-Effects on Buttons (#4473) Co-authored-by: pajlada --- CHANGELOG.md | 1 + src/widgets/helper/Button.cpp | 17 ++++++----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8e30c487bd..993b094b23d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Minor: Added `/shield` and `/shieldoff` commands to toggle shield mode. (#4580) - 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 click effects on buttons not being antialiased. (#4473) - Dev: Added the ability to control the `followRedirect` mode for requests. (#4594) ## 2.4.3 diff --git a/src/widgets/helper/Button.cpp b/src/widgets/helper/Button.cpp index a40dbf85948..dce0153f1ea 100644 --- a/src/widgets/helper/Button.cpp +++ b/src/widgets/helper/Button.cpp @@ -203,17 +203,12 @@ void Button::fancyPaint(QPainter &painter) for (auto effect : this->clickEffects_) { - QRadialGradient gradient(effect.position.x(), effect.position.y(), - effect.progress * qreal(width()) * 2, - effect.position.x(), effect.position.y()); - - gradient.setColorAt(0, QColor(c.red(), c.green(), c.blue(), - int((1 - effect.progress) * 95))); - 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); + painter.setPen(Qt::NoPen); + painter.setBrush(QColor(c.red(), c.green(), c.blue(), + int((1 - effect.progress) * 95))); + painter.drawEllipse(QPointF(effect.position), + effect.progress * qreal(width()) * 2, + effect.progress * qreal(width()) * 2); } }