I am developing an app in windows using Qt. This app displays a table that contains some data. Depending on the time a certain row is highlighted. The window size of the application is fixed. The number of rows exceed the height of the window, so we have to scroll down to see the whole table. I want to acheive this: when i open the application it should show me that part of the table where the highlighted row is visible. I shouldn't get the need to scroll up or down to search for the highlighted row. But the order of the rows must remain same. How do you do that?
Asked
Active
Viewed 46 times
1 Answers
0
All what you need is to get any item from highlighted row, using for example
QTableWidgetItem * QTableWidget::item ( int row, int column ) const
and then you need to invoke QTableWidget slot
void QTableWidget::scrollToItem ( const QTableWidgetItem * item,
QAbstractItemView::ScrollHint hint = EnsureVisible )
for item which you earlier get.

Blood
- 4,126
- 3
- 27
- 37