0

I'm using PyQt5 (Python of course) and I was able to easily find the entry programatically in the combo box. I just passed the string to "findText" method. But I don't see anything in the QTreeView class documentation on how to select one row based on what I know is a file being displayed there. I looked at keyboardSearch() but just now realized that's used when you type letters on the keyboard (duh). I see a setSelection() method that takes a rectangle, but I have no idea how I would know dimensions or coordinates of a rectangle with the selection I want? Especially since I have sorting enabled so the rows can change order.

Any help would be much appreciated!

Justin

Eradicatore
  • 1,501
  • 2
  • 20
  • 38
  • Don't search the view, [search the model](https://doc.qt.io/qt-4.8/qabstractitemmodel.html#match). – ekhumoro Jun 27 '17 at 03:55
  • Thanks! This helped to find this: https://stackoverflow.com/questions/4967660/selecting-a-row-in-qtreeview-programatically which then answered my question. There was also this: https://stackoverflow.com/questions/17912812/how-do-i-select-a-row-in-a-qtreeview-programatically – Eradicatore Jun 28 '17 at 03:37

0 Answers0