QCPPainter

Search for usage in LXR

Inheritance diagram for QCPPainter:

Public Types

enum  PainterMode { pmDefault = 0x00, pmVectorized = 0x01, pmNoCaching = 0x02, pmNonCosmetic = 0x04 }
 
typedef QFlags< PainterModePainterModes
 
- Public Types inherited from QPainter
enum  CompositionMode
 
enum  PixmapFragmentHint
 
enum  RenderHint
 

Public Member Functions

 QCPPainter ()
 
 QCPPainter (QPaintDevice *device)
 
bool antialiasing () const
 
bool begin (QPaintDevice *device)
 
void drawLine (const QLineF &line)
 
void drawLine (const QPointF &p1, const QPointF &p2)
 
void makeNonCosmetic ()
 
PainterModes modes () const
 
void restore ()
 
void save ()
 
void setAntialiasing (bool enabled)
 
void setMode (PainterMode mode, bool enabled=true)
 
void setModes (PainterModes modes)
 
void setPen (const QColor &color)
 
void setPen (const QPen &pen)
 
void setPen (Qt::PenStyle penStyle)
 
- Public Member Functions inherited from QPainter
 QPainter (QPaintDevice *device)
 
const QBrushbackground () const const
 
Qt::BGMode backgroundMode () const const
 
bool begin (QPaintDevice *device)
 
void beginNativePainting ()
 
QRect boundingRect (const QRect &rectangle, int flags, const QString &text)
 
QRectF boundingRect (const QRectF &rectangle, const QString &text, const QTextOption &option)
 
QRectF boundingRect (const QRectF &rectangle, int flags, const QString &text)
 
QRect boundingRect (int x, int y, int w, int h, int flags, const QString &text)
 
const QBrushbrush () const const
 
QPoint brushOrigin () const const
 
QRectF clipBoundingRect () const const
 
QPainterPath clipPath () const const
 
QRegion clipRegion () const const
 
QMatrix combinedMatrix () const const
 
QTransform combinedTransform () const const
 
QPainter::CompositionMode compositionMode () const const
 
QPaintDevicedevice () const const
 
const QMatrixdeviceMatrix () const const
 
const QTransformdeviceTransform () const const
 
void drawArc (const QRect &rectangle, int startAngle, int spanAngle)
 
void drawArc (const QRectF &rectangle, int startAngle, int spanAngle)
 
void drawArc (int x, int y, int width, int height, int startAngle, int spanAngle)
 
void drawChord (const QRect &rectangle, int startAngle, int spanAngle)
 
void drawChord (const QRectF &rectangle, int startAngle, int spanAngle)
 
void drawChord (int x, int y, int width, int height, int startAngle, int spanAngle)
 
void drawConvexPolygon (const QPoint *points, int pointCount)
 
void drawConvexPolygon (const QPointF *points, int pointCount)
 
void drawConvexPolygon (const QPolygon &polygon)
 
void drawConvexPolygon (const QPolygonF &polygon)
 
void drawEllipse (const QPoint &center, int rx, int ry)
 
void drawEllipse (const QPointF &center, qreal rx, qreal ry)
 
void drawEllipse (const QRect &rectangle)
 
void drawEllipse (const QRectF &rectangle)
 
void drawEllipse (int x, int y, int width, int height)
 
void drawGlyphRun (const QPointF &position, const QGlyphRun &glyphs)
 
void drawImage (const QPoint &point, const QImage &image)
 
void drawImage (const QPoint &point, const QImage &image, const QRect &source, Qt::ImageConversionFlags flags)
 
void drawImage (const QPointF &point, const QImage &image)
 
void drawImage (const QPointF &point, const QImage &image, const QRectF &source, Qt::ImageConversionFlags flags)
 
void drawImage (const QRect &rectangle, const QImage &image)
 
void drawImage (const QRect &target, const QImage &image, const QRect &source, Qt::ImageConversionFlags flags)
 
void drawImage (const QRectF &rectangle, const QImage &image)
 
void drawImage (const QRectF &target, const QImage &image, const QRectF &source, Qt::ImageConversionFlags flags)
 
void drawImage (int x, int y, const QImage &image, int sx, int sy, int sw, int sh, Qt::ImageConversionFlags flags)
 
void drawLine (const QLine &line)
 
void drawLine (const QLineF &line)
 
void drawLine (const QPoint &p1, const QPoint &p2)
 
void drawLine (const QPointF &p1, const QPointF &p2)
 
void drawLine (int x1, int y1, int x2, int y2)
 
void drawLines (const QLine *lines, int lineCount)
 
void drawLines (const QLineF *lines, int lineCount)
 
void drawLines (const QPoint *pointPairs, int lineCount)
 
void drawLines (const QPointF *pointPairs, int lineCount)
 
void drawLines (const QVector< QLine > &lines)
 
void drawLines (const QVector< QLineF > &lines)
 
void drawLines (const QVector< QPoint > &pointPairs)
 
void drawLines (const QVector< QPointF > &pointPairs)
 
void drawPath (const QPainterPath &path)
 
void drawPicture (const QPoint &point, const QPicture &picture)
 
void drawPicture (const QPointF &point, const QPicture &picture)
 
void drawPicture (int x, int y, const QPicture &picture)
 
void drawPie (const QRect &rectangle, int startAngle, int spanAngle)
 
void drawPie (const QRectF &rectangle, int startAngle, int spanAngle)
 
void drawPie (int x, int y, int width, int height, int startAngle, int spanAngle)
 
void drawPixmap (const QPoint &point, const QPixmap &pixmap)
 
void drawPixmap (const QPoint &point, const QPixmap &pixmap, const QRect &source)
 
void drawPixmap (const QPointF &point, const QPixmap &pixmap)
 
void drawPixmap (const QPointF &point, const QPixmap &pixmap, const QRectF &source)
 
void drawPixmap (const QRect &rectangle, const QPixmap &pixmap)
 
void drawPixmap (const QRect &target, const QPixmap &pixmap, const QRect &source)
 
void drawPixmap (const QRectF &target, const QPixmap &pixmap, const QRectF &source)
 
void drawPixmap (int x, int y, const QPixmap &pixmap)
 
void drawPixmap (int x, int y, const QPixmap &pixmap, int sx, int sy, int sw, int sh)
 
void drawPixmap (int x, int y, int w, int h, const QPixmap &pixmap, int sx, int sy, int sw, int sh)
 
void drawPixmap (int x, int y, int width, int height, const QPixmap &pixmap)
 
void drawPixmapFragments (const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints)
 
void drawPoint (const QPoint &position)
 
void drawPoint (const QPointF &position)
 
void drawPoint (int x, int y)
 
void drawPoints (const QPoint *points, int pointCount)
 
void drawPoints (const QPointF *points, int pointCount)
 
void drawPoints (const QPolygon &points)
 
void drawPoints (const QPolygonF &points)
 
void drawPolygon (const QPoint *points, int pointCount, Qt::FillRule fillRule)
 
void drawPolygon (const QPointF *points, int pointCount, Qt::FillRule fillRule)
 
void drawPolygon (const QPolygon &points, Qt::FillRule fillRule)
 
void drawPolygon (const QPolygonF &points, Qt::FillRule fillRule)
 
void drawPolyline (const QPoint *points, int pointCount)
 
void drawPolyline (const QPointF *points, int pointCount)
 
void drawPolyline (const QPolygon &points)
 
void drawPolyline (const QPolygonF &points)
 
void drawRect (const QRect &rectangle)
 
void drawRect (const QRectF &rectangle)
 
void drawRect (int x, int y, int width, int height)
 
void drawRects (const QRect *rectangles, int rectCount)
 
void drawRects (const QRectF *rectangles, int rectCount)
 
void drawRects (const QVector< QRect > &rectangles)
 
void drawRects (const QVector< QRectF > &rectangles)
 
void drawRoundedRect (const QRect &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode)
 
void drawRoundedRect (const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode)
 
void drawRoundedRect (int x, int y, int w, int h, qreal xRadius, qreal yRadius, Qt::SizeMode mode)
 
void drawRoundRect (const QRect &r, int xRnd, int yRnd)
 
void drawRoundRect (const QRectF &r, int xRnd, int yRnd)
 
void drawRoundRect (int x, int y, int w, int h, int, int)
 
void drawStaticText (const QPoint &topLeftPosition, const QStaticText &staticText)
 
void drawStaticText (const QPointF &topLeftPosition, const QStaticText &staticText)
 
void drawStaticText (int left, int top, const QStaticText &staticText)
 
void drawText (const QPoint &position, const QString &text)
 
void drawText (const QPointF &position, const QString &text)
 
void drawText (const QRect &rectangle, int flags, const QString &text, QRect *boundingRect)
 
void drawText (const QRectF &rectangle, const QString &text, const QTextOption &option)
 
void drawText (const QRectF &rectangle, int flags, const QString &text, QRectF *boundingRect)
 
void drawText (int x, int y, const QString &text)
 
void drawText (int x, int y, int width, int height, int flags, const QString &text, QRect *boundingRect)
 
void drawTiledPixmap (const QRect &rectangle, const QPixmap &pixmap, const QPoint &position)
 
void drawTiledPixmap (const QRectF &rectangle, const QPixmap &pixmap, const QPointF &position)
 
void drawTiledPixmap (int x, int y, int width, int height, const QPixmap &pixmap, int sx, int sy)
 
bool end ()
 
void endNativePainting ()
 
void eraseRect (const QRect &rectangle)
 
void eraseRect (const QRectF &rectangle)
 
void eraseRect (int x, int y, int width, int height)
 
void fillPath (const QPainterPath &path, const QBrush &brush)
 
void fillRect (const QRect &rectangle, const QBrush &brush)
 
void fillRect (const QRect &rectangle, const QColor &color)
 
void fillRect (const QRect &rectangle, QGradient::Preset preset)
 
void fillRect (const QRect &rectangle, Qt::BrushStyle style)
 
void fillRect (const QRect &rectangle, Qt::GlobalColor color)
 
void fillRect (const QRectF &rectangle, const QBrush &brush)
 
void fillRect (const QRectF &rectangle, const QColor &color)
 
void fillRect (const QRectF &rectangle, QGradient::Preset preset)
 
void fillRect (const QRectF &rectangle, Qt::BrushStyle style)
 
void fillRect (const QRectF &rectangle, Qt::GlobalColor color)
 
void fillRect (int x, int y, int width, int height, const QBrush &brush)
 
void fillRect (int x, int y, int width, int height, const QColor &color)
 
void fillRect (int x, int y, int width, int height, QGradient::Preset preset)
 
void fillRect (int x, int y, int width, int height, Qt::BrushStyle style)
 
void fillRect (int x, int y, int width, int height, Qt::GlobalColor color)
 
const QFontfont () const const
 
QFontInfo fontInfo () const const
 
QFontMetrics fontMetrics () const const
 
bool hasClipping () const const
 
void initFrom (const QPaintDevice *device)
 
bool isActive () const const
 
Qt::LayoutDirection layoutDirection () const const
 
const QMatrixmatrix () const const
 
bool matrixEnabled () const const
 
qreal opacity () const const
 
QPaintEnginepaintEngine () const const
 
const QPenpen () const const
 
QPainter::RenderHints renderHints () const const
 
void resetMatrix ()
 
void resetTransform ()
 
void restore ()
 
void rotate (qreal angle)
 
void save ()
 
void scale (qreal sx, qreal sy)
 
void setBackground (const QBrush &brush)
 
void setBackgroundMode (Qt::BGMode mode)
 
void setBrush (const QBrush &brush)
 
void setBrush (Qt::BrushStyle style)
 
void setBrushOrigin (const QPoint &position)
 
void setBrushOrigin (const QPointF &position)
 
void setBrushOrigin (int x, int y)
 
void setClipPath (const QPainterPath &path, Qt::ClipOperation operation)
 
void setClipping (bool enable)
 
void setClipRect (const QRect &rectangle, Qt::ClipOperation operation)
 
void setClipRect (const QRectF &rectangle, Qt::ClipOperation operation)
 
void setClipRect (int x, int y, int width, int height, Qt::ClipOperation operation)
 
void setClipRegion (const QRegion &region, Qt::ClipOperation operation)
 
void setCompositionMode (QPainter::CompositionMode mode)
 
void setFont (const QFont &font)
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void setMatrix (const QMatrix &matrix, bool combine)
 
void setMatrixEnabled (bool enable)
 
void setOpacity (qreal opacity)
 
void setPen (const QColor &color)
 
void setPen (const QPen &pen)
 
void setPen (Qt::PenStyle style)
 
void setRenderHint (QPainter::RenderHint hint, bool on)
 
void setRenderHints (QPainter::RenderHints hints, bool on)
 
void setTransform (const QTransform &transform, bool combine)
 
void setViewport (const QRect &rectangle)
 
void setViewport (int x, int y, int width, int height)
 
void setViewTransformEnabled (bool enable)
 
void setWindow (const QRect &rectangle)
 
void setWindow (int x, int y, int width, int height)
 
void setWorldMatrix (const QMatrix &matrix, bool combine)
 
void setWorldMatrixEnabled (bool enable)
 
void setWorldTransform (const QTransform &matrix, bool combine)
 
void shear (qreal sh, qreal sv)
 
void strokePath (const QPainterPath &path, const QPen &pen)
 
bool testRenderHint (QPainter::RenderHint hint) const const
 
const QTransformtransform () const const
 
void translate (const QPoint &offset)
 
void translate (const QPointF &offset)
 
void translate (qreal dx, qreal dy)
 
QRect viewport () const const
 
bool viewTransformEnabled () const const
 
QRect window () const const
 
const QMatrixworldMatrix () const const
 
bool worldMatrixEnabled () const const
 
const QTransformworldTransform () const const
 

Protected Attributes

QStack< bool > mAntialiasingStack
 
bool mIsAntialiasing
 
PainterModes mModes
 

Additional Inherited Members

- Static Public Member Functions inherited from QPainter
QPaintDeviceredirected (const QPaintDevice *device, QPoint *offset)
 
void restoreRedirected (const QPaintDevice *device)
 
void setRedirected (const QPaintDevice *device, QPaintDevice *replacement, const QPoint &offset)
 
- Public Attributes inherited from QPainter
 Antialiasing
 
 CompositionMode_Clear
 
 CompositionMode_ColorBurn
 
 CompositionMode_ColorDodge
 
 CompositionMode_Darken
 
 CompositionMode_Destination
 
 CompositionMode_DestinationAtop
 
 CompositionMode_DestinationIn
 
 CompositionMode_DestinationOut
 
 CompositionMode_DestinationOver
 
 CompositionMode_Difference
 
 CompositionMode_Exclusion
 
 CompositionMode_HardLight
 
 CompositionMode_Lighten
 
 CompositionMode_Multiply
 
 CompositionMode_Overlay
 
 CompositionMode_Plus
 
 CompositionMode_Screen
 
 CompositionMode_SoftLight
 
 CompositionMode_Source
 
 CompositionMode_SourceAtop
 
 CompositionMode_SourceIn
 
 CompositionMode_SourceOut
 
 CompositionMode_SourceOver
 
 CompositionMode_Xor
 
 HighQualityAntialiasing
 
 LosslessImageRendering
 
 NonCosmeticDefaultPen
 
 OpaqueHint
 
typedef PixmapFragmentHints
 
 Qt4CompatiblePainting
 
 RasterOp_ClearDestination
 
 RasterOp_NotDestination
 
 RasterOp_NotSource
 
 RasterOp_NotSourceAndDestination
 
 RasterOp_NotSourceAndNotDestination
 
 RasterOp_NotSourceOrDestination
 
 RasterOp_NotSourceOrNotDestination
 
 RasterOp_NotSourceXorDestination
 
 RasterOp_SetDestination
 
 RasterOp_SourceAndDestination
 
 RasterOp_SourceAndNotDestination
 
 RasterOp_SourceOrDestination
 
 RasterOp_SourceOrNotDestination
 
 RasterOp_SourceXorDestination
 
typedef RenderHints
 
 SmoothPixmapTransform
 
 TextAntialiasing
 

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 462 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.

Enumerator
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.)

Definition at line 470 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]

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.

Definition at line 293 of file qcustomplot.cpp.

Member Function Documentation

◆ 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()

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.

Note
this function hides the non-virtual base class implementation.

Definition at line 353 of file qcustomplot.cpp.

◆ 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.

◆ 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]

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.

Note
this function hides the non-virtual base class implementation.

Definition at line 324 of file qcustomplot.cpp.

◆ setPen() [2/3]

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.

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.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:01:01 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.