QPainter subclass used internally. More...
Public Functions | |
QCPPainter () | |
QCPPainter (QPaintDevice *device) | |
QPixmap | scatterPixmap () const |
bool | antialiasing () const |
bool | pdfExportMode () const |
bool | scaledExportMode () const |
void | setScatterPixmap (const QPixmap pm) |
void | setAntialiasing (bool enabled) |
void | setPdfExportMode (bool enabled) |
void | setScaledExportMode (bool enabled) |
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 | fixScaledPen () |
void | drawScatter (double x, double y, double size, QCP::ScatterStyle style) |
QPainter subclass used internally.
This internal class is used to provide some extended functionality e.g. for tweaking position consistency between antialiased and non-antialiased painting and drawing common shapes (like scatter symbols). Further it provides workarounds for QPainter quirks.
Creates a new QCPPainter instance and sets default values
QCPPainter::QCPPainter | ( | QPaintDevice * | device | ) |
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.
void QCPPainter::setScatterPixmap | ( | const QPixmap | pm | ) |
Sets the pixmap that will be used to draw scatters with drawScatter, when the style is QCP::ssPixmap.
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 uses slightly different coordinate systems for AA/Non-AA painting).
void QCPPainter::setPdfExportMode | ( | bool | enabled | ) |
Sets whether the painter shall adjust its fixes/workarounds optimized for vectorized pdf export.
This means for example, that the antialiasing/non-antialiasing fix introduced with setAntialiasing is not used, since PDF is not rastered and thus works with floating point data natively.
void QCPPainter::setScaledExportMode | ( | bool | enabled | ) |
Sets whether the painter shall adjust its fixes/workarounds optimized for scaled export to rastered image formats.
For example this provides a workaround for a QPainter bug that prevents scaling of pen widths for pens with width 0, although the QPainter::NonCosmeticDefaultPen render hint is set.
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.
void QCPPainter::setPen | ( | const QColor & | color | ) |
This is an overloaded function.
Sets the pen (by color) of the painter and applies certain fixes to it, depending on the mode of this QCPPainter.
void QCPPainter::setPen | ( | Qt::PenStyle | penStyle | ) |
This is an overloaded function.
Sets the pen (by style) of the painter and applies certain fixes to it, depending on the mode of this QCPPainter.
void QCPPainter::drawLine | ( | const QLineF & | line | ) |
This is an overloaded function.
Works around a Qt bug introduced with Qt 4.8 which makes drawing QLineF unpredictable when antialiasing is disabled.
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.
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.
void QCPPainter::fixScaledPen | ( | ) |
Provides a workaround for a QPainter bug that prevents scaling of pen widths for pens with width 0, although the QPainter::NonCosmeticDefaultPen render hint is set.
Changes the pen width from 0 to 1, if appropriate.
Does nothing if the QCPPainter is not in scaled export mode (setScaledExportMode).
void QCPPainter::drawScatter | ( | double | x, |
double | y, | ||
double | size, | ||
QCP::ScatterStyle | style | ||
) |
Draws a single scatter point with the specified style and size in pixels at the pixel position x and y.
If the style is ssPixmap, make sure to pass the respective pixmap with setScatterPixmap before calling this function.