QPainter subclass used internally.
Więcej...
#include <qcustomplot.hh>
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.
- Ostrzeżenie
- 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).
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.
Wartości wyliczeń |
---|
pmDefault |
0x00 Default mode for painting on screen devices
|
pmVectorized |
0x01 Mode for vectorized painting (e.g. PDF export). For example, this prevents some antialiasing fixes.
|
pmNoCaching |
0x02 Mode for all sorts of exports (e.g. PNG, PDF,...). For example, this prevents using cached pixmap labels
|
pmNonCosmetic |
0x04 Turns pen widths 0 to 1, i.e. disables cosmetic pens. (A cosmetic pen is always drawn with width 1 pixel in the vector image/pdf viewer, independent of zoom.)
|
QCPPainter::QCPPainter |
( |
| ) |
|
Creates a new QCPPainter instance and sets default values
QCPPainter::QCPPainter |
( |
QPaintDevice * |
device | ) |
|
|
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.
bool QCPPainter::antialiasing |
( |
| ) |
const |
|
inline |
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.
- Nota
- this function hides the non-virtual base class implementation.
void QCPPainter::drawLine |
( |
const QLineF & |
line | ) |
|
To jest metoda przeciążona, udostępniona dla wygody. Różni się od powyższej metody tylko zestawem akceptowanych argumentów.
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.
- Nota
- this function hides the non-virtual base class implementation.
void QCPPainter::drawLine |
( |
const QPointF & |
p1, |
|
|
const QPointF & |
p2 |
|
) |
| |
|
inline |
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.
PainterModes QCPPainter::modes |
( |
| ) |
const |
|
inline |
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.
- Nota
- this function hides the non-virtual base class implementation.
- Zobacz również
- 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.
- Nota
- this function hides the non-virtual base class implementation.
- Zobacz również
- restore
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).
To jest metoda przeciążona, udostępniona dla wygody. Różni się od powyższej metody tylko zestawem akceptowanych argumentów.
Sets the mode of the painter. This controls whether the painter shall adjust its fixes/workarounds optimized for certain output devices.
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.
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.
- Nota
- this function hides the non-virtual base class implementation.
void QCPPainter::setPen |
( |
const QColor & |
color | ) |
|
To jest metoda przeciążona, udostępniona dla wygody. Różni się od powyższej metody tylko zestawem akceptowanych argumentów.
Sets the pen (by color) of the painter and applies certain fixes to it, depending on the mode of this QCPPainter.
- Nota
- this function hides the non-virtual base class implementation.
void QCPPainter::setPen |
( |
Qt::PenStyle |
penStyle | ) |
|
To jest metoda przeciążona, udostępniona dla wygody. Różni się od powyższej metody tylko zestawem akceptowanych argumentów.
Sets the pen (by style) of the painter and applies certain fixes to it, depending on the mode of this QCPPainter.
- Nota
- this function hides the non-virtual base class implementation.
QStack<bool> QCPPainter::mAntialiasingStack |
|
protected |
bool QCPPainter::mIsAntialiasing |
|
protected |
PainterModes QCPPainter::mModes |
|
protected |
Dokumentacja dla tej klasy została wygenerowana z plików: