I'm having problems with QLabel and QScrollArea. I'm trying to make QScrollArea to scroll automatically, but can't find any information about it..
Firstly, I'm using QLabel inside QScrollArea, then QLineEdit outside from QScrollArea. When I type text in QLineEdit, it writes to QLabel and the new line. Whenever it reaches to end of area, QScrollArea doesn't scroll automatically.. How can I do that?
Thank you.
Can't you use QLineEdit itself instead of Qlabel(if u are using only text)?, so that you dont have to use QScrollArea also.
[edit] What if you set the verticalSlider position to Label->height()
void MainWindow::on_lineEdit_returnPressed()
{
ui->label->setText(ui->label->text() + ui->lineEdit->text() + "\n");
ui->ScrollArea->verticalScrollBar()->setSliderPosition(label->height())
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With