MCPcopy Create free account
hub / github.com/LUX-Core/lux / toPainter

Method toPainter

src/qt/qcustomplot.cpp:15691–15716  ·  view source on GitHub ↗

! Renders the plot using the passed \a painter. The plot is sized to \a width and \a height in pixels. If the \a painter's scale is not 1.0, the resulting plot will appear scaled accordingly. \note If you are restricted to using a QPainter (instead of QCPPainter), create a temporary QPicture and open a QCPPainter on it. Then call \ref toPainter with this QCPPainter. After ending th

Source from the content-addressed store, hash-verified

15689 \see toPixmap
15690*/
15691void QCustomPlot::toPainter(QCPPainter *painter, int width, int height)
15692{
15693 // this method is somewhat similar to toPixmap. Change something here, and a change in toPixmap might be necessary, too.
15694 int newWidth, newHeight;
15695 if (width == 0 || height == 0)
15696 {
15697 newWidth = this->width();
15698 newHeight = this->height();
15699 } else
15700 {
15701 newWidth = width;
15702 newHeight = height;
15703 }
15704
15705 if (painter->isActive())
15706 {
15707 QRect oldViewport = viewport();
15708 setViewport(QRect(0, 0, newWidth, newHeight));
15709 painter->setMode(QCPPainter::pmNoCaching);
15710 if (mBackgroundBrush.style() != Qt::NoBrush) // unlike in toPixmap, we can't do QPixmap::fill for Qt::SolidPattern brush style, so we also draw solid fills with fillRect here
15711 painter->fillRect(mViewport, mBackgroundBrush);
15712 draw(painter);
15713 setViewport(oldViewport);
15714 } else
15715 qDebug() << Q_FUNC_INFO << "Passed painter is not active";
15716}
15717/* end of 'src/core.cpp' */
15718
15719//amalgamation: add plottable1d.cpp

Callers

nothing calls this directly

Calls 3

viewportFunction · 0.85
isActiveMethod · 0.80
setModeMethod · 0.80

Tested by

no test coverage detected