summaryrefslogtreecommitdiffstats
path: root/framework/qml/TreeView.qml
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-07-26 11:54:48 -0600
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-07-26 11:54:48 -0600
commit06748e9f9f0fb27d8d742e423c9d7439e7ecc240 (patch)
tree110e9ad86a79ea0a9e7d9b7f6493e1b31374865a /framework/qml/TreeView.qml
parent91431d3694ab6823717eb6b43b669dae87c6d3d6 (diff)
downloadkube-06748e9f9f0fb27d8d742e423c9d7439e7ecc240.tar.gz
kube-06748e9f9f0fb27d8d742e423c9d7439e7ecc240.zip
Hover support via Controls2.Control
Diffstat (limited to 'framework/qml/TreeView.qml')
-rw-r--r--framework/qml/TreeView.qml32
1 files 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 {
160 headerVisible: false 160 headerVisible: false
161 161
162 style: TreeViewStyle { 162 style: TreeViewStyle {
163 rowDelegate: Rectangle { 163 rowDelegate: Controls2.Control {
164 id: delegateRoot
164 //FIXME Uses internal API to get to the model index 165 //FIXME Uses internal API to get to the model index
165 property bool isActive: root.activeIndex === treeView.__model.mapRowToModelIndex(styleData.row) 166 property bool isActive: root.activeIndex === treeView.__model.mapRowToModelIndex(styleData.row)
166
167 height: Kube.Units.gridUnit * 1.5 167 height: Kube.Units.gridUnit * 1.5
168 //FIXME This is the only way I could find to get the correct width. parent.width is way to wide 168 //FIXME This is the only way I could find to get the correct width. parent.width is way to wide
169 width: parent.parent.parent ? parent.parent.parent.width : 0 169 width: parent.parent.parent ? parent.parent.parent.width : 0
170 color: Kube.Colors.textColor 170 focus: false
171 171 hoverEnabled: true
172 Rectangle { 172 Rectangle {
173 anchors.fill: parent 173 anchors.fill: parent
174 color: Kube.Colors.highlightColor 174
175 visible: isActive 175 color: Kube.Colors.textColor
176 } 176
177 Rectangle { 177 Rectangle {
178 anchors.fill: parent 178 anchors.fill: parent
179 border.width: 2 179 color: Kube.Colors.highlightColor
180 border.color: Kube.Colors.focusedButtonColor 180 visible: isActive
181 color: "transparent" 181 }
182 visible: styleData.selected 182 Rectangle {
183 anchors.fill: parent
184 border.width: 2
185 border.color: Kube.Colors.focusedButtonColor
186 color: "transparent"
187 visible: styleData.selected || delegateRoot.hovered
188 }
183 } 189 }
184 } 190 }
185 191