qwt_plot_renderer.h
Go to the documentation of this file.
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 #if QT_VERSION >= 0x040500
30 class QSvgGenerator;
31 #endif
32 #endif
33 #endif
34 
39 class QWT_EXPORT QwtPlotRenderer: public QObject
40 {
41  Q_OBJECT
42 
43 public:
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 
77  typedef QFlags<DiscardFlag> DiscardFlags;
78 
84  {
86  DefaultLayout = 0x00,
87 
92  FrameWithScales = 0x01
93  };
94 
96  typedef QFlags<LayoutFlag> LayoutFlags;
97 
98  explicit QwtPlotRenderer( QObject * = NULL );
99  virtual ~QwtPlotRenderer();
100 
101  void setDiscardFlag( DiscardFlag flag, bool on = true );
102  bool testDiscardFlag( DiscardFlag flag ) const;
103 
104  void setDiscardFlags( DiscardFlags flags );
105  DiscardFlags discardFlags() const;
106 
107  void setLayoutFlag( LayoutFlag flag, bool on = true );
108  bool testLayoutFlag( LayoutFlag flag ) const;
109 
110  void setLayoutFlags( LayoutFlags flags );
111  LayoutFlags layoutFlags() const;
112 
113  void renderDocument( QwtPlot *, const QString &fileName,
114  const QSizeF &sizeMM, int resolution = 85 );
115 
116  void renderDocument( QwtPlot *,
117  const QString &fileName, const QString &format,
118  const QSizeF &sizeMM, int resolution = 85 );
119 
120 #ifndef QWT_NO_SVG
121 #ifdef QT_SVG_LIB
122 #if QT_VERSION >= 0x040500
123  void renderTo( QwtPlot *, QSvgGenerator & ) const;
124 #endif
125 #endif
126 #endif
127 
128 #ifndef QT_NO_PRINTER
129  void renderTo( QwtPlot *, QPrinter & ) const;
130 #endif
131 
132  void renderTo( QwtPlot *, QPaintDevice &p ) const;
133 
134  virtual void render( QwtPlot *,
135  QPainter *, const QRectF &rect ) const;
136 
137  virtual void renderTitle( const QwtPlot *,
138  QPainter *, const QRectF & ) const;
139 
140  virtual void renderFooter( const QwtPlot *,
141  QPainter *, const QRectF & ) const;
142 
143  virtual void renderScale( const QwtPlot *, QPainter *,
144  int axisId, int startDist, int endDist,
145  int baseDist, const QRectF & ) const;
146 
147  virtual void renderCanvas( const QwtPlot *,
148  QPainter *, const QRectF &canvasRect,
149  const QwtScaleMap* maps ) const;
150 
151  virtual void renderLegend(
152  const QwtPlot *, QPainter *, const QRectF & ) const;
153 
154  bool exportTo( QwtPlot *, const QString &documentName,
155  const QSizeF &sizeMM = QSizeF( 300, 200 ), int resolution = 85 );
156 
157 private:
158  void buildCanvasMaps( const QwtPlot *,
159  const QRectF &, QwtScaleMap maps[] ) const;
160 
161  bool updateCanvasMargins( QwtPlot *,
162  const QRectF &, const QwtScaleMap maps[] ) const;
163 
164 private:
165  class PrivateData;
167 };
168 
169 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::DiscardFlags )
170 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::LayoutFlags )
171 
172 #endif
LayoutFlag
Layout flags.
#define QWT_EXPORT
Definition: qwt_global.h:38
A 2-D plotting widget.
Definition: qwt_plot.h:74
Renderer for exporting a plot to a document, a printer or anything else, that is supported by QPainte...
DiscardFlag
Disard flags.
PrivateData * d_data
QFlags< DiscardFlag > DiscardFlags
Disard flags.
A scale map.
Definition: qwt_scale_map.h:30
QFlags< LayoutFlag > LayoutFlags
Layout flags.


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17