You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
888 B
18 lines
888 B
#include "scrollview.hpp"
|
|
|
|
ScrollView::ScrollView(QWidget *w, QWidget *parent) : QScrollArea(parent){
|
|
setWidget(w);
|
|
setWidgetResizable(true);
|
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
setStyleSheet("background-color:transparent;");
|
|
|
|
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);
|
|
}
|
|
|