Fix selection flickering when expanding folder.
This commit is contained in:
@@ -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:
|
||||
fileSystemTreeView.toggleExpanded(treeDelegate.row);
|
||||
fileSystemTreeView.lastIndex = treeDelegate.index
|
||||
// If this model item doesn't have children, it means it's
|
||||
// representing a file.
|
||||
if (!treeDelegate.hasChildren)
|
||||
if (treeDelegate.hasChildren) {
|
||||
fileSystemTreeView.toggleExpanded(treeDelegate.row);
|
||||
// fileSystemTreeView.lastIndex = treeDelegate.index
|
||||
} else {
|
||||
// If this model item doesn't have children, it means it's
|
||||
// representing a file.
|
||||
fileSystemTreeView.fileClicked(treeDelegate.filePath);
|
||||
}
|
||||
break;
|
||||
case Qt.RightButton:
|
||||
contextMenu.popup();
|
||||
@@ -160,4 +155,6 @@ TreeView {
|
||||
}
|
||||
}
|
||||
}
|
||||
selectionModel: ItemSelectionModel {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user