iCub-main
|
QPainter subclass used internally. More...
#include <qcustomplot.h>
Public Types | |
enum | PainterMode { pmDefault = 0x00 , pmVectorized = 0x01 , pmNoCaching = 0x02 , pmNonCosmetic = 0x04 } |
Defines special modes the painter can operate in. 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. | |
~QCPPainter () | |
bool | antialiasing () const |
PainterModes | modes () const |
void | setAntialiasing (bool enabled) |
Sets whether painting uses antialiasing or not. | |
void | setMode (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. | |
void | setModes (PainterModes modes) |
Sets the mode of the painter. | |
bool | begin (QPaintDevice *device) |
Sets the QPainter::NonCosmeticDefaultPen in Qt versions before Qt5 after beginning painting on device. | |
void | setPen (const QPen &pen) |
Sets the pen of the painter and applies certain fixes to it, depending on the mode of this QCPPainter. | |
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. | |
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. | |
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. | |
void | drawLine (const QPointF &p1, const QPointF &p2) |
void | save () |
Saves the painter (see QPainter::save). | |
void | restore () |
Restores the painter (see QPainter::restore). | |
void | makeNonCosmetic () |
Changes the pen width to 1 if it currently is 0. | |
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 311 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 319 of file qcustomplot.h.
QCPPainter::QCPPainter | ( | ) |
Creates a new QCPPainter instance and sets default values.
Definition at line 51 of file qcustomplot.cpp.
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.
Like begin, this method sets QPainter::NonCosmeticDefaultPen in Qt versions before Qt5.
Definition at line 66 of file qcustomplot.cpp.
QCPPainter::~QCPPainter | ( | ) |
Definition at line 77 of file qcustomplot.cpp.
|
inline |
Definition at line 332 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 180 of file qcustomplot.cpp.
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 130 of file qcustomplot.cpp.
|
inline |
Definition at line 346 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 238 of file qcustomplot.cpp.
|
inline |
Definition at line 333 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 225 of file qcustomplot.cpp.
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 211 of file qcustomplot.cpp.
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 144 of file qcustomplot.cpp.
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 195 of file qcustomplot.cpp.
void QCPPainter::setModes | ( | PainterModes | modes | ) |
Sets the mode of the painter.
This controls whether the painter shall adjust its fixes/workarounds optimized for certain output devices.
Definition at line 164 of file qcustomplot.cpp.
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 101 of file qcustomplot.cpp.
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 87 of file qcustomplot.cpp.
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 115 of file qcustomplot.cpp.
|
protected |
Definition at line 359 of file qcustomplot.h.
|
protected |
Definition at line 356 of file qcustomplot.h.
|
protected |
Definition at line 355 of file qcustomplot.h.