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

Method updateMagnificationWindow

src/frontend/datapicker/DatapickerImageView.cpp:563–590  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

561}
562
563void DatapickerImageView::updateMagnificationWindow() {
564 m_image->m_magnificationWindow->setVisible(false);
565 QPointF pos = mapToScene(mapFromGlobal(QCursor::pos()));
566
567 // copy the part of the view to be shown magnified
568 const int size = Worksheet::convertToSceneUnits(2.0, Worksheet::Unit::Centimeter) / transform().m11();
569 const QRectF copyRect(pos.x() - size / (2 * magnificationFactor),
570 pos.y() - size / (2 * magnificationFactor),
571 size / magnificationFactor,
572 size / magnificationFactor);
573 QPixmap px = grab(mapFromScene(copyRect).boundingRect());
574 px = px.scaled(size, size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
575
576 // draw the bounding rect
577 QPainter painter(&px);
578 const QPen pen = QPen(Qt::lightGray, 2 / transform().m11());
579 painter.setPen(pen);
580 QRect rect = px.rect();
581 rect.setWidth(rect.width() - pen.widthF() / 2);
582 rect.setHeight(rect.height() - pen.widthF() / 2);
583 painter.drawRect(rect);
584
585 // set the pixmap
586 m_image->m_magnificationWindow->setPixmap(px);
587 m_image->m_magnificationWindow->setPos(pos.x() - px.width() / 2, pos.y() - px.height() / 2);
588
589 m_image->m_magnificationWindow->setVisible(true);
590}
591
592void DatapickerImageView::contextMenuEvent(QContextMenuEvent*) {
593 // no need to propagate the event to the scene and graphics items

Callers

nothing calls this directly

Calls 11

xMethod · 0.80
setPenMethod · 0.80
rectMethod · 0.80
setHeightMethod · 0.80
heightMethod · 0.80
QPenClass · 0.50
setVisibleMethod · 0.45
yMethod · 0.45
boundingRectMethod · 0.45
setWidthMethod · 0.45
widthMethod · 0.45

Tested by

no test coverage detected