Qwt User's Guide: qwt_plot_renderer.h Source File

Qwt User's Guide 6.2.0

qwt_plot_renderer.h
1 /******************************************************************************
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 "qwt_axis_id.h"
15
16 #include <qobject.h>
17 #include <qsize.h>
18
19 class QwtPlot;
20 class QwtScaleMap;
21 class QRectF;
22 class QPainter;
23 class QPaintDevice;
24
25 #ifndef QT_NO_PRINTER
26 class QPrinter;
27 #endif
28
29 #ifndef QWT_NO_SVG
30 #ifdef QT_SVG_LIB
31 class QSvgGenerator;
32 #endif
33 #endif
34
39 class QWT_EXPORT QwtPlotRenderer : public QObject
40 {
41 Q_OBJECT
42
43 public:
45 enum DiscardFlag
46 {
48 DiscardNone = 0x00,
49
51 DiscardBackground = 0x01,
52
54 DiscardTitle = 0x02,
55
57 DiscardLegend = 0x04,
58
60 DiscardCanvasBackground = 0x08,
61
63 DiscardFooter = 0x10,
64
72 DiscardCanvasFrame = 0x20
73
74 };
75
76 Q_DECLARE_FLAGS( DiscardFlags, DiscardFlag )
77
78
82 enum LayoutFlag
83 {
85 DefaultLayout = 0x00,
86
91 FrameWithScales = 0x01
92 };
93
94 Q_DECLARE_FLAGS( LayoutFlags, LayoutFlag )
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 void renderTo( QwtPlot*, QSvgGenerator& ) const;
121 #endif
122 #endif
123
124 #ifndef QT_NO_PRINTER
125 void renderTo( QwtPlot*, QPrinter& ) const;
126 #endif
127
128 void renderTo( QwtPlot*, QPaintDevice& ) const;
129
130 virtual void render( QwtPlot*,
131 QPainter*, const QRectF& plotRect ) const;
132
133 virtual void renderTitle( const QwtPlot*,
134 QPainter*, const QRectF& titleRect ) const;
135
136 virtual void renderFooter( const QwtPlot*,
137 QPainter*, const QRectF& footerRect ) const;
138
139 virtual void renderScale( const QwtPlot*, QPainter*,
140 QwtAxisId, int startDist, int endDist,
141 int baseDist, const QRectF& scaleRect ) const;
142
143 virtual void renderCanvas( const QwtPlot*,
144 QPainter*, const QRectF& canvasRect,
145 const QwtScaleMap* maps ) const;
146
147 virtual void renderLegend(
148 const QwtPlot*, QPainter*, const QRectF& legendRect ) const;
149
150 bool exportTo( QwtPlot*, const QString& documentName,
151 const QSizeF& sizeMM = QSizeF( 300, 200 ), int resolution = 85 );
152
153 private:
154 void buildCanvasMaps( const QwtPlot*,
155 const QRectF&, QwtScaleMap maps[] ) const;
156
157 bool updateCanvasMargins( QwtPlot*,
158 const QRectF&, const QwtScaleMap maps[] ) const;
159
160 private:
161 class PrivateData;
162 PrivateData* m_data;
163 };
164
165 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::DiscardFlags )
166 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::LayoutFlags )
167
168 #endif
QwtPlot
A 2-D plotting widget.
Definition: qwt_plot.h:79
QwtPlotRenderer
Renderer for exporting a plot to a document, a printer or anything else, that is supported by QPainte...
Definition: qwt_plot_renderer.h:40
QwtPlotRenderer::LayoutFlag
LayoutFlag
Layout flags.
Definition: qwt_plot_renderer.h:83
QwtPlotRenderer::DiscardFlag
DiscardFlag
Discard flags.
Definition: qwt_plot_renderer.h:46
QwtPlotRenderer::LayoutFlags
QFlags< LayoutFlag > LayoutFlags
Definition: qwt_plot_renderer.h:94
QwtPlotRenderer::DiscardFlags
QFlags< DiscardFlag > DiscardFlags
Definition: qwt_plot_renderer.h:76
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:27