QCPPainter
Public Types | |
enum | PainterMode { pmDefault = 0x00 , pmVectorized = 0x01 , pmNoCaching = 0x02 , pmNonCosmetic = 0x04 } |
typedef QFlags< PainterMode > | PainterModes |
Public Types inherited from QPainter | |
enum | CompositionMode |
enum | PixmapFragmentHint |
enum | RenderHint |
Protected Attributes | |
QStack< bool > | mAntialiasingStack |
bool | mIsAntialiasing |
PainterModes | mModes |
Detailed Description
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.
- Warning
- This class intentionally hides non-virtual functions of QPainter, e.g. setPen, save and restore. So while it is possible to pass a QCPPainter instance to a function that expects a QPainter pointer, some of the workarounds and tweaks will be unavailable to the function (because it will call the base class implementations of the functions actually hidden by QCPPainter).
Definition at line 458 of file qcustomplot.h.
Member Typedef Documentation
◆ PainterModes
typedef QFlags< PainterMode > QCPPainter::PainterModes |
Definition at line 473 of file qcustomplot.h.
Member Enumeration Documentation
◆ PainterMode
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 466 of file qcustomplot.h.
Constructor & Destructor Documentation
◆ QCPPainter() [1/2]
QCPPainter::QCPPainter | ( | ) |
Creates a new QCPPainter instance and sets default values
Definition at line 279 of file qcustomplot.cpp.
◆ QCPPainter() [2/2]
|
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 293 of file qcustomplot.cpp.
Member Function Documentation
◆ antialiasing()
|
inline |
Definition at line 479 of file qcustomplot.h.
◆ begin()
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.
- Note
- this function hides the non-virtual base class implementation.
Definition at line 403 of file qcustomplot.cpp.
◆ drawLine() [1/2]
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.
- Note
- this function hides the non-virtual base class implementation.
Definition at line 353 of file qcustomplot.cpp.
◆ drawLine() [2/2]
Definition at line 493 of file qcustomplot.h.
◆ makeNonCosmetic()
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 461 of file qcustomplot.cpp.
◆ modes()
|
inline |
Definition at line 480 of file qcustomplot.h.
◆ restore()
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.
- Note
- this function hides the non-virtual base class implementation.
- See also
- save
Definition at line 448 of file qcustomplot.cpp.
◆ save()
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.
- Note
- this function hides the non-virtual base class implementation.
- See also
- restore
Definition at line 434 of file qcustomplot.cpp.
◆ setAntialiasing()
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 367 of file qcustomplot.cpp.
◆ setMode()
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 418 of file qcustomplot.cpp.
◆ setModes()
void QCPPainter::setModes | ( | QCPPainter::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 387 of file qcustomplot.cpp.
◆ setPen() [1/3]
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.
- Note
- this function hides the non-virtual base class implementation.
Definition at line 324 of file qcustomplot.cpp.
◆ setPen() [2/3]
Sets the pen of the painter and applies certain fixes to it, depending on the mode of this QCPPainter.
- Note
- this function hides the non-virtual base class implementation.
Definition at line 310 of file qcustomplot.cpp.
◆ setPen() [3/3]
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.
- Note
- this function hides the non-virtual base class implementation.
Definition at line 338 of file qcustomplot.cpp.
Member Data Documentation
◆ mAntialiasingStack
|
protected |
Definition at line 506 of file qcustomplot.h.
◆ mIsAntialiasing
|
protected |
Definition at line 503 of file qcustomplot.h.
◆ mModes
|
protected |
Definition at line 502 of file qcustomplot.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:05 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.