diff options
author | Jens Bache-Wiig <jens.bache-wiig@digia.com> | 2013-05-28 13:14:15 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-29 12:36:32 +0200 |
commit | c6389d78fc51fb404043848f5d7da2d4e3e19599 (patch) | |
tree | fe3530f539f300819616a5dc556efa543e179bd9 | |
parent | 158fe2a0c551f7aaeaa07bdbb0096bee0ade0fdf (diff) | |
download | qtquickcontrols-c6389d78fc51fb404043848f5d7da2d4e3e19599.tar.gz |
Move backgroundColor from TableView to TableViewStyle
This property was not respected by some of the native styles
and makes more sense as a styling attribute.
Change-Id: I9cc1d3a130b764a67552ed7f0cec49ccc87ea246
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
-rw-r--r-- | src/controls/TableView.qml | 8 | ||||
-rw-r--r-- | src/styles/Base/TableViewStyle.qml | 20 | ||||
-rw-r--r-- | src/styles/Desktop/TableViewStyle.qml | 5 |
3 files changed, 23 insertions, 10 deletions
diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index 93d75e92..d0417bfa 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -161,12 +161,6 @@ ScrollView { */ property Component rowDelegate: __style ? __style.rowDelegate : null - /*! \qmlproperty color TableView::backgroundColor - - This property sets the background color of the viewport. - The default value is the base color of the SystemPalette. */ - property alias backgroundColor: colorRect.color - /*! This property defines a delegate to draw a header. In the header delegate you have access to the following special properties: @@ -404,7 +398,7 @@ ScrollView { id: colorRect parent: viewport anchors.fill: parent - color: palette.base + color: __style ? __style.backgroundColor : palette.base z: -1 } diff --git a/src/styles/Base/TableViewStyle.qml b/src/styles/Base/TableViewStyle.qml index b53b3c64..a7b3ba49 100644 --- a/src/styles/Base/TableViewStyle.qml +++ b/src/styles/Base/TableViewStyle.qml @@ -59,7 +59,13 @@ ScrollViewStyle { /*! The text color. */ property color textColor: __syspal.text - /*! The text highlight color, used behind selections. */ + /*! The background color. */ + property color backgroundColor: __syspal.base + + /*! The alternate background color. */ + property color alternateBackgroundColor: Qt.darker(__syspal.base, 1.06) + + /*! The text highlight color, used within selections. */ property color highlightedTextColor: "white" /*! Activates items on single click. */ @@ -96,8 +102,16 @@ ScrollViewStyle { height: 20 property color selectedColor: styleData.hasActiveFocus ? "#38d" : "#999" gradient: Gradient { - GradientStop { color: styleData.selected ? Qt.lighter(selectedColor, 1.3) : styleData.alternate ? "#f2f2f2" : "white" ; position: 0 } - GradientStop { color: styleData.selected ? Qt.lighter(selectedColor, 1.0) : styleData.alternate ? "#f2f2f2" : "white" ; position: 1 } + GradientStop { + color: styleData.selected ? Qt.lighter(selectedColor, 1.3) : + styleData.alternate ? alternateBackgroundColor : backgroundColor + position: 0 + } + GradientStop { + color: styleData.selected ? Qt.lighter(selectedColor, 1.0) : + styleData.alternate ? alternateBackgroundColor : backgroundColor + position: 1 + } } Rectangle { anchors.bottom: parent.bottom diff --git a/src/styles/Desktop/TableViewStyle.qml b/src/styles/Desktop/TableViewStyle.qml index 9a3584d2..97dfcd5c 100644 --- a/src/styles/Desktop/TableViewStyle.qml +++ b/src/styles/Desktop/TableViewStyle.qml @@ -44,9 +44,14 @@ import QtQuick.Controls.Private 1.0 ScrollViewStyle { id: root + property var __syspal: SystemPalette { + colorGroup: control.enabled ? + SystemPalette.Active : SystemPalette.Disabled + } readonly property TableView control: __control property bool activateItemOnSingleClick: __styleitem.styleHint("activateItemOnSingleClick") property color textColor: __styleitem.textColor + property color backgroundColor: __syspal.base property color highlightedTextColor: __styleitem.highlightedTextColor property StyleItem __styleitem: StyleItem{ |