diff options
Diffstat (limited to 'framework/qml/TreeView.qml')
-rw-r--r-- | framework/qml/TreeView.qml | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/framework/qml/TreeView.qml b/framework/qml/TreeView.qml index eb140514..7b9a1103 100644 --- a/framework/qml/TreeView.qml +++ b/framework/qml/TreeView.qml | |||
@@ -36,12 +36,16 @@ FocusScope { | |||
36 | * FIXME: This is what QItemSelectionModel selection vs current selection are for. Try to use that instead. | 36 | * FIXME: This is what QItemSelectionModel selection vs current selection are for. Try to use that instead. |
37 | */ | 37 | */ |
38 | property var activeIndex: null | 38 | property var activeIndex: null |
39 | signal dropped(var drop, var model) | ||
40 | signal activated(var index) | 39 | signal activated(var index) |
41 | onActivated: { | 40 | onActivated: { |
42 | activeIndex = index | 41 | activeIndex = index |
43 | } | 42 | } |
44 | 43 | ||
44 | function indexFromRow(row) { | ||
45 | //FIXME Uses internal API to get to the model index | ||
46 | return treeView.__model.mapRowToModelIndex(row) | ||
47 | } | ||
48 | |||
45 | Flickable { | 49 | Flickable { |
46 | id: flickableItem | 50 | id: flickableItem |
47 | 51 | ||
@@ -115,8 +119,7 @@ FocusScope { | |||
115 | style: TreeViewStyle { | 119 | style: TreeViewStyle { |
116 | rowDelegate: Controls2.Control { | 120 | rowDelegate: Controls2.Control { |
117 | id: delegateRoot | 121 | id: delegateRoot |
118 | //FIXME Uses internal API to get to the model index | 122 | property bool isActive: root.activeIndex === indexFromRow(styleData.row) |
119 | property bool isActive: root.activeIndex === treeView.__model.mapRowToModelIndex(styleData.row) | ||
120 | height: Kube.Units.gridUnit * 1.5 | 123 | height: Kube.Units.gridUnit * 1.5 |
121 | //FIXME This is the only way I could find to get the correct width. parent.width is way to wide | 124 | //FIXME This is the only way I could find to get the correct width. parent.width is way to wide |
122 | width: parent.parent.parent ? parent.parent.parent.width : 0 | 125 | width: parent.parent.parent ? parent.parent.parent.width : 0 |
@@ -145,30 +148,6 @@ FocusScope { | |||
145 | text: styleData.isExpanded ? "-" : "+" | 148 | text: styleData.isExpanded ? "-" : "+" |
146 | } | 149 | } |
147 | 150 | ||
148 | itemDelegate: Item { | ||
149 | DropArea { | ||
150 | anchors.fill: parent | ||
151 | Rectangle { | ||
152 | anchors.fill: parent | ||
153 | color: Kube.Colors.viewBackgroundColor | ||
154 | opacity: 0.3 | ||
155 | visible: parent.containsDrag | ||
156 | } | ||
157 | onDropped: root.dropped(drop, model) | ||
158 | } | ||
159 | |||
160 | Kube.Label { | ||
161 | anchors { | ||
162 | verticalCenter: parent.verticalCenter | ||
163 | left: parent.left | ||
164 | right: parent.right | ||
165 | } | ||
166 | text: styleData.value | ||
167 | elide: Qt.ElideRight | ||
168 | color: Kube.Colors.viewBackgroundColor | ||
169 | } | ||
170 | } | ||
171 | |||
172 | backgroundColor: Kube.Colors.textColor | 151 | backgroundColor: Kube.Colors.textColor |
173 | highlightedTextColor: Kube.Colors.highlightedTextColor | 152 | highlightedTextColor: Kube.Colors.highlightedTextColor |
174 | } | 153 | } |