MCPcopy Create free account
hub / github.com/KDE/labplot / exportPaint

Method exportPaint

src/frontend/worksheet/WorksheetView.cpp:2287–2317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2285}
2286
2287void WorksheetView::exportPaint(QPainter* painter, const QRectF& targetRect, const QRectF& sourceRect, const bool background, const bool selection) {
2288 // hide the magnification window, shouldn't be exported
2289 bool magnificationActive = false;
2290 if (m_magnificationWindow && m_magnificationWindow->isVisible()) {
2291 magnificationActive = true;
2292 m_magnificationWindow->setVisible(false);
2293 }
2294
2295 // draw the background
2296 m_isPrinting = true;
2297 if (background) {
2298 painter->save();
2299 const qreal scaleX = targetRect.width() / sourceRect.width();
2300 const qreal scaleY = targetRect.height() / sourceRect.height();
2301 painter->scale(scaleX, scaleY);
2302 drawBackground(painter, targetRect);
2303 painter->restore();
2304 }
2305
2306 // draw the scene items
2307 if (!selection) // if no selection effects have to be exported, set the printing flag to suppress it in the paint()'s of the children
2308 m_worksheet->setPrinting(true);
2309 scene()->render(painter, QRectF(), sourceRect, Qt::IgnoreAspectRatio);
2310 if (!selection)
2311 m_worksheet->setPrinting(false);
2312 m_isPrinting = false;
2313
2314 // show the magnification window if it was active before
2315 if (magnificationActive)
2316 m_magnificationWindow->setVisible(true);
2317}
2318
2319void WorksheetView::print(QPrinter* printer) {
2320 m_isPrinting = true;

Callers

nothing calls this directly

Calls 9

QRectFClass · 0.85
heightMethod · 0.80
renderMethod · 0.80
isVisibleMethod · 0.45
setVisibleMethod · 0.45
saveMethod · 0.45
widthMethod · 0.45
scaleMethod · 0.45
setPrintingMethod · 0.45

Tested by

no test coverage detected