Skip to content

Commit

Permalink
fix: wrong status of switch button
Browse files Browse the repository at this point in the history
correct the wrong initial status of switch button

Bug: https://pms.uniontech.com/bug-view-276221.html
Log:
  • Loading branch information
FeiWang1119 committed Oct 8, 2024
1 parent 8397688 commit 1324457
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/widgets/dswitchbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ void DSwitchButton::paintEvent(QPaintEvent *e)
DStylePainter painter(this);
DStyleOptionButton opt;
initStyleOption(&opt);
if (isChecked() != d->checked) {
d->checked = isChecked();
DDciIcon icon = !d->checked ? DDciIcon::fromTheme("switch_on") : DDciIcon::fromTheme("switch_off");
d->player.setIcon(icon);
Q_EMIT checkedChanged(d->checked);
}
painter.drawControl(DStyle::CE_SwitchButton, opt);

painter.setRenderHint(QPainter::SmoothPixmapTransform);
Expand Down

0 comments on commit 1324457

Please sign in to comment.