| 2209 | } |
| 2210 | |
| 2211 | void 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 | |
| 2228 | bool WorksheetView::eventFilter(QObject* /*watched*/, QEvent* event) { |
| 2229 | if (event->type() == QEvent::KeyPress && m_actionsInitialized) { |
no test coverage detected