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