Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Antialias Click-Effects on Buttons #4473

Merged
merged 3 commits into from
May 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 6 additions & 11 deletions src/widgets/helper/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down