OK, noticed that it was not ideal solution the focusInEvent.
If user would scroll with mouse wheel few pages, then clicked to select something, the selection would roll up to the first page.
This seems to be the better choice, as it excludes all -1 rows, which I get when mouse click is used, which selects rows anyway
def focusInEvent(self, event):
row = self.currentIndex().row()
if row != -1:
self.selectRow(row)
def focusInEvent(self, event):
Qw.QTableView.focusInEvent(self, event)
row = self.currentIndex().row()
if row != -1:
self.selectRow(row)
To copy to clipboard, switch view to plain text mode
I am not sure what I was trying to fix with -1 in my first post code, I now get -1 only when using mouse to select item from list, but I think I was getting it when I was using tab key and on first focus of the tableview, is it possible that some change in Qt code happened with some update? Anyway juts posting here, cause I forget and will look for stuff I did in few months...
Bookmarks