Qt, how to set text edit scroll bar to the bottom? C++

Aero Chocolate picture Aero Chocolate · Nov 29, 2009 · Viewed 9k times · Source

I have the text edit box as a chat window, but I was wondering if there was a way to set the scroll bar to be at the bottom to show the most updated message.

I am currently using Qt3 and C++.

chat_box->.... I tried looking and was only able to find "ScrollBarMode" but it only lets me turn it on or off or auto... which doesn't really help.

Thanks for the help :D

Answer

scotchi picture scotchi · Nov 29, 2009
textEdit->verticalScrollBar()->setSliderPosition(
    textEdit->verticalScrollBar()->maximum());

Put that after the line where you insert text.