diff options
Diffstat (limited to 'src/styles/Desktop/TableViewStyle.qml')
-rw-r--r-- | src/styles/Desktop/TableViewStyle.qml | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/src/styles/Desktop/TableViewStyle.qml b/src/styles/Desktop/TableViewStyle.qml index da6a47e5..171678a3 100644 --- a/src/styles/Desktop/TableViewStyle.qml +++ b/src/styles/Desktop/TableViewStyle.qml @@ -44,10 +44,15 @@ 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.styleHint("textColor") - property color highlightedTextColor: __styleitem.styleHint("highlightedTextColor") + property color textColor: __styleitem.textColor + property color backgroundColor: __syspal.base + property color highlightedTextColor: __styleitem.highlightedTextColor property StyleItem __styleitem: StyleItem{ property color textColor: styleHint("textColor") @@ -55,50 +60,59 @@ ScrollViewStyle { elementType: "item" visible: false active: control.activeFocus + onActiveChanged: { + highlightedTextColor = styleHint("highlightedTextColor") + textColor = styleHint("textColor") + } } property Component headerDelegate: StyleItem { elementType: "header" activeControl: itemSort raised: true - sunken: itemPressed - text: itemValue - hover: itemContainsMouse - hints: itemPosition + sunken: styleData.pressed + text: styleData.value + hover: styleData.containsMouse + hints: control.styleHints + properties: {"headerpos": headerPosition} + property string itemSort: (control.sortIndicatorVisible && styleData.column === control.sortIndicatorColumn) ? (control.sortIndicatorOrder == Qt.AscendingOrder ? "up" : "down") : ""; + property string headerPosition: control.columnCount === 1 ? "only" : + styleData.column === control.columnCount-1 ? "end" : + styleData.column === 0 ? "beginning" : "" } property Component rowDelegate: StyleItem { id: rowstyle elementType: "itemrow" - activeControl: alternateBackground ? "alternate" : "" - selected: rowSelected ? true : false + activeControl: styleData.alternate ? "alternate" : "" + selected: styleData.selected ? true : false height: Math.max(16, rowstyle.implicitHeight) - active: hasActiveFocus + active: styleData.hasActiveFocus } property Component itemDelegate: Item { height: Math.max(16, label.implicitHeight) - property int implicitWidth: sizehint.paintedWidth + 4 + property int implicitWidth: sizehint.paintedWidth + 16 Text { id: label objectName: "label" width: parent.width - anchors.margins: 6 + anchors.leftMargin: 8 font: __styleitem.font anchors.left: parent.left anchors.right: parent.right - horizontalAlignment: itemTextAlignment + horizontalAlignment: styleData.textAlignment anchors.verticalCenter: parent.verticalCenter - elide: itemElideMode - text: itemValue != undefined ? itemValue : "" - color: itemTextColor + elide: styleData.elideMode + text: styleData.value !== undefined ? styleData.value : "" + color: styleData.textColor renderType: Text.NativeRendering } Text { id: sizehint font: label.font - text: itemValue ? itemValue : "" + text: styleData.value ? styleData.value : "" visible: false } } |