ex image # QTreeView - QFileSystemModel 我无法在我正在使用的目录(当前)中突出显示(样式)。仅在整个 qtreeview 中应用样式
self.dirModel = QtWidgets.QFileSystemModel()
self.model = QtWidgets.QFileSystemModel()
self.tree = QtWidgets.QTreeView()
self.listview = QtWidgets.QListView()
path = user_dir
self.model.setNameFilters(["*.py", "*.trp"])
#self.model.filter()
self.model.setNameFilterDisables(False)
self.model.setRootPath(QtCore.QDir.rootPath())
self.tree.setModel(self.model)
self.tree.setRootIndex(self.model.index(path))
self.tree.setStyleSheet("background-color: yellow")