![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
QPainter subclass used internally. More...
#include <qcustomplot.h>


Public Types | |
| enum | PainterMode { pmDefault = 0x00 , pmVectorized = 0x01 , pmNoCaching = 0x02 , pmNonCosmetic = 0x04 , pmDefault = 0x00 , pmVectorized = 0x01 , pmNoCaching = 0x02 , pmNonCosmetic = 0x04 } |
| enum | PainterMode { pmDefault = 0x00 , pmVectorized = 0x01 , pmNoCaching = 0x02 , pmNonCosmetic = 0x04 , pmDefault = 0x00 , pmVectorized = 0x01 , pmNoCaching = 0x02 , pmNonCosmetic = 0x04 } |
Public Member Functions | |
| QCPPainter () | |
| QCPPainter (QPaintDevice *device) | |
| bool | antialiasing () const |
| PainterModes | modes () const |
| void | setAntialiasing (bool enabled) |
| void | setMode (PainterMode mode, bool enabled=true) |
| void | setModes (PainterModes modes) |
| bool | begin (QPaintDevice *device) |
| void | setPen (const QPen &pen) |
| void | setPen (const QColor &color) |
| void | setPen (Qt::PenStyle penStyle) |
| void | drawLine (const QLineF &line) |
| void | drawLine (const QPointF &p1, const QPointF &p2) |
| void | save () |
| void | restore () |
| void | makeNonCosmetic () |
| QCPPainter () | |
| QCPPainter (QPaintDevice *device) | |
| ~QCPPainter () | |
| bool | antialiasing () const |
| PainterModes | modes () const |
| void | setAntialiasing (bool enabled) |
| void | setMode (PainterMode mode, bool enabled=true) |
| void | setModes (PainterModes modes) |
| bool | begin (QPaintDevice *device) |
| void | setPen (const QPen &pen) |
| void | setPen (const QColor &color) |
| void | setPen (Qt::PenStyle penStyle) |
| void | drawLine (const QLineF &line) |
| void | drawLine (const QPointF &p1, const QPointF &p2) |
| void | save () |
| void | restore () |
| void | makeNonCosmetic () |
Protected Attributes | |
| PainterModes | mModes |
| bool | mIsAntialiasing |
| QStack< bool > | mAntialiasingStack |
QPainter subclass used internally.
This QPainter subclass is used to provide some extended functionality e.g. for tweaking position consistency between antialiased and non-antialiased painting. Further it provides workarounds for QPainter quirks.
Definition at line 637 of file qcustomplot.h.
Defines special modes the painter can operate in. They disable or enable certain subsets of features/fixes/workarounds, depending on whether they are wanted on the respective output device.
Definition at line 645 of file qcustomplot.h.
Defines special modes the painter can operate in. They disable or enable certain subsets of features/fixes/workarounds, depending on whether they are wanted on the respective output device.
Definition at line 471 of file qcustomplot.h.
| QCPPainter::QCPPainter | ( | ) |
Creates a new QCPPainter instance and sets default values
Definition at line 251 of file qcustomplot.cpp.
|
explicit |
Creates a new QCPPainter instance on the specified paint device and sets default values. Just like the analogous QPainter constructor, begins painting on device immediately.
Like begin, this method sets QPainter::NonCosmeticDefaultPen in Qt versions before Qt5.
Definition at line 265 of file qcustomplot.cpp.
| QCPPainter::QCPPainter | ( | ) |
| QCPPainter::QCPPainter | ( | QPaintDevice * | device | ) |
| QCPPainter::~QCPPainter | ( | ) |
Definition at line 70 of file qcustomplot.cpp.
|
inline |
Definition at line 670 of file qcustomplot.h.
|
inline |
Definition at line 496 of file qcustomplot.h.
| bool QCPPainter::begin | ( | QPaintDevice * | device | ) |
Sets the QPainter::NonCosmeticDefaultPen in Qt versions before Qt5 after beginning painting on device. This is necessary to get cosmetic pen consistency across Qt versions, because since Qt5, all pens are non-cosmetic by default, and in Qt4 this render hint must be set to get that behaviour.
The Constructor QCPPainter(QPaintDevice *device) which directly starts painting also sets the render hint as appropriate.
Definition at line 367 of file qcustomplot.cpp.
References result.
Referenced by QCustomPlot::savePdf(), and QCustomPlot::toPixmap().
| bool QCPPainter::begin | ( | QPaintDevice * | device | ) |
| void QCPPainter::drawLine | ( | const QLineF & | line | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Works around a Qt bug introduced with Qt 4.8 which makes drawing QLineF unpredictable when antialiasing is disabled. Thus when antialiasing is disabled, it rounds the line to integer coordinates and then passes it to the original drawLine.
Definition at line 320 of file qcustomplot.cpp.
References mIsAntialiasing, mModes, and pmVectorized.
Referenced by QCPHiddenArea::draw(), QCPArrow::draw(), QCPItemStraightLine::draw(), QCPItemLine::draw(), QCPItemTracer::draw(), QCPItemBracket::draw(), QCPLineEnding::draw(), QCPSelectionDecoratorBracket::drawBracket(), QCPFinancial::drawCandlestickPlot(), QCPGraph::drawError(), QCPGrid::drawGridLines(), QCPGraph::drawLegendIcon(), QCPCurve::drawLegendIcon(), QCPFinancial::drawLegendIcon(), QCPErrorBars::drawLegendIcon(), QCPGraph::drawLinePlot(), QCPStatisticalBox::drawMedian(), QCPFinancial::drawOhlcPlot(), QCPAbstractPlottable1D< DataType >::drawPolyline(), QCPScatterStyle::drawShape(), QCPStatisticalBox::drawStatisticalBox(), QCPGrid::drawSubGridLines(), and QCPStatisticalBox::drawWhiskers().
| void QCPPainter::drawLine | ( | const QLineF & | line | ) |
|
inline |
Definition at line 685 of file qcustomplot.h.
|
inline |
Definition at line 511 of file qcustomplot.h.
| void QCPPainter::makeNonCosmetic | ( | ) |
Changes the pen width to 1 if it currently is 0. This function is called in the setPen overrides when the pmNonCosmetic mode is set.
Definition at line 426 of file qcustomplot.cpp.
Referenced by setPen().
| void QCPPainter::makeNonCosmetic | ( | ) |
|
inline |
Definition at line 671 of file qcustomplot.h.
Referenced by QCPColorMap::draw(), QCPLineEnding::draw(), QCPGraph::drawLinePlot(), and QCPAbstractPlottable1D< DataType >::drawPolyline().
|
inline |
Definition at line 497 of file qcustomplot.h.
| void QCPPainter::restore | ( | ) |
Restores the painter (see QPainter::restore). Since QCPPainter adds some new internal state to QPainter, the save/restore functions are reimplemented to also save/restore those members.
Definition at line 414 of file qcustomplot.cpp.
References mAntialiasingStack, and mIsAntialiasing.
Referenced by QCPLayer::draw(), QCPPlottableLegendItem::draw(), and QCPStatisticalBox::drawStatisticalBox().
| void QCPPainter::restore | ( | ) |
| void QCPPainter::save | ( | ) |
Saves the painter (see QPainter::save). Since QCPPainter adds some new internal state to QPainter, the save/restore functions are reimplemented to also save/restore those members.
Definition at line 400 of file qcustomplot.cpp.
References mAntialiasingStack, and mIsAntialiasing.
Referenced by QCPLayer::draw(), QCPPlottableLegendItem::draw(), and QCPStatisticalBox::drawStatisticalBox().
| void QCPPainter::save | ( | ) |
| void QCPPainter::setAntialiasing | ( | bool | enabled | ) |
Sets whether painting uses antialiasing or not. Use this method instead of using setRenderHint with QPainter::Antialiasing directly, as it allows QCPPainter to regain pixel exactness between antialiased and non-antialiased painting (Since Qt < 5.0 uses slightly different coordinate systems for AA/Non-AA painting).
Definition at line 334 of file qcustomplot.cpp.
References mIsAntialiasing, mModes, and pmVectorized.
Referenced by QCPLayerable::applyAntialiasingHint(), QCPAxisRect::applyDefaultAntialiasingHint(), QCPColorScale::applyDefaultAntialiasingHint(), and QCPFinancial::drawLegendIcon().
| void QCPPainter::setAntialiasing | ( | bool | enabled | ) |
| void QCPPainter::setMode | ( | QCPPainter::PainterMode | mode, |
| bool | enabled = true |
||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sets the mode of the painter. This controls whether the painter shall adjust its fixes/workarounds optimized for certain output devices.
Definition at line 384 of file qcustomplot.cpp.
References mModes.
Referenced by QCustomPlot::savePdf(), QCustomPlot::toPainter(), and QCustomPlot::toPixmap().
| void QCPPainter::setMode | ( | PainterMode | mode, |
| bool | enabled = true |
||
| ) |
| void QCPPainter::setModes | ( | PainterModes | modes | ) |
| void QCPPainter::setModes | ( | PainterModes | modes | ) |
| void QCPPainter::setPen | ( | const QColor & | color | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sets the pen (by color) of the painter and applies certain fixes to it, depending on the mode of this QCPPainter.
Definition at line 294 of file qcustomplot.cpp.
References color, makeNonCosmetic(), mModes, and pmNonCosmetic.
| void QCPPainter::setPen | ( | const QColor & | color | ) |
| void QCPPainter::setPen | ( | const QPen & | pen | ) |
Sets the pen of the painter and applies certain fixes to it, depending on the mode of this QCPPainter.
Definition at line 282 of file qcustomplot.cpp.
References makeNonCosmetic(), mModes, and pmNonCosmetic.
Referenced by QCPSelectionDecorator::applyPen(), QCPScatterStyle::applyTo(), QCPColoredBars::draw(), QCPHiddenArea::draw(), QCPArrow::draw(), QCPSelectionRect::draw(), QCPPlottableLegendItem::draw(), QCPLegend::draw(), QCPTextElement::draw(), QCPGraph::draw(), QCPCurve::draw(), QCPBars::draw(), QCPStatisticalBox::draw(), QCPErrorBars::draw(), QCPItemStraightLine::draw(), QCPItemLine::draw(), QCPItemCurve::draw(), QCPItemRect::draw(), QCPItemText::draw(), QCPItemEllipse::draw(), QCPItemPixmap::draw(), QCPItemTracer::draw(), QCPItemBracket::draw(), QCPPlotTitle::draw(), QCPLineEnding::draw(), QCPFinancial::drawCandlestickPlot(), QCPSelectionDecoratorBracket::drawDecoration(), QCPGrid::drawGridLines(), QCPGraph::drawImpulsePlot(), QCPGraph::drawLegendIcon(), QCPCurve::drawLegendIcon(), QCPBars::drawLegendIcon(), QCPStatisticalBox::drawLegendIcon(), QCPFinancial::drawLegendIcon(), QCPErrorBars::drawLegendIcon(), QCPGraph::drawLinePlot(), QCPStatisticalBox::drawMedian(), QCPFinancial::drawOhlcPlot(), QCPStatisticalBox::drawQuartileBox(), QCPGraph::drawScatterPlot(), QCPStatisticalBox::drawStatisticalBox(), QCPGrid::drawSubGridLines(), and QCPStatisticalBox::drawWhiskers().
| void QCPPainter::setPen | ( | const QPen & | pen | ) |
| void QCPPainter::setPen | ( | Qt::PenStyle | penStyle | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sets the pen (by style) of the painter and applies certain fixes to it, depending on the mode of this QCPPainter.
Definition at line 306 of file qcustomplot.cpp.
References makeNonCosmetic(), mModes, and pmNonCosmetic.
| void QCPPainter::setPen | ( | Qt::PenStyle | penStyle | ) |
|
protected |
Definition at line 700 of file qcustomplot.h.
|
protected |
Definition at line 697 of file qcustomplot.h.
Referenced by drawLine(), restore(), save(), and setAntialiasing().
|
protected |
Definition at line 696 of file qcustomplot.h.
Referenced by drawLine(), setAntialiasing(), setMode(), and setPen().