I have a QTreeView with a QFileSystemModel and a QListView. I want only one row to be selected either in one of the views. So I need to clear the selection of the opposite view on each selection action.
I have functions for each view to clear the opposite views selection. The problem is while clearing the opposite view, I am also triggering the signal for the opposite view as well even though there is no user interaction with that view. I guess there isn't any signal to separate user interaction like the one in QCheckbox. I appreciate any help on this.
...
self.ListView.currentItemChanged.connect(self.onListViewActivated)
self.TreeView.selectionModel().currentRowChanged.connect(self.onTreeViewActivated)
def onListViewActivated(self):
# do some stuff
self.TreeView.setCurrentIndex(self.model.index(self.rootDirectory))
def onTreeViewActivated(self):
# do some stuff
self.ListView.setCurrentRow(-1)