Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Jumping to a given Index in QTableView
Laurent Schall last edited by
Hello I would like to know if there is a way to jump/scroll/set the focus to a given index in a QTableView.
I have implemented a search and replace functionality. When pushing to the "Replace & Find" button I would like the View to scroll in order to show the next item found in the table.
If someone has an idea.
JonB last edited by JonB
Scrolls the view if necessary to ensure that the item at index is visible. The view will try to position the item according to the given hint.
In the base class this is a pure virtual function.
So you need to implement that yourself.
QTableWidgetdoes something (http://doc.qt.io/qt-5/qtablewidget.html#scrollToItem), so I imagine you need to do similar-ish (you could peek at its code) if you're using your own
QTableView::scrollTo is likely what you want.