From 9e4748db8bca27b6909d03bc87d2d309636b5c11 Mon Sep 17 00:00:00 2001 From: iejMac <61431446+iejMac@users.noreply.github.com> Date: Mon, 5 Apr 2021 14:27:14 -0700 Subject: [PATCH] text window starts scrolling at bottom (#20587) * text starts scrolling at bottom * comment --- selfdrive/ui/qt/text.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/selfdrive/ui/qt/text.cc b/selfdrive/ui/qt/text.cc index d613ee6e9e..994741a26a 100644 --- a/selfdrive/ui/qt/text.cc +++ b/selfdrive/ui/qt/text.cc @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -23,6 +24,11 @@ int main(int argc, char *argv[]) { scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); layout->addWidget(scroll, 0, 0, Qt::AlignTop); + // Scroll to the bottom + QObject::connect(scroll->verticalScrollBar(), &QAbstractSlider::rangeChanged, [=](){ + scroll->verticalScrollBar()->setValue(scroll->verticalScrollBar()->maximum()); + }); + QPushButton *btn = new QPushButton(); #ifdef __aarch64__ btn->setText("Reboot");