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>

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< DiscardFlag > | DiscardFlags |
| Disard flags. More... | |
| enum | LayoutFlag { DefaultLayout = 0x00, FrameWithScales = 0x01 } |
| Layout flags. More... | |
| typedef QFlags< LayoutFlag > | LayoutFlags |
| 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 &rect) 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 &) const |
| virtual void | renderLegend (const QwtPlot *, QPainter *, const QRectF &) const |
| virtual void | renderScale (const QwtPlot *, QPainter *, int axisId, int startDist, int endDist, int baseDist, const QRectF &) const |
| Paint a scale into a given rectangle. Paint the scale into a given rectangle. More... | |
| virtual void | renderTitle (const QwtPlot *, QPainter *, const QRectF &) const |
| void | renderTo (QwtPlot *, QPrinter &) const |
| Render the plot to a QPrinter. More... | |
| void | renderTo (QwtPlot *, QPaintDevice &p) 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 | |
| PrivateData * | d_data |
Renderer for exporting a plot to a document, a printer or anything else, that is supported by QPainter/QPaintDevice.
Definition at line 39 of file qwt_plot_renderer.h.
| typedef QFlags<DiscardFlag> QwtPlotRenderer::DiscardFlags |
Disard flags.
Definition at line 77 of file qwt_plot_renderer.h.
| typedef QFlags<LayoutFlag> QwtPlotRenderer::LayoutFlags |
Layout flags.
Definition at line 96 of file qwt_plot_renderer.h.
Disard flags.
Definition at line 45 of file qwt_plot_renderer.h.
Layout flags.
| 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 83 of file qwt_plot_renderer.h.
|
explicit |
|
virtual |
Destructor.
Definition at line 123 of file qwt_plot_renderer.cpp.
|
private |
Calculated the scale maps for rendering the canvas
| plot | Plot widget |
| canvasRect | Target rectangle |
| maps | Scale maps to be calculated |
Definition at line 921 of file qwt_plot_renderer.cpp.
| QwtPlotRenderer::DiscardFlags QwtPlotRenderer::discardFlags | ( | ) | const |
Definition at line 169 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.
| plot | Plot widget |
| documentName | Default document name |
| sizeMM | Size for the document in millimeters. |
| resolution | Resolution in dots per Inch (dpi) |
Definition at line 1005 of file qwt_plot_renderer.cpp.
| QwtPlotRenderer::LayoutFlags QwtPlotRenderer::layoutFlags | ( | ) | const |
Definition at line 215 of file qwt_plot_renderer.cpp.
|
virtual |
Paint the contents of a QwtPlot instance into a given rectangle.
| plot | Plot to be rendered |
| painter | Painter |
| plotRect | Bounding rectangle |
Definition at line 452 of file qwt_plot_renderer.cpp.
|
virtual |
Render the canvas into a given rectangle.
| plot | Plot widget |
| painter | Painter |
| map | Maps mapping between plot and paint device coordinates |
| canvasRect | Canvas rectangle |
Definition at line 787 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.
| plot | Plot widget |
| fileName | Path of the file, where the document will be stored |
| sizeMM | Size for the document in millimeters. |
| resolution | Resolution in dots per Inch (dpi) |
Definition at line 231 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:
Scalable vector graphic formats like PDF or SVG are superior to raster graphics formats.
| plot | Plot widget |
| fileName | Path of the file, where the document will be stored |
| format | Format for the document |
| sizeMM | Size for the document in millimeters. |
| resolution | Resolution in dots per Inch (dpi) |
Definition at line 263 of file qwt_plot_renderer.cpp.
|
virtual |
Render the footer into a given rectangle.
| plot | Plot widget |
| painter | Painter |
| rect | Bounding rectangle |
Definition at line 656 of file qwt_plot_renderer.cpp.
|
virtual |
Render the legend into a given rectangle.
| plot | Plot widget |
| painter | Painter |
| rect | Bounding rectangle |
Definition at line 676 of file qwt_plot_renderer.cpp.
|
virtual |
Paint a scale into a given rectangle. Paint the scale into a given rectangle.
| plot | Plot widget |
| painter | Painter |
| axisId | Axis |
| startDist | Start border distance |
| endDist | End border distance |
| baseDist | Base distance |
| rect | Bounding rectangle |
Definition at line 698 of file qwt_plot_renderer.cpp.
|
virtual |
Render the title into a given rectangle.
| plot | Plot widget |
| painter | Painter |
| rect | Bounding rectangle |
Definition at line 637 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.
| plot | Plot to be rendered |
| printer | Printer to paint on |
Definition at line 397 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.
| plot | Plot to be rendered |
| paintDevice | device to paint on, f.e a QImage |
Definition at line 372 of file qwt_plot_renderer.cpp.
| void QwtPlotRenderer::setDiscardFlag | ( | DiscardFlag | flag, |
| bool | on = true |
||
| ) |
Change a flag, indicating what to discard from rendering
| flag | Flag to change |
| on | On/Off |
Definition at line 136 of file qwt_plot_renderer.cpp.
| void QwtPlotRenderer::setDiscardFlags | ( | DiscardFlags | flags | ) |
Set the flags, indicating what to discard from rendering
| flags | Flags |
Definition at line 160 of file qwt_plot_renderer.cpp.
| void QwtPlotRenderer::setLayoutFlag | ( | LayoutFlag | flag, |
| bool | on = true |
||
| ) |
Change a layout flag
| flag | Flag to change |
| on | On/Off |
Definition at line 182 of file qwt_plot_renderer.cpp.
| void QwtPlotRenderer::setLayoutFlags | ( | LayoutFlags | flags | ) |
Set the layout flags
| flags | Flags |
Definition at line 206 of file qwt_plot_renderer.cpp.
| bool QwtPlotRenderer::testDiscardFlag | ( | DiscardFlag | flag | ) | const |
| flag | Flag to be tested |
Definition at line 149 of file qwt_plot_renderer.cpp.
| bool QwtPlotRenderer::testLayoutFlag | ( | LayoutFlag | flag | ) | const |
| flag | Flag to be tested |
Definition at line 195 of file qwt_plot_renderer.cpp.
|
private |
Definition at line 972 of file qwt_plot_renderer.cpp.
|
private |
Definition at line 165 of file qwt_plot_renderer.h.