QWT API (English) 7.0.1
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
QwtGraphic Class Reference

A paint device for scalable graphics. More...

#include <qwt_graphic.h>

Inheritance diagram for QwtGraphic:
QwtNullPaintDevice

Classes

class  PathInfo
 
class  PrivateData
 

Public Types

enum  RenderHint { RenderPensUnscaled = 0x1 }
 Hint how to render a graphic . More...
 
enum  CommandType { VectorData = 1 << 0 , RasterData = 1 << 1 , Transformation = 1 << 2 }
 Indicator if the graphic contains a specific type of painter command . More...
 
- Public Types inherited from QwtNullPaintDevice
enum  Mode { NormalMode , PolygonPathMode , PathMode }
 Render mode for the paint device. More...
 

Public Member Functions

 QwtGraphic ()
 Constructor.
 
 QwtGraphic (const QwtGraphic &)
 Copy constructor.
 
virtual ~QwtGraphic ()
 Destructor.
 
QwtGraphicoperator= (const QwtGraphic &)
 Assignment operator.
 
void reset ()
 Clear all stored commands.
 
bool isNull () const
 Check if the graphic is null.
 
bool isEmpty () const
 Check if the graphic is empty.
 
CommandTypes commandTypes () const
 Get the types of painter commands being used.
 
void render (QPainter *) const
 Replay all recorded painter commands.
 
void render (QPainter *, const QSizeF &, Qt::AspectRatioMode=Qt::IgnoreAspectRatio) const
 Replay all recorded painter commands scaled to fit into given size.
 
void render (QPainter *, const QPointF &, Qt::Alignment=Qt::AlignTop|Qt::AlignLeft) const
 Replay all recorded painter commands aligned to a position.
 
void render (QPainter *, const QRectF &, Qt::AspectRatioMode=Qt::IgnoreAspectRatio) const
 Replay all recorded painter commands scaled to fit into given rectangle.
 
QPixmap toPixmap (qreal devicePixelRatio=0.0) const
 Convert the graphic to a QPixmap in default size.
 
QPixmap toPixmap (const QSize &, Qt::AspectRatioMode=Qt::IgnoreAspectRatio, qreal devicePixelRatio=0.0) const
 Convert the graphic to a QPixmap with specified size.
 
QImage toImage (qreal devicePixelRatio=0.0) const
 Convert the graphic to a QImage in default size.
 
QImage toImage (const QSize &, Qt::AspectRatioMode=Qt::IgnoreAspectRatio, qreal devicePixelRatio=0.0) const
 Convert the graphic to a QImage with specified size.
 
QRectF scaledBoundingRect (qreal sx, qreal sy) const
 Calculate the target rectangle for scaling the graphic.
 
QRectF boundingRect () const
 Get the bounding rectangle.
 
QRectF controlPointRect () const
 Get the control point rectangle.
 
const QVector< QwtPainterCommand > & commands () const
 Get the list of recorded paint commands.
 
void setCommands (const QVector< QwtPainterCommand > &)
 Append paint commands.
 
void setDefaultSize (const QSizeF &)
 Set a default size.
 
QSizeF defaultSize () const
 Get the default size.
 
qreal heightForWidth (qreal width) const
 Find the height for a given width.
 
qreal widthForHeight (qreal height) const
 Find the width for a given height.
 
void setRenderHint (RenderHint, bool on=true)
 Toggle a render hint.
 
bool testRenderHint (RenderHint) const
 Test a render hint.
 
RenderHints renderHints () const
 Get the render hints.
 
- Public Member Functions inherited from QwtNullPaintDevice
 QwtNullPaintDevice ()
 Constructor.
 
virtual ~QwtNullPaintDevice ()
 Destructor.
 
void setMode (Mode)
 Set the render mode.
 
Mode mode () const
 Get the render mode.
 
virtual QPaintEngine * paintEngine () const override
 Return the paint engine.
 
virtual int metric (PaintDeviceMetric) const override
 Return metric information for the paint device.
 
virtual void drawRects (const QRect *, int)
 Draw rectangles (integer version)
 
virtual void drawRects (const QRectF *, int)
 Draw rectangles (floating point version)
 
virtual void drawLines (const QLine *, int)
 Draw lines (integer version)
 
virtual void drawLines (const QLineF *, int)
 Draw lines (floating point version)
 
virtual void drawEllipse (const QRectF &)
 Draw ellipse (floating point version)
 
virtual void drawEllipse (const QRect &)
 Draw ellipse (integer version)
 
virtual void drawPoints (const QPointF *, int)
 Draw points (floating point version)
 
virtual void drawPoints (const QPoint *, int)
 Draw points (integer version)
 
virtual void drawPolygon (const QPointF *, int, QPaintEngine::PolygonDrawMode)
 Draw polygon (floating point version)
 
virtual void drawPolygon (const QPoint *, int, QPaintEngine::PolygonDrawMode)
 Draw polygon (integer version)
 
virtual void drawTextItem (const QPointF &, const QTextItem &)
 Draw a text item.
 
virtual void drawTiledPixmap (const QRectF &, const QPixmap &, const QPointF &)
 Draw a tiled pixmap.
 

Protected Member Functions

virtual QSize sizeMetrics () const override
 
virtual void drawPath (const QPainterPath &) override
 Store a path command in the command list.
 
virtual void drawPixmap (const QRectF &, const QPixmap &, const QRectF &) override
 Store a pixmap command in the command list.
 
virtual void drawImage (const QRectF &, const QImage &, const QRectF &, Qt::ImageConversionFlags) override
 Store a image command in the command list.
 
virtual void updateState (const QPaintEngineState &) override
 Store a state command in the command list.
 

Detailed Description

A paint device for scalable graphics.

Member Enumeration Documentation

◆ CommandType

Indicator if the graphic contains a specific type of painter command .

Enumerator
VectorData 

The graphic contains scalable vector data

RasterData 

The graphic contains raster data ( QPixmap or QImage )

Transformation 

The graphic contains transformations beyond simple translations

◆ RenderHint

Hint how to render a graphic .

Enumerator
RenderPensUnscaled 

When rendering a QwtGraphic a specific scaling between the controlPointRect() and the coordinates of the target rectangle is set up internally in render().

When RenderPensUnscaled is set this specific scaling is applied for the control points only, but not for the pens. All other painter transformations ( set up by application code ) are supposed to work like usual.

Constructor & Destructor Documentation

◆ QwtGraphic() [1/2]

QwtGraphic::QwtGraphic ( )

Constructor.

◆ QwtGraphic() [2/2]

QwtGraphic::QwtGraphic ( const QwtGraphic other)

Copy constructor.

◆ ~QwtGraphic()

QwtGraphic::~QwtGraphic ( )
virtual

Destructor.

Member Function Documentation

◆ boundingRect()

QRectF QwtGraphic::boundingRect ( ) const

Get the bounding rectangle.

◆ commands()

const QVector< QwtPainterCommand > & QwtGraphic::commands ( ) const

Get the list of recorded paint commands.

◆ commandTypes()

QwtGraphic::CommandTypes QwtGraphic::commandTypes ( ) const

Get the types of painter commands being used.

◆ controlPointRect()

QRectF QwtGraphic::controlPointRect ( ) const

Get the control point rectangle.

◆ defaultSize()

QSizeF QwtGraphic::defaultSize ( ) const

Get the default size.

◆ drawImage()

void QwtGraphic::drawImage ( const QRectF &  rect,
const QImage &  image,
const QRectF &  subRect,
Qt::ImageConversionFlags  flags 
)
overrideprotectedvirtual

Store a image command in the command list.

Parameters
recttarget rectangle
imageImage to be painted
subRectReactangle of the pixmap to be painted
flagsImage conversion flags
See also
QPaintEngine::drawImage()

Reimplemented from QwtNullPaintDevice.

◆ drawPath()

void QwtGraphic::drawPath ( const QPainterPath &  path)
overrideprotectedvirtual

Store a path command in the command list.

Parameters
pathPainter path
See also
QPaintEngine::drawPath()

Reimplemented from QwtNullPaintDevice.

◆ drawPixmap()

void QwtGraphic::drawPixmap ( const QRectF &  rect,
const QPixmap &  pixmap,
const QRectF &  subRect 
)
overrideprotectedvirtual

Store a pixmap command in the command list.

Parameters
recttarget rectangle
pixmapPixmap to be painted
subRectReactangle of the pixmap to be painted
See also
QPaintEngine::drawPixmap()

Reimplemented from QwtNullPaintDevice.

◆ heightForWidth()

qreal QwtGraphic::heightForWidth ( qreal  width) const

Find the height for a given width.

◆ isEmpty()

bool QwtGraphic::isEmpty ( ) const

Check if the graphic is empty.

◆ isNull()

bool QwtGraphic::isNull ( ) const

Check if the graphic is null.

◆ operator=()

QwtGraphic & QwtGraphic::operator= ( const QwtGraphic other)

Assignment operator.

◆ render() [1/4]

void QwtGraphic::render ( QPainter *  painter) const

Replay all recorded painter commands.

◆ render() [2/4]

void QwtGraphic::render ( QPainter *  painter,
const QPointF &  pos,
Qt::Alignment  alignment = Qt::AlignTop | Qt::AlignLeft 
) const

Replay all recorded painter commands aligned to a position.

◆ render() [3/4]

void QwtGraphic::render ( QPainter *  painter,
const QRectF &  rect,
Qt::AspectRatioMode  aspectRatioMode = Qt::IgnoreAspectRatio 
) const

Replay all recorded painter commands scaled to fit into given rectangle.

◆ render() [4/4]

void QwtGraphic::render ( QPainter *  painter,
const QSizeF &  size,
Qt::AspectRatioMode  aspectRatioMode = Qt::IgnoreAspectRatio 
) const

Replay all recorded painter commands scaled to fit into given size.

◆ renderHints()

QwtGraphic::RenderHints QwtGraphic::renderHints ( ) const

Get the render hints.

◆ reset()

void QwtGraphic::reset ( )

Clear all stored commands.

◆ scaledBoundingRect()

QRectF QwtGraphic::scaledBoundingRect ( qreal  sx,
qreal  sy 
) const

Calculate the target rectangle for scaling the graphic.

◆ setCommands()

void QwtGraphic::setCommands ( const QVector< QwtPainterCommand > &  commands)

Append paint commands.

◆ setDefaultSize()

void QwtGraphic::setDefaultSize ( const QSizeF &  size)

Set a default size.

◆ setRenderHint()

void QwtGraphic::setRenderHint ( RenderHint  hint,
bool  on = true 
)

Toggle a render hint.

◆ sizeMetrics()

QSize QwtGraphic::sizeMetrics ( ) const
overrideprotectedvirtual
Returns
Ceiled defaultSize()

Implements QwtNullPaintDevice.

◆ testRenderHint()

bool QwtGraphic::testRenderHint ( RenderHint  hint) const

Test a render hint.

◆ toImage() [1/2]

QImage QwtGraphic::toImage ( const QSize &  size,
Qt::AspectRatioMode  aspectRatioMode = Qt::IgnoreAspectRatio,
qreal  devicePixelRatio = 0.0 
) const

Convert the graphic to a QImage with specified size.

◆ toImage() [2/2]

QImage QwtGraphic::toImage ( qreal  devicePixelRatio = 0.0) const

Convert the graphic to a QImage in default size.

◆ toPixmap() [1/2]

QPixmap QwtGraphic::toPixmap ( const QSize &  size,
Qt::AspectRatioMode  aspectRatioMode = Qt::IgnoreAspectRatio,
qreal  devicePixelRatio = 0.0 
) const

Convert the graphic to a QPixmap with specified size.

◆ toPixmap() [2/2]

QPixmap QwtGraphic::toPixmap ( qreal  devicePixelRatio = 0.0) const

Convert the graphic to a QPixmap in default size.

◆ updateState()

void QwtGraphic::updateState ( const QPaintEngineState &  state)
overrideprotectedvirtual

Store a state command in the command list.

Parameters
stateState to be stored
See also
QPaintEngine::updateState()

Reimplemented from QwtNullPaintDevice.

◆ widthForHeight()

qreal QwtGraphic::widthForHeight ( qreal  height) const

Find the width for a given height.


The documentation for this class was generated from the following files: