mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-07-11 16:02:06 +08:00
text window starts scrolling at bottom (#20587)
* text starts scrolling at bottom * comment
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <QLabel>
|
||||
#include <QWidget>
|
||||
#include <QScrollBar>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <QApplication>
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user