| 297 | } |
| 298 | |
| 299 | void 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 | |
| 321 | bool PlotWidget::isZoomLinkEnabled() const noexcept { |
| 322 | return true; |