aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/quickcontrols/fluentwinui3/ComboBox.qml49
-rw-r--r--src/quickcontrols/fluentwinui3/ItemDelegate.qml18
2 files changed, 51 insertions, 16 deletions
diff --git a/src/quickcontrols/fluentwinui3/ComboBox.qml b/src/quickcontrols/fluentwinui3/ComboBox.qml
index 93c6b6a6cb..727db66de9 100644
--- a/src/quickcontrols/fluentwinui3/ComboBox.qml
+++ b/src/quickcontrols/fluentwinui3/ComboBox.qml
@@ -40,6 +40,7 @@ T.ComboBox {
: Config.controls.combobox[__currentState]) || {}
readonly property Item __focusFrameTarget: control.editable ? null : control
+ readonly property bool __isHighContrast: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
delegate: ItemDelegate {
required property var model
@@ -95,20 +96,31 @@ T.ComboBox {
readonly property Item __focusFrameControl: control
}
- background: Impl.StyleImage {
- imageConfig: control.__config.background
- Item {
- visible: control.editable && ((control.down && control.popup.visible) || control.activeFocus)
- width: parent.width
- height: 2
- y: parent.height - height
- Impl.FocusStroke {
+ background: ItemGroup {
+ Impl.StyleImage {
+ visible: !control.__isHighContrast
+ imageConfig: control.__config.background
+ Item {
+ visible: control.editable && ((control.down && control.popup.visible) || control.activeFocus)
width: parent.width
- height: parent.height
- radius: control.down && control.popup.visible ? 0 : control.__config.background.bottomOffset
- color: control.palette.accent
+ height: 2
+ y: parent.height - height
+ Impl.FocusStroke {
+ width: parent.width
+ height: parent.height
+ radius: control.down && control.popup.visible ? 0 : control.__config.background.bottomOffset
+ color: control.palette.accent
+ }
}
}
+ Rectangle {
+ visible: control.__isHighContrast
+ implicitWidth: control.__config.background.width
+ implicitHeight: control.__config.background.height
+ color: control.palette.window
+ border.color: control.hovered ? control.palette.accent : control.palette.text
+ radius: 4
+ }
}
popup: T.Popup {
@@ -139,8 +151,19 @@ T.ComboBox {
NumberAnimation { property: "height"; from: control.popup.height / 3; to: control.popup.height; easing.type: Easing.OutCubic; duration: 250 }
}
- background: Impl.StyleImage {
- imageConfig: control.__config.popup_background.filePath ? control.__config.popup_background : Config.controls.popup["normal"].background // fallback to regular popup
+ background: ItemGroup {
+ Impl.StyleImage {
+ visible: !control.__isHighContrast
+ imageConfig: control.__config.popup_background.filePath ? control.__config.popup_background : Config.controls.popup["normal"].background // fallback to regular popup
+ }
+ Rectangle {
+ visible: control.__isHighContrast
+ implicitWidth: Config.controls.popup["normal"].background.width
+ implicitHeight: Config.controls.popup["normal"].background.height
+ color: control.palette.window
+ border.color: control.palette.text
+ radius: 4
+ }
}
}
}
diff --git a/src/quickcontrols/fluentwinui3/ItemDelegate.qml b/src/quickcontrols/fluentwinui3/ItemDelegate.qml
index 322d40a753..f4596d02af 100644
--- a/src/quickcontrols/fluentwinui3/ItemDelegate.qml
+++ b/src/quickcontrols/fluentwinui3/ItemDelegate.qml
@@ -27,9 +27,11 @@ T.ItemDelegate {
leftInset: -__config.leftInset || 0
rightInset: -__config.rightInset || 0
+ readonly property bool __isHighContrast: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
+
icon.width: 16
icon.height: 16
- icon.color: control.down ? __pressedText : control.palette.buttonText
+ icon.color: control.down ? __pressedText : __isHighContrast && control.hovered ? control.palette.button : control.palette.buttonText
readonly property int __horizontalOffset: 4
readonly property int __verticalOffset: 2
@@ -63,6 +65,7 @@ T.ItemDelegate {
implicitHeight: 40
property Item backgroundImage: Impl.StyleImage {
+ visible: !control.__isHighContrast
parent: control.background
imageConfig: control.__config.background
implicitWidth: parent.width - control.__horizontalOffset * 2
@@ -80,8 +83,7 @@ T.ItemDelegate {
: 0
radius: width * 0.5
color: control.palette.accent
- visible: control.highlighted || control.activeFocus
-
+ visible: (control.highlighted || control.activeFocus) && !control.__isHighContrast
Behavior on height {
NumberAnimation {
duration: 187
@@ -89,5 +91,15 @@ T.ItemDelegate {
}
}
}
+
+ Rectangle {
+ visible: control.__isHighContrast
+ implicitWidth: parent.width - control.__horizontalOffset * 2
+ implicitHeight: parent.height - control.__verticalOffset * 2
+ x: control.__horizontalOffset
+ y: control.__verticalOffset
+ color: control.hovered ? control.palette.accent : control.palette.window
+ radius: 4
+ }
}
}