From 06748e9f9f0fb27d8d742e423c9d7439e7ecc240 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 26 Jul 2017 11:54:48 -0600 Subject: Hover support via Controls2.Control --- framework/qml/TreeView.qml | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/framework/qml/TreeView.qml b/framework/qml/TreeView.qml index 5434e366..ab3367bb 100644 --- a/framework/qml/TreeView.qml +++ b/framework/qml/TreeView.qml @@ -160,26 +160,32 @@ FocusScope { headerVisible: false style: TreeViewStyle { - rowDelegate: Rectangle { + rowDelegate: Controls2.Control { + id: delegateRoot //FIXME Uses internal API to get to the model index property bool isActive: root.activeIndex === treeView.__model.mapRowToModelIndex(styleData.row) - height: Kube.Units.gridUnit * 1.5 //FIXME This is the only way I could find to get the correct width. parent.width is way to wide width: parent.parent.parent ? parent.parent.parent.width : 0 - color: Kube.Colors.textColor - + focus: false + hoverEnabled: true Rectangle { anchors.fill: parent - color: Kube.Colors.highlightColor - visible: isActive - } - Rectangle { - anchors.fill: parent - border.width: 2 - border.color: Kube.Colors.focusedButtonColor - color: "transparent" - visible: styleData.selected + + color: Kube.Colors.textColor + + Rectangle { + anchors.fill: parent + color: Kube.Colors.highlightColor + visible: isActive + } + Rectangle { + anchors.fill: parent + border.width: 2 + border.color: Kube.Colors.focusedButtonColor + color: "transparent" + visible: styleData.selected || delegateRoot.hovered + } } } -- cgit v1.2.3