MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / update_scroll

Method update_scroll

DSView/pv/view/view.cpp:605–640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

603}
604
605void View::update_scroll()
606{
607 assert(_viewcenter);
608
609 int width = get_view_width();
610 if (width == 0){
611 return;
612 }
613
614 const QSize areaSize = QSize(width, get_view_height());
615
616 // Set the horizontal scroll bar
617 int64_t length = 0;
618 int64_t offset = 0;
619 get_scroll_layout(length, offset);
620 length = max(length - areaSize.width(), (int64_t)0);
621
622 horizontalScrollBar()->setPageStep(areaSize.width() / 2);
623
624 _updating_scroll = true;
625
626 if (length < MaxScrollValue) {
627 horizontalScrollBar()->setRange(0, length);
628 horizontalScrollBar()->setSliderPosition(offset);
629 } else {
630 horizontalScrollBar()->setRange(0, MaxScrollValue);
631 horizontalScrollBar()->setSliderPosition(
632 _offset * 1.0 / length * MaxScrollValue);
633 }
634
635 _updating_scroll = false;
636
637 // Set the vertical scrollbar
638 verticalScrollBar()->setPageStep(areaSize.height());
639 verticalScrollBar()->setRange(0,0);
640}
641
642void View::update_scale_offset()
643{

Callers

nothing calls this directly

Calls 1

setRangeMethod · 0.80

Tested by

no test coverage detected