I'm having this problem with scrolling to the bottom of my QTableWidget.
I want the scroll bar to stay at the bottom as the table grows if the scroll bar is at the bottom to begin with.
But when I call scrollToBottom(), the scroll bar moves only to the beginning of the last row inserted which is not always necessarily the bottom of the table because sometimes the height of the last row inserted is really large, how can I make the scroll bar move all the way to the bottom and not scroll to the last row in the table?
here's my code:
int max_slider_pos = table->verticalScrollBar()->maximum();
bool move_slider_to_bottom = false;
if(table->verticalScrollBar()->sliderPosition() == max_slider_pos)
{
move_slider_to_bottom = true;
}
// insert new row here
table->resizeRowsToContents();
table->resizeColumnsToContents();
if(move_slider_to_bottom)
{
table->scrollToBottom();
}
Thanks for the help!
Bookmarks