Skip to content
New issue

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

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

Already on GitHub? # to your account

fit: Add focus style #462

Merged
merged 1 commit into from
Feb 24, 2025
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
5 changes: 5 additions & 0 deletions qt6/src/qml/ComboBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ T.ComboBox {
}
}
}
Loader {
anchors.fill: parent
active: control.flat && control.visualFocus
sourceComponent: FocusBoxBorder {}
}
}

popup: Popup {
Expand Down
4 changes: 2 additions & 2 deletions qt6/src/qml/FocusBoxBorder.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import org.deepin.dtk.style 1.0 as DS

Item {
id: control
property color color: "transparent"
property color color: palette.highlight
property real borderWidth: DS.Style.control.focusBorderWidth
property real radius: 0
property real radius: DS.Style.control.radius

Rectangle {
id: _border
Expand Down
6 changes: 6 additions & 0 deletions qt6/src/qml/Slider.qml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ T.Slider {
palette: D.DTK.makeIconPalette(control.palette)
mode: control.D.ColorSelector.controlState
theme: control.D.ColorSelector.controlTheme

Loader {
anchors.fill: parent
active: control.visualFocus
sourceComponent: FocusBoxBorder {}
}
}

// draw panel
Expand Down
5 changes: 5 additions & 0 deletions qt6/src/qml/Switch.qml
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,9 @@ T.Switch {
text: control.text
verticalAlignment: Text.AlignVCenter
}

background: Loader {
active: control.visualFocus
sourceComponent: FocusBoxBorder {}
}
}