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>
List of all members.
Public Types |
enum | DiscardFlag {
DiscardNone = 0x0,
DiscardBackground = 0x1,
DiscardTitle = 0x2,
DiscardLegend = 0x4,
DiscardCanvasBackground = 0x8
} |
enum | LayoutFlag {
DefaultLayout = 0x0,
KeepMargins = 0x1,
KeepFrames = 0x2,
FrameWithScales = 0x4
} |
Public Member Functions |
| QwtPlotRenderer (QObject *=NULL) |
virtual | ~QwtPlotRenderer () |
void | setDiscardFlag (DiscardFlag flag, bool on=true) |
bool | testDiscardFlag (DiscardFlag flag) const |
void | setDiscardFlags (DiscardFlags flags) |
DiscardFlags | discardFlags () const |
void | setLayoutFlag (LayoutFlag flag, bool on=true) |
bool | testLayoutFlag (LayoutFlag flag) const |
void | setLayoutFlags (LayoutFlags flags) |
LayoutFlags | layoutFlags () const |
void | renderDocument (QwtPlot *, const QString &format, const QSizeF &sizeMM, int resolution=85) |
void | renderDocument (QwtPlot *, const QString &title, const QString &format, const QSizeF &sizeMM, int resolution=85) |
void | renderTo (QwtPlot *, QPrinter &) const |
void | renderTo (QwtPlot *, QPaintDevice &p) const |
virtual void | render (QwtPlot *, QPainter *, const QRectF &rect) const |
Protected Member Functions |
virtual void | renderLegendItem (const QwtPlot *, QPainter *, const QWidget *, const QRectF &) const |
virtual void | renderTitle (const QwtPlot *, QPainter *, const QRectF &) const |
virtual void | renderScale (const QwtPlot *, QPainter *, int axisId, int startDist, int endDist, int baseDist, const QRectF &) const |
virtual void | renderCanvas (const QwtPlot *, QPainter *, const QRectF &canvasRect, const QwtScaleMap *maps) const |
virtual void | renderLegend (const QwtPlot *, QPainter *, const QRectF &) const |
void | buildCanvasMaps (const QwtPlot *, const QRectF &, QwtScaleMap maps[]) const |
Detailed Description
Renderer for exporting a plot to a document, a printer or anything else, that is supported by QPainter/QPaintDevice.
Member Enumeration Documentation
- 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
- DefaultLayout
Use the default layout without margins and frames
- KeepMargins
Render all margins that are set in the layout of the plot
- KeepFrames
Render all frames of the plot
- FrameWithScales
Instead of the scales a box is painted around the plot canvas, where the scale ticks are aligned.
Constructor & Destructor Documentation
QwtPlotRenderer::QwtPlotRenderer |
( |
QObject * |
parent = NULL |
) |
[explicit] |
QwtPlotRenderer::~QwtPlotRenderer |
( |
|
) |
[virtual] |
Member Function Documentation
void QwtPlotRenderer::buildCanvasMaps |
( |
const QwtPlot * |
plot, |
|
|
const QRectF & |
canvasRect, |
|
|
QwtScaleMap |
maps[] | |
|
) |
| | const [protected] |
Calculated the scale maps for rendering the canvas
- Parameters:
-
| plot | Plot widget |
| canvasRect | Target rectangle |
| maps | Scale maps to be calculated |
QwtPlotRenderer::DiscardFlags QwtPlotRenderer::discardFlags |
( |
|
) |
const |
QwtPlotRenderer::LayoutFlags QwtPlotRenderer::layoutFlags |
( |
|
) |
const |
void QwtPlotRenderer::render |
( |
QwtPlot * |
plot, |
|
|
QPainter * |
painter, |
|
|
const QRectF & |
plotRect | |
|
) |
| | const [virtual] |
void QwtPlotRenderer::renderCanvas |
( |
const QwtPlot * |
plot, |
|
|
QPainter * |
painter, |
|
|
const QRectF & |
canvasRect, |
|
|
const QwtScaleMap * |
map | |
|
) |
| | const [protected, virtual] |
Print the canvas into a given rectangle.
- Parameters:
-
| plot | Plot widget |
| painter | Painter |
| map | Maps mapping between plot and paint device coordinates |
| canvasRect | Canvas rectangle |
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
- ps
- svg
- all image formats supported by Qt, see QImageWriter::supportedImageFormats()
- Parameters:
-
| 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) |
- See also:
- renderTo(), render(), QwtPainter::setRoundingAlignment()
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 autodetected from the suffix of the filename.
- Parameters:
-
| 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) |
void QwtPlotRenderer::renderLegend |
( |
const QwtPlot * |
plot, |
|
|
QPainter * |
painter, |
|
|
const QRectF & |
rect | |
|
) |
| | const [protected, virtual] |
Print the legend into a given rectangle.
- Parameters:
-
| plot | Plot widget |
| painter | Painter |
| rect | Bounding rectangle |
void QwtPlotRenderer::renderLegendItem |
( |
const QwtPlot * |
plot, |
|
|
QPainter * |
painter, |
|
|
const QWidget * |
widget, |
|
|
const QRectF & |
rect | |
|
) |
| | const [protected, virtual] |
Print the legend item into a given rectangle.
- Parameters:
-
| plot | Plot widget |
| painter | Painter |
| widget | Widget representing a legend item |
| rect | Bounding rectangle |
- Note:
- When widget is not derived from QwtLegendItem renderLegendItem does nothing and needs to be overloaded
void QwtPlotRenderer::renderScale |
( |
const QwtPlot * |
plot, |
|
|
QPainter * |
painter, |
|
|
int |
axisId, |
|
|
int |
startDist, |
|
|
int |
endDist, |
|
|
int |
baseDist, |
|
|
const QRectF & |
rect | |
|
) |
| | const [protected, virtual] |
Paint a scale into a given rectangle. Paint the scale into a given rectangle.
- Parameters:
-
| plot | Plot widget |
| painter | Painter |
| axisId | Axis |
| startDist | Start border distance |
| endDist | End border distance |
| baseDist | Base distance |
| rect | Bounding rectangle |
void QwtPlotRenderer::renderTitle |
( |
const QwtPlot * |
plot, |
|
|
QPainter * |
painter, |
|
|
const QRectF & |
rect | |
|
) |
| | const [protected, virtual] |
Print the title into a given rectangle.
- Parameters:
-
| plot | Plot widget |
| painter | Painter |
| rect | Bounding rectangle |
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:
-
| plot | Plot to be rendered |
| paintDevice | device to paint on, f.e a QImage |
- See also:
- renderDocument(), render(), QwtPainter::setRoundingAlignment()
void QwtPlotRenderer::renderTo |
( |
QwtPlot * |
plot, |
|
|
QPrinter & |
printer | |
|
) |
| | const |
void QwtPlotRenderer::setDiscardFlag |
( |
DiscardFlag |
flag, |
|
|
bool |
on = true | |
|
) |
| | |
void QwtPlotRenderer::setDiscardFlags |
( |
DiscardFlags |
flags |
) |
|
void QwtPlotRenderer::setLayoutFlag |
( |
LayoutFlag |
flag, |
|
|
bool |
on = true | |
|
) |
| | |
void QwtPlotRenderer::setLayoutFlags |
( |
LayoutFlags |
flags |
) |
|
bool QwtPlotRenderer::testDiscardFlag |
( |
DiscardFlag |
flag |
) |
const |
bool QwtPlotRenderer::testLayoutFlag |
( |
LayoutFlag |
flag |
) |
const |