Other: Fix activeFocus color for components

This commit is contained in:
Alexander Bilyak
2021-10-27 11:48:04 +02:00
committed by Jakub
parent 36ec9b07e0
commit 8c9d5c54fc
6 changed files with 30 additions and 23 deletions

View File

@ -155,7 +155,7 @@ T.Button {
return control.colorScheme.interaction_norm_active
}
if (control.enabled && (control.highlighted || control.hovered || control.checked)) {
if (control.enabled && (control.highlighted || control.hovered || control.checked || control.activeFocus)) {
return control.colorScheme.interaction_norm_hover
}
@ -171,7 +171,7 @@ T.Button {
return control.colorScheme.interaction_default_active
}
if (control.enabled && (control.highlighted || control.hovered || control.checked)) {
if (control.enabled && (control.highlighted || control.hovered || control.checked || control.activeFocus)) {
return control.colorScheme.interaction_default_hover
}
@ -189,7 +189,7 @@ T.Button {
return control.colorScheme.interaction_default_active
}
if (control.enabled && (control.highlighted || control.hovered || control.checked)) {
if (control.enabled && (control.highlighted || control.hovered || control.checked || control.activeFocus)) {
return control.colorScheme.interaction_default_hover
}
@ -205,7 +205,7 @@ T.Button {
return control.colorScheme.interaction_default_active
}
if (control.enabled && (control.highlighted || control.hovered || control.checked)) {
if (control.enabled && (control.highlighted || control.hovered || control.checked || control.activeFocus)) {
return control.colorScheme.interaction_default_hover
}

View File

@ -57,7 +57,7 @@ T.CheckBox {
return control.colorScheme.signal_danger
}
if (control.hovered) {
if (control.hovered || control.activeFocus) {
return control.colorScheme.interaction_norm_hover
}
@ -74,7 +74,7 @@ T.CheckBox {
return control.colorScheme.signal_danger
}
if (control.hovered) {
if (control.hovered || control.activeFocus) {
return control.colorScheme.interaction_norm_hover
}

View File

@ -71,7 +71,7 @@ T.ComboBox {
return root.colorScheme.interaction_norm
}
if (root.hovered) {
if (root.hovered || root.activeFocus) {
return root.colorScheme.field_hover
}
@ -91,7 +91,7 @@ T.ComboBox {
return root.colorScheme.interaction_default_active
}
if (root.enabled && root.hovered) {
if (root.enabled && root.hovered || root.activeFocus) {
return root.colorScheme.interaction_default_hover
}
@ -121,14 +121,25 @@ T.ComboBox {
width: parent.width
text: root.textRole ? (Array.isArray(root.model) ? modelData[root.textRole] : model[root.textRole]) : modelData
palette.text: root.enabled ? root.colorScheme.text_norm : root.colorScheme.text_disabled
palette.text: {
if (!root.enabled) {
return root.colorScheme.text_disabled
}
if (selected) {
return root.colorScheme.text_invert
}
return root.colorScheme.text_norm
}
font: root.font
hoverEnabled: root.hoverEnabled
// we use highlighted to indicate currently selected delegate
highlighted: root.currentIndex === index
palette.highlightedText: root.enabled ? root.colorScheme.text_invert : root.colorScheme.text_disabled
property bool selected: root.currentIndex === index
highlighted: root.highlightedIndex === index
palette.highlightedText: selected ? root.colorScheme.text_invert : root.colorScheme.text_norm
background: PaddedRectangle {
radius: 4
@ -137,11 +148,11 @@ T.ComboBox {
return root.colorScheme.interaction_default_active
}
if (parent.highlighted) {
if (parent.selected) {
return root.colorScheme.interaction_norm
}
if (parent.hovered) {
if (parent.hovered || parent.highlighted) {
return root.colorScheme.interaction_default_hover
}

View File

@ -55,7 +55,7 @@ T.RadioButton {
return control.colorScheme.signal_danger
}
if (control.hovered) {
if (control.hovered || control.activeFocus) {
return control.colorScheme.interaction_norm_hover
}
@ -77,7 +77,7 @@ T.RadioButton {
return control.colorScheme.signal_danger
}
if (control.hovered) {
if (control.hovered || control.activeFocus) {
return control.colorScheme.interaction_norm_hover
}

View File

@ -46,7 +46,7 @@ T.Switch {
padding: 0
spacing: 7
indicator: PaddedRectangle {
indicator: Rectangle {
implicitWidth: 40
implicitHeight: 24
@ -54,9 +54,6 @@ T.Switch {
y: control.topPadding + (control.availableHeight - height) / 2
radius: 12
leftPadding: 0
rightPadding: 0
padding: 0
color: control.enabled || control.loading ? control.colorScheme.background_norm : control.colorScheme.background_strong
border.width: control.enabled && !loading ? 1 : 0
border.color: control.hovered ? control.colorScheme.field_hover : control.colorScheme.field_norm
@ -76,14 +73,14 @@ T.Switch {
}
if (control.checked) {
if (control.hovered) {
if (control.hovered || control.activeFocus) {
return control.colorScheme.interaction_norm_hover
}
return control.colorScheme.interaction_norm
}
if (control.hovered) {
if (control.hovered || control.activeFocus) {
return control.colorScheme.field_hover
}

View File

@ -279,7 +279,6 @@ Item {
visible: root.echoMode === TextInput.Password
icon.color: control.color
background: Item { }
checkable: true
icon.source: checked ? "../icons/ic-eye-slash.svg" : "../icons/ic-eye.svg"
}