aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2019-03-26 10:56:55 +0100
committerMitch Curtis <mitch.curtis@qt.io>2019-03-27 13:51:49 +0000
commit10023b188bb84d631fea53baa9ce5997f3fc286d (patch)
treefd100438b8dfab6c6fb959d6564ad2bb24e0f4fc /src/imports/controls
parent11995169ee09a99ef1af4c778e30e25829c635b4 (diff)
Default: fix highlighted ItemDelegate colors
- Make ItemDelegate respect highlightedText - Change ItemDelegate's highlightedText palette role from white to almost black (i.e inversion of "light" which is 0xFF090909), so that text shows up against a highlighted background. This also allows easily switching ComboBox to a dark style via palette customization. Fixes: QTBUG-72786 Fixes: QTBUG-74678 Change-Id: I5ad0d86de112f869edf0488d06bb308cdc900363 Reviewed-by: Massimo Callegari <massimocallegari@yahoo.it> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/controls')
-rw-r--r--src/imports/controls/ComboBox.qml3
-rw-r--r--src/imports/controls/ItemDelegate.qml2
-rw-r--r--src/imports/controls/qquickdefaulttheme.cpp2
3 files changed, 4 insertions, 3 deletions
diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml
index 69156114..3bca9c02 100644
--- a/src/imports/controls/ComboBox.qml
+++ b/src/imports/controls/ComboBox.qml
@@ -55,7 +55,8 @@ T.ComboBox {
delegate: ItemDelegate {
width: parent.width
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
- palette.text: control.highlightedIndex === index ? control.palette.highlightedText : control.palette.text
+ palette.text: control.palette.text
+ palette.highlightedText: control.palette.highlightedText
font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal
highlighted: control.highlightedIndex === index
hoverEnabled: control.hoverEnabled
diff --git a/src/imports/controls/ItemDelegate.qml b/src/imports/controls/ItemDelegate.qml
index 8cc12cab..6229e2bb 100644
--- a/src/imports/controls/ItemDelegate.qml
+++ b/src/imports/controls/ItemDelegate.qml
@@ -64,7 +64,7 @@ T.ItemDelegate {
icon: control.icon
text: control.text
font: control.font
- color: control.palette.text
+ color: control.highlighted ? control.palette.highlightedText : control.palette.text
}
background: Rectangle {
diff --git a/src/imports/controls/qquickdefaulttheme.cpp b/src/imports/controls/qquickdefaulttheme.cpp
index bc292c2f..26fb2a2f 100644
--- a/src/imports/controls/qquickdefaulttheme.cpp
+++ b/src/imports/controls/qquickdefaulttheme.cpp
@@ -60,7 +60,7 @@ void QQuickDefaultTheme::initialize(QQuickTheme *theme)
systemPalette.setColor(QPalette::Highlight, QColor::fromRgba(0xFF0066FF));
systemPalette.setColor(QPalette::Disabled, QPalette::Highlight, QColor::fromRgba(0xFFF0F6FF));
- systemPalette.setColor(QPalette::HighlightedText, QColor::fromRgba(0xFFFFFFFF));
+ systemPalette.setColor(QPalette::HighlightedText, QColor::fromRgba(0xFF090909));
systemPalette.setColor(QPalette::Light, QColor::fromRgba(0xFFF6F6F6));