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

Method paint

src/backend/worksheet/Image.cpp:298–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298void ImagePrivate::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget*) {
299 painter->save();
300
301 // draw the image
302 painter->setOpacity(opacity);
303 painter->drawImage(m_boundingRectangle.topLeft(), imageScaled, imageScaled.rect());
304 painter->restore();
305
306 // draw the border
307 if (borderLine->style() != Qt::NoPen) {
308 painter->save();
309 painter->setPen(borderLine->pen());
310 painter->setBrush(Qt::NoBrush);
311 painter->setOpacity(borderLine->opacity());
312 painter->drawPath(borderShapePath);
313 painter->restore();
314 }
315
316 const bool selected = isSelected();
317 const bool hovered = (m_hovered && !selected);
318 if ((hovered || selected) && !q->isPrinting()) {
319 static double penWidth = 2.;
320 const QRectF& br = boundingRect();
321 const qreal width = br.width();
322 const qreal height = br.height();
323 const QRectF rect = QRectF(-width / 2 + penWidth / 2, -height / 2 + penWidth / 2, width - penWidth, height - penWidth);
324
325 if (hovered)
326 painter->setPen(QPen(QApplication::palette().color(QPalette::Shadow), penWidth));
327 else
328 painter->setPen(QPen(QApplication::palette().color(QPalette::Highlight), penWidth));
329
330 painter->drawRect(rect);
331 }
332}
333
334// ##############################################################################
335// ################## Serialization/Deserialization ###########################

Callers

nothing calls this directly

Calls 11

QRectFClass · 0.85
rectMethod · 0.80
setPenMethod · 0.80
setBrushMethod · 0.80
isPrintingMethod · 0.80
heightMethod · 0.80
QPenClass · 0.70
saveMethod · 0.45
setOpacityMethod · 0.45
widthMethod · 0.45
colorMethod · 0.45

Tested by

no test coverage detected