MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / updateScrollbar

Function updateScrollbar

src/openms_gui/source/VISUAL/PlotWidget.cpp:221–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219 }
220
221 void updateScrollbar(QScrollBar* scroll, float f_min, float disp_min, float disp_max, float f_max)
222 {
223 if ((disp_min == f_min && disp_max == f_max) || (disp_min < f_min && disp_max > f_max))
224 {
225 scroll->hide();
226 }
227 else
228 {
229 // block signals as this causes repainting due to rounding (QScrollBar works with int ...)
230 auto local_min = min(f_min, disp_min);
231 auto local_max = max(f_max, disp_max);
232 auto vis_span = disp_max - disp_min;
233 scroll->blockSignals(true);
234 //scroll->setMinimum(static_cast<int>(local_min));
235 //scroll->setMaximum(static_cast<int>(std::ceil(local_max - disp_max + disp_min)));
236 scroll->setRange(int(local_min), int(std::ceil(local_max - vis_span)));
237 scroll->setValue(int(disp_min)); // emits valueChanged, which will call this function here unless signal is blocked
238 scroll->setPageStep(vis_span);
239 scroll->blockSignals(false);
240 scroll->show();
241 }
242 }
243
244 void PlotWidget::updateHScrollbar(float f_min, float disp_min, float disp_max, float f_max)
245 {

Callers 2

updateHScrollbarMethod · 0.85
updateVScrollbarMethod · 0.85

Calls 3

showMethod · 0.80
setRangeMethod · 0.45
setValueMethod · 0.45

Tested by

no test coverage detected