text window starts scrolling at bottom (#20587)

* text starts scrolling at bottom

* comment
pull/20592/head
iejMac 4 years ago committed by GitHub
parent e4d7ee3716
commit 9e4748db8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      selfdrive/ui/qt/text.cc

@ -1,5 +1,6 @@
#include <QLabel> #include <QLabel>
#include <QWidget> #include <QWidget>
#include <QScrollBar>
#include <QPushButton> #include <QPushButton>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QApplication> #include <QApplication>
@ -23,6 +24,11 @@ int main(int argc, char *argv[]) {
scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
layout->addWidget(scroll, 0, 0, Qt::AlignTop); 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(); QPushButton *btn = new QPushButton();
#ifdef __aarch64__ #ifdef __aarch64__
btn->setText("Reboot"); btn->setText("Reboot");

Loading…
Cancel
Save