[plasma/aurorae/Plasma/6.7] v2: v2: Visualize checked state
Vlad Zahorodnii <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 81e7de9fc7099d44d8531519c6766cf351bec6ed by Vlad Zahorodnii. Committed on 21/07/2026 at 11:47. Pushed by vladz into branch 'Plasma/6.7'. v2: Visualize checked state The checked state is used by buttons such as "on all desktops". When a window is placed on all desktops, the on all desktops button will enter the checked state. It will be useful if the on all desktops button communicates that state. The maximize button is rather special because it uses a different svg to represent the checked (maximized) state. In hindsight, we should have had the "checked" element prefix. That way we could combine checked + pressed. (cherry picked from commit 955751185aa8d2f515c599c73d37c1cc47c398de) Co-authored-by: Vlad Zahorodnii <[email protected]> M +4 -1 v2/decorationbutton.cpp https://invent.kde.org/plasma/aurorae/-/commit/81e7de9fc7099d44d8531519c6766cf351bec6ed diff --git a/v2/decorationbutton.cpp b/v2/decorationbutton.cpp index 75a1040..930dd67 100644 --- a/v2/decorationbutton.cpp +++ b/v2/decorationbutton.cpp @@ -26,7 +26,9 @@ DecorationButton::States DecorationButton::states() const if (isHovered() || isParentHovered()) { states |= State::Hovered; } - if (isPressed()) { + // The maximize button uses a different svg for the maximized state. In hindsight, we need + // a "checked" prefix to represent toggled buttons such as "on all desktops", etc. + if (isPressed() || (isChecked() && type() != KDecoration3::DecorationButtonType::Maximize)) { states |= State::Pressed; } if (!isEnabled()) { @@ -250,6 +252,7 @@ SvgDecorationButton::SvgDecorationButton(KDecoration3::DecorationButtonType type connect(this, &KDecoration3::DecorationButton::pressedChanged, this, &SvgDecorationButton::updateFrame); connect(this, &KDecoration3::DecorationButton::hoveredChanged, this, &SvgDecorationButton::updateFrame); connect(this, &KDecoration3::DecorationButton::enabledChanged, this, &SvgDecorationButton::updateFrame); + connect(this, &KDecoration3::DecorationButton::checkedChanged, this, &SvgDecorationButton::updateFrame); connect(this, &DecorationButton::parentHoveredChanged, this, &SvgDecorationButton::updateFrame); }