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

Method drawBackground

src/frontend/datapicker/DatapickerImageView.cpp:327–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327void DatapickerImageView::drawBackground(QPainter* painter, const QRectF& rect) {
328 painter->save();
329
330 QRectF scene_rect = sceneRect();
331 if (!scene_rect.contains(rect))
332 painter->fillRect(rect, Qt::lightGray);
333
334 // canvas
335 if (m_image->isLoaded) {
336 if (m_image->plotImageType() == DatapickerImage::PlotImageType::OriginalImage) {
337 const QImage& todraw = m_image->originalPlotImage.scaled(scene_rect.width(), scene_rect.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
338 painter->drawImage(scene_rect.topLeft(), todraw);
339 } else if (m_image->plotImageType() == DatapickerImage::PlotImageType::ProcessedImage) {
340 const QImage& todraw = m_image->processedPlotImage.scaled(scene_rect.width(), scene_rect.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
341 painter->drawImage(scene_rect.topLeft(), todraw);
342 } else {
343 painter->fillRect(scene_rect, Qt::white);
344 }
345 } else {
346 painter->setBrush(QBrush(Qt::gray));
347 painter->drawRect(scene_rect);
348 }
349
350 invalidateScene(rect, QGraphicsScene::BackgroundLayer);
351 painter->restore();
352}
353
354// ##############################################################################
355// #################################### Events ###############################

Callers

nothing calls this directly

Calls 7

plotImageTypeMethod · 0.80
heightMethod · 0.80
setBrushMethod · 0.80
QBrushClass · 0.50
saveMethod · 0.45
containsMethod · 0.45
widthMethod · 0.45

Tested by

no test coverage detected