Verified Commit 939d249b authored by Carl Schwan's avatar Carl Schwan 🚴
Browse files

Fix keyboard navigation in TreeView



Make it consistent with QtWidgets
Signed-off-by: Carl Schwan's avatarCarl Schwan <carl@carlschwan.eu>
parent 574157ab
Pipeline #100960 passed with stage
in 5 minutes and 22 seconds
......@@ -50,11 +50,28 @@ Kirigami.AbstractListItem {
}
]
onDoubleClicked: {
if (kDescendantExpandable) {
decoration.model.toggleChildren(index);
Keys.onLeftPressed: if (kDescendantExpandable && kDescendantExpanded) {
decoration.model.collapseChildren(index);
} else if (!kDescendantExpandable && kDescendantLevel > 0) {
if (delegate.ListView.view) {
const sourceIndex = decoration.model.mapToSource(decoration.model.index(index, 0));
const newIndex = decoration.model.mapFromSource(sourceIndex.parent);
delegate.ListView.view.currentIndex = newIndex.row;
}
}
Keys.onRightPressed: if (kDescendantExpandable) {
if (kDescendantExpanded && delegate.ListView.view) {
ListView.view.incrementCurrentIndex();
} else {
decoration.model.expandChildren(index);
}
}
onDoubleClicked: if (kDescendantExpandable) {
decoration.model.toggleChildren(index);
}
// FIXME: it should probably use leftInset property but Kirigami.AbstractListItem doesn't have it because can't import QQC2 more than 2.0
background.anchors {
left: delegate.left
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment