Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
QwtPlotRenderer Class Reference

Renderer for exporting a plot to a document, a printer or anything else, that is supported by QPainter/QPaintDevice. More...

#include <qwt_plot_renderer.h>

Inheritance diagram for QwtPlotRenderer:
Inheritance graph
[legend]

Classes

class  PrivateData
 

Public Types

enum  DiscardFlag {
  DiscardNone = 0x00, DiscardBackground = 0x01, DiscardTitle = 0x02, DiscardLegend = 0x04,
  DiscardCanvasBackground = 0x08, DiscardFooter = 0x10, DiscardCanvasFrame = 0x20
}
 Disard flags. More...
 
typedef QFlags< DiscardFlagDiscardFlags
 Disard flags. More...
 
enum  LayoutFlag { DefaultLayout = 0x00, FrameWithScales = 0x01 }
 Layout flags. More...
 
typedef QFlags< LayoutFlagLayoutFlags
 Layout flags. More...
 

Public Member Functions

DiscardFlags discardFlags () const
 
bool exportTo (QwtPlot *, const QString &documentName, const QSizeF &sizeMM=QSizeF(300, 200), int resolution=85)
 Execute a file dialog and render the plot to the selected file. More...
 
LayoutFlags layoutFlags () const
 
 QwtPlotRenderer (QObject *=NULL)
 
virtual void render (QwtPlot *, QPainter *, const QRectF &plotRect) const
 
virtual void renderCanvas (const QwtPlot *, QPainter *, const QRectF &canvasRect, const QwtScaleMap *maps) const
 
void renderDocument (QwtPlot *, const QString &fileName, const QSizeF &sizeMM, int resolution=85)
 
void renderDocument (QwtPlot *, const QString &fileName, const QString &format, const QSizeF &sizeMM, int resolution=85)
 
virtual void renderFooter (const QwtPlot *, QPainter *, const QRectF &footerRect) const
 
virtual void renderLegend (const QwtPlot *, QPainter *, const QRectF &legendRect) const
 
virtual void renderScale (const QwtPlot *, QPainter *, int axisId, int startDist, int endDist, int baseDist, const QRectF &scaleRect) const
 Paint a scale into a given rectangle. Paint the scale into a given rectangle. More...
 
virtual void renderTitle (const QwtPlot *, QPainter *, const QRectF &titleRect) const
 
void renderTo (QwtPlot *, QPrinter &) const
 Render the plot to a QPrinter. More...
 
void renderTo (QwtPlot *, QPaintDevice &) const
 Render the plot to a QPaintDevice. More...
 
void setDiscardFlag (DiscardFlag flag, bool on=true)
 
void setDiscardFlags (DiscardFlags flags)
 
void setLayoutFlag (LayoutFlag flag, bool on=true)
 
void setLayoutFlags (LayoutFlags flags)
 
bool testDiscardFlag (DiscardFlag flag) const
 
bool testLayoutFlag (LayoutFlag flag) const
 
virtual ~QwtPlotRenderer ()
 Destructor. More...
 

Private Member Functions

void buildCanvasMaps (const QwtPlot *, const QRectF &, QwtScaleMap maps[]) const
 
bool updateCanvasMargins (QwtPlot *, const QRectF &, const QwtScaleMap maps[]) const
 

Private Attributes

PrivateDatad_data
 

Detailed Description

Renderer for exporting a plot to a document, a printer or anything else, that is supported by QPainter/QPaintDevice.

Definition at line 38 of file qwt_plot_renderer.h.

Member Typedef Documentation

Disard flags.

Definition at line 76 of file qwt_plot_renderer.h.

Layout flags.

Definition at line 95 of file qwt_plot_renderer.h.

Member Enumeration Documentation

Disard flags.

Enumerator
DiscardNone 

Render all components of the plot.

DiscardBackground 

Don't render the background of the plot.

DiscardTitle 

Don't render the title of the plot.

DiscardLegend 

Don't render the legend of the plot.

DiscardCanvasBackground 

Don't render the background of the canvas.

DiscardFooter 

Don't render the footer of the plot.

DiscardCanvasFrame 

Don't render the frame of the canvas

Note
This flag has no effect when using style sheets, where the frame is part of the background

Definition at line 44 of file qwt_plot_renderer.h.

Layout flags.

See also
setLayoutFlag(), testLayoutFlag()
Enumerator
DefaultLayout 

Use the default layout as on screen.

FrameWithScales 

Instead of the scales a box is painted around the plot canvas, where the scale ticks are aligned to.

Definition at line 82 of file qwt_plot_renderer.h.

Constructor & Destructor Documentation

QwtPlotRenderer::QwtPlotRenderer ( QObject *  parent = NULL)
explicit

Constructor

Parameters
parentParent object

Definition at line 142 of file qwt_plot_renderer.cpp.

QwtPlotRenderer::~QwtPlotRenderer ( )
virtual

Destructor.

Definition at line 149 of file qwt_plot_renderer.cpp.

Member Function Documentation

void QwtPlotRenderer::buildCanvasMaps ( const QwtPlot plot,
const QRectF &  canvasRect,
QwtScaleMap  maps[] 
) const
private

Calculated the scale maps for rendering the canvas

Parameters
plotPlot widget
canvasRectTarget rectangle
mapsScale maps to be calculated

Definition at line 953 of file qwt_plot_renderer.cpp.

QwtPlotRenderer::DiscardFlags QwtPlotRenderer::discardFlags ( ) const
Returns
Flags, indicating what to discard from rendering
See also
DiscardFlag, setDiscardFlags(), setDiscardFlag(), testDiscardFlag()

Definition at line 195 of file qwt_plot_renderer.cpp.

bool QwtPlotRenderer::exportTo ( QwtPlot plot,
const QString &  documentName,
const QSizeF &  sizeMM = QSizeF( 300, 200 ),
int  resolution = 85 
)

Execute a file dialog and render the plot to the selected file.

Parameters
plotPlot widget
documentNameDefault document name
sizeMMSize for the document in millimeters.
resolutionResolution in dots per Inch (dpi)
Returns
True, when exporting was successful
See also
renderDocument()

Definition at line 1037 of file qwt_plot_renderer.cpp.

QwtPlotRenderer::LayoutFlags QwtPlotRenderer::layoutFlags ( ) const
Returns
Layout flags
See also
LayoutFlag, setLayoutFlags(), setLayoutFlag(), testLayoutFlag()

Definition at line 241 of file qwt_plot_renderer.cpp.

void QwtPlotRenderer::render ( QwtPlot plot,
QPainter *  painter,
const QRectF &  plotRect 
) const
virtual

Paint the contents of a QwtPlot instance into a given rectangle.

Parameters
plotPlot to be rendered
painterPainter
plotRectBounding rectangle
See also
renderDocument(), renderTo(), QwtPainter::setRoundingAlignment()

Definition at line 478 of file qwt_plot_renderer.cpp.

void QwtPlotRenderer::renderCanvas ( const QwtPlot plot,
QPainter *  painter,
const QRectF &  canvasRect,
const QwtScaleMap maps 
) const
virtual

Render the canvas into a given rectangle.

Parameters
plotPlot widget
painterPainter
mapsMaps mapping between plot and paint device coordinates
canvasRectCanvas rectangle

Definition at line 815 of file qwt_plot_renderer.cpp.

void QwtPlotRenderer::renderDocument ( QwtPlot plot,
const QString &  fileName,
const QSizeF &  sizeMM,
int  resolution = 85 
)

Render a plot to a file

The format of the document will be auto-detected from the suffix of the file name.

Parameters
plotPlot widget
fileNamePath of the file, where the document will be stored
sizeMMSize for the document in millimeters.
resolutionResolution in dots per Inch (dpi)

Definition at line 257 of file qwt_plot_renderer.cpp.

void QwtPlotRenderer::renderDocument ( QwtPlot plot,
const QString &  fileName,
const QString &  format,
const QSizeF &  sizeMM,
int  resolution = 85 
)

Render a plot to a file

Supported formats are:

  • pdf
    Portable Document Format PDF
  • ps
    Postcript
  • svg
    Scalable Vector Graphics SVG
  • all image formats supported by Qt
    see QImageWriter::supportedImageFormats()

Scalable vector graphic formats like PDF or SVG are superior to raster graphics formats.

Parameters
plotPlot widget
fileNamePath of the file, where the document will be stored
formatFormat for the document
sizeMMSize for the document in millimeters.
resolutionResolution in dots per Inch (dpi)
See also
renderTo(), render(), QwtPainter::setRoundingAlignment()

Definition at line 289 of file qwt_plot_renderer.cpp.

void QwtPlotRenderer::renderFooter ( const QwtPlot plot,
QPainter *  painter,
const QRectF &  footerRect 
) const
virtual

Render the footer into a given rectangle.

Parameters
plotPlot widget
painterPainter
footerRectBounding rectangle for the footer

Definition at line 676 of file qwt_plot_renderer.cpp.

void QwtPlotRenderer::renderLegend ( const QwtPlot plot,
QPainter *  painter,
const QRectF &  legendRect 
) const
virtual

Render the legend into a given rectangle.

Parameters
plotPlot widget
painterPainter
legendRectBounding rectangle for the legend

Definition at line 695 of file qwt_plot_renderer.cpp.

void QwtPlotRenderer::renderScale ( const QwtPlot plot,
QPainter *  painter,
int  axisId,
int  startDist,
int  endDist,
int  baseDist,
const QRectF &  scaleRect 
) const
virtual

Paint a scale into a given rectangle. Paint the scale into a given rectangle.

Parameters
plotPlot widget
painterPainter
axisIdAxis
startDistStart border distance
endDistEnd border distance
baseDistBase distance
scaleRectBounding rectangle for the scale

Definition at line 717 of file qwt_plot_renderer.cpp.

void QwtPlotRenderer::renderTitle ( const QwtPlot plot,
QPainter *  painter,
const QRectF &  titleRect 
) const
virtual

Render the title into a given rectangle.

Parameters
plotPlot widget
painterPainter
titleRectBounding rectangle for the title

Definition at line 657 of file qwt_plot_renderer.cpp.

void QwtPlotRenderer::renderTo ( QwtPlot plot,
QPrinter &  printer 
) const

Render the plot to a QPrinter.

This function renders the contents of a QwtPlot instance to QPaintDevice object. The size is derived from the printer metrics.

Parameters
plotPlot to be rendered
printerPrinter to paint on
See also
renderDocument(), render(), QwtPainter::setRoundingAlignment()

Definition at line 423 of file qwt_plot_renderer.cpp.

void QwtPlotRenderer::renderTo ( QwtPlot plot,
QPaintDevice &  paintDevice 
) const

Render the plot to a QPaintDevice.

This function renders the contents of a QwtPlot instance to QPaintDevice object. The target rectangle is derived from its device metrics.

Parameters
plotPlot to be rendered
paintDevicedevice to paint on, f.e a QImage
See also
renderDocument(), render(), QwtPainter::setRoundingAlignment()

Definition at line 398 of file qwt_plot_renderer.cpp.

void QwtPlotRenderer::setDiscardFlag ( DiscardFlag  flag,
bool  on = true 
)

Change a flag, indicating what to discard from rendering

Parameters
flagFlag to change
onOn/Off
See also
DiscardFlag, testDiscardFlag(), setDiscardFlags(), discardFlags()

Definition at line 162 of file qwt_plot_renderer.cpp.

void QwtPlotRenderer::setDiscardFlags ( DiscardFlags  flags)

Set the flags, indicating what to discard from rendering

Parameters
flagsFlags
See also
DiscardFlag, setDiscardFlag(), testDiscardFlag(), discardFlags()

Definition at line 186 of file qwt_plot_renderer.cpp.

void QwtPlotRenderer::setLayoutFlag ( LayoutFlag  flag,
bool  on = true 
)

Change a layout flag

Parameters
flagFlag to change
onOn/Off
See also
LayoutFlag, testLayoutFlag(), setLayoutFlags(), layoutFlags()

Definition at line 208 of file qwt_plot_renderer.cpp.

void QwtPlotRenderer::setLayoutFlags ( LayoutFlags  flags)

Set the layout flags

Parameters
flagsFlags
See also
LayoutFlag, setLayoutFlag(), testLayoutFlag(), layoutFlags()

Definition at line 232 of file qwt_plot_renderer.cpp.

bool QwtPlotRenderer::testDiscardFlag ( DiscardFlag  flag) const
Returns
True, if flag is enabled.
Parameters
flagFlag to be tested
See also
DiscardFlag, setDiscardFlag(), setDiscardFlags(), discardFlags()

Definition at line 175 of file qwt_plot_renderer.cpp.

bool QwtPlotRenderer::testLayoutFlag ( LayoutFlag  flag) const
Returns
True, if flag is enabled.
Parameters
flagFlag to be tested
See also
LayoutFlag, setLayoutFlag(), setLayoutFlags(), layoutFlags()

Definition at line 221 of file qwt_plot_renderer.cpp.

bool QwtPlotRenderer::updateCanvasMargins ( QwtPlot plot,
const QRectF &  canvasRect,
const QwtScaleMap  maps[] 
) const
private

Definition at line 1004 of file qwt_plot_renderer.cpp.

Member Data Documentation

PrivateData* QwtPlotRenderer::d_data
private

Definition at line 162 of file qwt_plot_renderer.h.


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


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 04:02:50