ModelView Autoselection

Anyone manage to get the autoselection working? I’ve been reading the document in qt official website, but could not find a direct explanation on how to do it. I manage to get auto-selection works, but it involves creating a QRect. I don’t think that’s the correct way.

1 Like

Hi Mohamad,

You can get select by replacing the


part with the following:

lastindex = self.model.index(len(self.model.todos)-1, 0)

This will first get the last index as a QModelIndex from the model itself by specifying the last row (length - 1) and column 0 and then setting that index as the current index in the todoView.

Hope this helps!


Thank you very much! I also had the same question and couldn’t find enough information using web searches to figure it out. This is very helpful!