aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-15 13:11:15 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-15 12:54:54 +0000
commitf56ec245eab24d56800a24f5bc06de1de4f87293 (patch)
treedf215a1bbef35ad919ee328483e83a7d7c5c6b61 /src/imports
parentf066fce2bb2aba6b94b44008877ac8e03b5b1f82 (diff)
ItemDelegate: make the highlight visible against any background
Use a translucent color for the highlight, so that the exact background color doesn't matter. Change-Id: I63348137dedd04aca8110b8f7610506ca003ec87 Task-number: QTBUG-51118 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/controls/material/ItemDelegate.qml2
-rw-r--r--src/imports/controls/material/qquickmaterialstyle.cpp5
-rw-r--r--src/imports/controls/material/qquickmaterialstyle_p.h2
3 files changed, 8 insertions, 1 deletions
diff --git a/src/imports/controls/material/ItemDelegate.qml b/src/imports/controls/material/ItemDelegate.qml
index 8cd53e88..acfbfb98 100644
--- a/src/imports/controls/material/ItemDelegate.qml
+++ b/src/imports/controls/material/ItemDelegate.qml
@@ -148,7 +148,7 @@ T.ItemDelegate {
//! [background]
background: Rectangle {
visible: control.pressed || control.highlighted
- color: control.pressed ? control.Material.flatButtonPressColor : control.Material.backgroundColor
+ color: control.pressed ? control.Material.flatButtonPressColor : control.Material.listHighlightColor
}
//! [background]
}
diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp
index 103db01f..c2e43254 100644
--- a/src/imports/controls/material/qquickmaterialstyle.cpp
+++ b/src/imports/controls/material/qquickmaterialstyle.cpp
@@ -793,6 +793,11 @@ QColor QQuickMaterialStyle::backgroundDimColor() const
return QColor::fromRgba(m_theme == Light ? 0x99303030 : 0x99fafafa);
}
+QColor QQuickMaterialStyle::listHighlightColor() const
+{
+ return QColor::fromRgba(m_theme == Light ? 0x1e000000 : 0x1effffff);
+}
+
QColor QQuickMaterialStyle::color(QQuickMaterialStyle::Color color, QQuickMaterialStyle::Shade shade) const
{
int count = sizeof(colors) / sizeof(colors[0]);
diff --git a/src/imports/controls/material/qquickmaterialstyle_p.h b/src/imports/controls/material/qquickmaterialstyle_p.h
index 67eccb24..f92bfe9d 100644
--- a/src/imports/controls/material/qquickmaterialstyle_p.h
+++ b/src/imports/controls/material/qquickmaterialstyle_p.h
@@ -95,6 +95,7 @@ class QQuickMaterialStyle : public QQuickStyle
Q_PROPERTY(QColor drawerBackgroundColor READ drawerBackgroundColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor dialogColor READ dialogColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor backgroundDimColor READ backgroundDimColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor listHighlightColor READ listHighlightColor NOTIFY paletteChanged FINAL)
public:
enum Theme {
@@ -201,6 +202,7 @@ public:
QColor drawerBackgroundColor() const;
QColor dialogColor() const;
QColor backgroundDimColor() const;
+ QColor listHighlightColor() const;
Q_INVOKABLE QColor color(Color color, Shade shade = Shade500) const;
Q_INVOKABLE QColor shade(const QColor &color, Shade shade) const;