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

Method print

src/frontend/worksheet/WorksheetView.cpp:2319–2344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2317}
2318
2319void WorksheetView::print(QPrinter* printer) {
2320 m_isPrinting = true;
2321 m_worksheet->setPrinting(true);
2322 bool magnificationActive = false;
2323 if (m_magnificationWindow && m_magnificationWindow->isVisible()) {
2324 magnificationActive = true;
2325 m_magnificationWindow->setVisible(false);
2326 }
2327
2328 QPainter painter(printer);
2329 painter.setRenderHint(QPainter::Antialiasing);
2330
2331 // draw background
2332 const auto& page_rect = printer->pageLayout().paintRectPixels(printer->resolution());
2333 const auto& scene_rect = scene()->sceneRect();
2334 float scale = std::max(scene_rect.width() / page_rect.width(), scene_rect.height() / page_rect.height());
2335 drawBackgroundItems(&painter, QRectF(0, 0, scene_rect.width() / scale, scene_rect.height() / scale));
2336
2337 // draw scene
2338 scene()->render(&painter);
2339 m_worksheet->setPrinting(false);
2340 m_isPrinting = false;
2341
2342 if (magnificationActive)
2343 m_magnificationWindow->setVisible(true);
2344}
2345
2346void WorksheetView::updateBackground() {
2347 invalidateScene(sceneRect(), QGraphicsScene::BackgroundLayer);

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected