MCPcopy Create free account
hub / github.com/CloudCompare/CloudCompare / drawLegendIcon

Method drawLegendIcon

qCC/extern/QCustomPlot/qcustomplot.cpp:21175–21207  ·  view source on GitHub ↗

inherits documentation from base class */

Source from the content-addressed store, hash-verified

21173
21174/* inherits documentation from base class */
21175void QCPGraph::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
21176{
21177 // draw fill:
21178 if (mBrush.style() != Qt::NoBrush)
21179 {
21180 applyFillAntialiasingHint(painter);
21181 painter->fillRect(QRectF(rect.left(), rect.top()+rect.height()/2.0, rect.width(), rect.height()/3.0), mBrush);
21182 }
21183 // draw line vertically centered:
21184 if (mLineStyle != lsNone)
21185 {
21186 applyDefaultAntialiasingHint(painter);
21187 painter->setPen(mPen);
21188 painter->drawLine(QLineF(rect.left(), rect.top()+rect.height()/2.0, rect.right()+5, rect.top()+rect.height()/2.0)); // +5 on x2 else last segment is missing from dashed/dotted pens
21189 }
21190 // draw scatter symbol:
21191 if (!mScatterStyle.isNone())
21192 {
21193 applyScattersAntialiasingHint(painter);
21194 // scale scatter pixmap if it's too large to fit in legend icon rect:
21195 if (mScatterStyle.shape() == QCPScatterStyle::ssPixmap && (mScatterStyle.pixmap().size().width() > rect.width() || mScatterStyle.pixmap().size().height() > rect.height()))
21196 {
21197 QCPScatterStyle scaledStyle(mScatterStyle);
21198 scaledStyle.setPixmap(scaledStyle.pixmap().scaled(rect.size().toSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
21199 scaledStyle.applyTo(painter, mPen);
21200 scaledStyle.drawShape(painter, QRectF(rect).center());
21201 } else
21202 {
21203 mScatterStyle.applyTo(painter, mPen);
21204 mScatterStyle.drawShape(painter, QRectF(rect).center());
21205 }
21206 }
21207}
21208
21209/*! \internal
21210

Callers 1

drawMethod · 0.45

Calls 11

heightMethod · 0.80
widthMethod · 0.80
setPenMethod · 0.80
drawLineMethod · 0.80
setPixmapMethod · 0.80
applyToMethod · 0.80
drawShapeMethod · 0.80
setBrushMethod · 0.80
isNullMethod · 0.80
setAntialiasingMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected