mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-27 06:13:55 +08:00
* cleanup include path
* continue
* format includes
* fix testraw.cc
* remove include path from SConstruct
* regroup
* rebase master
* almost done
* apply review
* rename FileReader.xx to filereader.xx
* rename Unlogger.x->unlogger.x
* rename FrameReader.xx -> framereader.xx
* apply reviews
* ui.h
* continue
* fix framebuffer.cc build error:mv util.h up
* full path to msm_media_info
* fix qcom2 camerad
Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 7222d0f20d
48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
#include "scrollview.h"
|
|
|
|
#include <QScrollBar>
|
|
|
|
ScrollView::ScrollView(QWidget *w, QWidget *parent) : QScrollArea(parent){
|
|
setWidget(w);
|
|
setWidgetResizable(true);
|
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
setStyleSheet("ScrollView { background-color:transparent; }");
|
|
|
|
QString style = R"(
|
|
QScrollBar:vertical {
|
|
border: none;
|
|
background: transparent;
|
|
width:10px;
|
|
margin: 0;
|
|
}
|
|
QScrollBar::handle:vertical {
|
|
min-height: 0px;
|
|
border-radius: 4px;
|
|
background-color: white;
|
|
}
|
|
QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {
|
|
height: 0px;
|
|
}
|
|
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
|
|
background: none;
|
|
}
|
|
)";
|
|
|
|
verticalScrollBar()->setStyleSheet(style);
|
|
horizontalScrollBar()->setStyleSheet(style);
|
|
|
|
QScroller *scroller = QScroller::scroller(this->viewport());
|
|
QScrollerProperties sp = scroller->scrollerProperties();
|
|
|
|
sp.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, QVariant::fromValue<QScrollerProperties::OvershootPolicy>(QScrollerProperties::OvershootAlwaysOff));
|
|
sp.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QVariant::fromValue<QScrollerProperties::OvershootPolicy>(QScrollerProperties::OvershootAlwaysOff));
|
|
|
|
scroller->grabGesture(this->viewport(), QScroller::LeftMouseButtonGesture);
|
|
scroller->setScrollerProperties(sp);
|
|
}
|
|
|
|
void ScrollView::hideEvent(QHideEvent *e){
|
|
verticalScrollBar()->setValue(0);
|
|
}
|