MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / setZoomRectangle

Method setZoomRectangle

pj_plotting/widget/src/PlotWidget.cpp:299–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299void PlotWidget::setZoomRectangle(QRectF rect, bool emit_signal) {
300 if (isXYPlot() && keepRatioXY()) {
301 // Every programmatic "return to original zoom" funnels through here
302 // (zoomOut, the H/V zoom-outs, XML restore). We keep the requested zoom
303 // level (PJ3 re-fits to the data extent) and re-impose the canvas aspect
304 // ratio so the XY shape stays 1:1.
305 applyRectKeepingRatio(rect);
306 } else {
307 setAxisScale(QwtPlot::yLeft, rect.bottom(), rect.top());
308 setAxisScale(QwtPlot::xBottom, rect.left(), rect.right());
309 qwtPlot()->updateAxes();
310 }
311
312 if (emit_signal) {
313 if (isXYPlot()) {
314 emit undoableChange();
315 } else {
316 emit rectChanged(this, rect);
317 }
318 }
319}
320
321bool PlotWidget::isZoomLinkEnabled() const noexcept {
322 return true;

Callers 3

TESTFunction · 0.80
onPlotZoomChangedMethod · 0.80
linkedZoomOutMethod · 0.80

Calls 1

updateAxesMethod · 0.80

Tested by 1

TESTFunction · 0.64