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

Method exportToPixmap

src/frontend/worksheet/WorksheetView.cpp:2211–2226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2209}
2210
2211void WorksheetView::exportToPixmap(QPixmap& pixmap) {
2212 const auto& sourceRect = scene()->sceneRect();
2213
2214 int w = Worksheet::convertFromSceneUnits(sourceRect.width(), Worksheet::Unit::Millimeter);
2215 int h = Worksheet::convertFromSceneUnits(sourceRect.height(), Worksheet::Unit::Millimeter);
2216 w = w * GuiTools::dpi(this).first / (GSL_CONST_CGS_INCH * Worksheet::convertToSceneUnits(1, Worksheet::Unit::Millimeter));
2217 h = h * GuiTools::dpi(this).second / (GSL_CONST_CGS_INCH * Worksheet::convertToSceneUnits(1, Worksheet::Unit::Millimeter));
2218 pixmap = pixmap.scaled(w, h);
2219 QRectF targetRect(0, 0, w, h);
2220
2221 QPainter painter;
2222 painter.begin(&pixmap);
2223 painter.setRenderHint(QPainter::Antialiasing);
2224 exportPaint(&painter, targetRect, sourceRect, true /* export background */, true /* export selection */);
2225 painter.end();
2226}
2227
2228bool WorksheetView::eventFilter(QObject* /*watched*/, QEvent* event) {
2229 if (event->type() == QEvent::KeyPress && m_actionsInitialized) {

Callers 1

exportViewMethod · 0.80

Calls 4

heightMethod · 0.80
widthMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected