Qwt User's Guide 6.1.3

- Main Page
- Classes

qwt_plot_renderer.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10 #ifndef QWT_PLOT_RENDERER_H
11 #define QWT_PLOT_RENDERER_H
12
13 #include "qwt_global.h"
14 #include <qobject.h>
15 #include <qsize.h>
16
17 class QwtPlot;
18 class QwtScaleMap;
19 class QRectF;
20 class QPainter;
21 class QPaintDevice;
22
23 #ifndef QT_NO_PRINTER
24 class QPrinter;
25 #endif
26
27 #ifndef QWT_NO_SVG
28 #ifdef QT_SVG_LIB
29 class QSvgGenerator;
30 #endif
31 #endif
32
37 class QWT_EXPORT QwtPlotRenderer: public QObject
38 {
39 Q_OBJECT
40
41 public:
43 enum DiscardFlag
44 {
46 DiscardNone = 0x00,
47
49 DiscardBackground = 0x01,
50
52 DiscardTitle = 0x02,
53
55 DiscardLegend = 0x04,
56
58 DiscardCanvasBackground = 0x08,
59
61 DiscardFooter = 0x10,
62
70 DiscardCanvasFrame = 0x20
71
72 };
73
75 typedef QFlags<DiscardFlag> DiscardFlags;
76
81 enum LayoutFlag
82 {
84 DefaultLayout = 0x00,
85
90 FrameWithScales = 0x01
91 };
92
94 typedef QFlags<LayoutFlag> LayoutFlags;
95
96 explicit QwtPlotRenderer( QObject * = NULL );
97 virtual ~QwtPlotRenderer();
98
99 void setDiscardFlag( DiscardFlag flag, bool on = true );
100 bool testDiscardFlag( DiscardFlag flag ) const;
101
102 void setDiscardFlags( DiscardFlags flags );
103 DiscardFlags discardFlags() const;
104
105 void setLayoutFlag( LayoutFlag flag, bool on = true );
106 bool testLayoutFlag( LayoutFlag flag ) const;
107
108 void setLayoutFlags( LayoutFlags flags );
109 LayoutFlags layoutFlags() const;
110
111 void renderDocument( QwtPlot *, const QString &fileName,
112 const QSizeF &sizeMM, int resolution = 85 );
113
114 void renderDocument( QwtPlot *,
115 const QString &fileName, const QString &format,
116 const QSizeF &sizeMM, int resolution = 85 );
117
118 #ifndef QWT_NO_SVG
119 #ifdef QT_SVG_LIB
120 #if QT_VERSION >= 0x040500
121 void renderTo( QwtPlot *, QSvgGenerator & ) const;
122 #endif
123 #endif
124 #endif
125
126 #ifndef QT_NO_PRINTER
127 void renderTo( QwtPlot *, QPrinter & ) const;
128 #endif
129
130 void renderTo( QwtPlot *, QPaintDevice &p ) const;
131
132 virtual void render( QwtPlot *,
133 QPainter *, const QRectF &rect ) const;
134
135 virtual void renderTitle( const QwtPlot *,
136 QPainter *, const QRectF & ) const;
137
138 virtual void renderFooter( const QwtPlot *,
139 QPainter *, const QRectF & ) const;
140
141 virtual void renderScale( const QwtPlot *, QPainter *,
142 int axisId, int startDist, int endDist,
143 int baseDist, const QRectF & ) const;
144
145 virtual void renderCanvas( const QwtPlot *,
146 QPainter *, const QRectF &canvasRect,
147 const QwtScaleMap* maps ) const;
148
149 virtual void renderLegend(
150 const QwtPlot *, QPainter *, const QRectF & ) const;
151
152 bool exportTo( QwtPlot *, const QString &documentName,
153 const QSizeF &sizeMM = QSizeF( 300, 200 ), int resolution = 85 );
154
155 private:
156 void buildCanvasMaps( const QwtPlot *,
157 const QRectF &, QwtScaleMap maps[] ) const;
158
159 bool updateCanvasMargins( QwtPlot *,
160 const QRectF &, const QwtScaleMap maps[] ) const;
161
162 private:
163 class PrivateData;
164 PrivateData *d_data;
165 };
166
167 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::DiscardFlags )
168 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::LayoutFlags )
169
170 #endif
QwtPlotRenderer::DiscardFlag
DiscardFlag
Disard flags.
Definition: qwt_plot_renderer.h:43
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:30
QwtPlotRenderer::DiscardFlags
QFlags< DiscardFlag > DiscardFlags
Disard flags.
Definition: qwt_plot_renderer.h:75
QwtPlot
A 2-D plotting widget.
Definition: qwt_plot.h:74
QwtPlotRenderer::LayoutFlags
QFlags< LayoutFlag > LayoutFlags
Layout flags.
Definition: qwt_plot_renderer.h:94
QwtPlotRenderer
Renderer for exporting a plot to a document, a printer or anything else, that is supported by QPainte...
Definition: qwt_plot_renderer.h:37
QwtPlotRenderer::LayoutFlag
LayoutFlag
Layout flags.
Definition: qwt_plot_renderer.h:81