This is what I have tried:

Qt Code:
  1. import QtQuick 2.2
  2. import QtQuick.Controls 1.5
  3. import QtQuick.Controls.Styles 1.4
  4. import QtQml.Models 2.2
  5. import filesystem_browser 1.0
  6.  
  7. ApplicationWindow
  8. {
  9. visible: true
  10. width: 740
  11. height: 740
  12.  
  13. Rectangle
  14. {
  15. anchors.centerIn: parent
  16. color: "#292A38"
  17. border.color: "#373848"
  18. height: 600; width: 600
  19.  
  20. ItemSelectionModel
  21. {
  22. // This model is comming from C++' class DisplayFileSystemModel.
  23. model: treeViewModel
  24. }
  25.  
  26. TreeView
  27. {
  28. id: view
  29. anchors.fill: parent
  30. anchors.margins: 2 * 12
  31. model: treeViewModel
  32. rootIndex: root
  33. selection:
  34. ItemSelectionModel
  35. {
  36. model: treeViewModel
  37.  
  38. onSelectionChanged:
  39. {
  40. console.log( treeViewModel.data( view.currentIndex ))
  41. }
  42. }
  43.  
  44. style:
  45. TreeViewStyle
  46. {
  47. backgroundColor: "#14161C"
  48. highlightedTextColor: "red"
  49. alternateBackgroundColor: "#14161C"
  50. }
  51.  
  52. TableViewColumn
  53. {
  54. title: "Name"
  55. role: "display"
  56. resizable: true
  57. }
  58.  
  59. itemDelegate:
  60. Rectangle
  61. {
  62. height: 20
  63.  
  64. color: styleData.selected ? "gray" : "transparent"
  65. Rectangle
  66. {
  67. visible:
  68. {
  69. if( styleData.depth )
  70. styleData.selected ? true :false
  71. else
  72. false
  73. }
  74. height: 20; width: 40; color: styleData.depth ? "#292A38":"transparent";
  75. anchors.right: parent.right
  76. border.width: 1
  77. }
  78.  
  79. Text
  80. {
  81. color:
  82. {
  83. if( styleData.depth )
  84. styleData.selected ? "green" : "black"
  85. else
  86. "blue"
  87. }
  88. anchors.verticalCenter: parent.verticalCenter
  89. text: styleData.value
  90. }
  91. }
  92. }
  93. }
  94. }
To copy to clipboard, switch view to plain text mode 

It gives me the output shown in the attached picture:
As you can see the default blue color of the selected row is still there.
Screenshot from 2021-01-05 19-35-26.png

The default of color of the selected row seems to be blue. How to get rid of it and override it with some other color completely? Please guide