![]() |
.Simulation
|
QPainter subclass used internally. More...
Public Member Functions | |
QCPPainter () | |
Creates a new QCPPainter instance and sets default values. | |
QCPPainter (QPaintDevice *device) | |
Creates a new QCPPainter instance on the specified paint device and sets default values. More... | |
QPixmap | scatterPixmap () const |
bool | antialiasing () const |
bool | pdfExportMode () const |
bool | scaledExportMode () const |
void | setScatterPixmap (const QPixmap pm) |
Sets the pixmap that will be used to draw scatters with drawScatter, when the style is QCP::ssPixmap. | |
void | setAntialiasing (bool enabled) |
Sets whether painting uses antialiasing or not. More... | |
void | setPdfExportMode (bool enabled) |
Sets whether the painter shall adjust its fixes/workarounds optimized for vectorized pdf export. More... | |
void | setScaledExportMode (bool enabled) |
Sets whether the painter shall adjust its fixes/workarounds optimized for scaled export to rastered image formats. More... | |
void | setPen (const QPen &pen) |
Sets the pen of the painter and applies certain fixes to it, depending on the mode of this QCPPainter. More... | |
void | 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. More... | |
void | 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. More... | |
void | 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. More... | |
void | drawLine (const QPointF &p1, const QPointF &p2) |
void | save () |
Saves the painter (see QPainter::save). More... | |
void | restore () |
Restores the painter (see QPainter::restore). More... | |
void | 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. More... | |
void | 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. More... | |
Protected Attributes | |
QPixmap | mScatterPixmap |
bool | mScaledExportMode |
bool | mPdfExportMode |
bool | mIsAntialiasing |
QStack< bool > | mAntialiasingStack |
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.
QCPlot::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 QCPlot::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.
void QCPlot::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.
void QCPlot::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 QCPlot::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 QCPlot::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 QCPlot::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 QCPlot::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 QCPlot::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 QCPlot::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.
void QCPlot::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.
void QCPlot::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.