Fix selection flickering when expanding folder.

This commit is contained in:
2026-02-07 11:16:57 -05:00
parent ff1b5ab2e6
commit 4aad91416e

View File

@@ -57,14 +57,8 @@ TreeView {
indentation: 12
background: Rectangle {
color: "transparent"
color: current ? RustColors.explorer_text_selected : "transparent"
radius: 2.5
Behavior on color {
ColorAnimation {
duration: 300
}
}
}
contentItem: Text {
color: RustColors.explorer_text
@@ -105,7 +99,6 @@ TreeView {
const isFile = !treeDelegate.hasChildren;
if (isFile)
return Qt.lighter(RustColors.explorer_folder, 2);
const isExpandedFolder = treeDelegate.expanded && treeDelegate.hasChildren;
if (isExpandedFolder)
return Qt.darker(RustColors.explorer_folder, 2);
@@ -125,12 +118,14 @@ TreeView {
onSingleTapped: (eventPoint, button) => {
switch (button) {
case Qt.LeftButton:
if (treeDelegate.hasChildren) {
fileSystemTreeView.toggleExpanded(treeDelegate.row);
fileSystemTreeView.lastIndex = treeDelegate.index
// fileSystemTreeView.lastIndex = treeDelegate.index
} else {
// If this model item doesn't have children, it means it's
// representing a file.
if (!treeDelegate.hasChildren)
fileSystemTreeView.fileClicked(treeDelegate.filePath);
}
break;
case Qt.RightButton:
contextMenu.popup();
@@ -160,4 +155,6 @@ TreeView {
}
}
}
selectionModel: ItemSelectionModel {
}
}