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 
15 #include <qobject.h>
16 #include <qsize.h>
17 
18 class QwtPlot;
19 class QwtScaleMap;
20 class QRectF;
21 class QPainter;
22 class QPaintDevice;
23 
24 #ifndef QT_NO_PRINTER
25 class QPrinter;
26 #endif
27 
28 #ifndef QWT_NO_SVG
29 #ifdef QT_SVG_LIB
30 class QSvgGenerator;
31 #endif
32 #endif
33 
38 class QWT_EXPORT QwtPlotRenderer: public QObject
39 {
40  Q_OBJECT
41 
42 public:
45  {
47  DiscardNone = 0x00,
48 
50  DiscardBackground = 0x01,
51 
53  DiscardTitle = 0x02,
54 
56  DiscardLegend = 0x04,
57 
59  DiscardCanvasBackground = 0x08,
60 
62  DiscardFooter = 0x10,
63 
71  DiscardCanvasFrame = 0x20
72 
73  };
74 
76  typedef QFlags<DiscardFlag> DiscardFlags;
77 
83  {
85  DefaultLayout = 0x00,
86 
91  FrameWithScales = 0x01
92  };
93 
95  typedef QFlags<LayoutFlag> LayoutFlags;
96 
97  explicit QwtPlotRenderer( QObject * = NULL );
98  virtual ~QwtPlotRenderer();
99 
100  void setDiscardFlag( DiscardFlag flag, bool on = true );
101  bool testDiscardFlag( DiscardFlag flag ) const;
102 
103  void setDiscardFlags( DiscardFlags flags );
104  DiscardFlags discardFlags() const;
105 
106  void setLayoutFlag( LayoutFlag flag, bool on = true );
107  bool testLayoutFlag( LayoutFlag flag ) const;
108 
109  void setLayoutFlags( LayoutFlags flags );
110  LayoutFlags layoutFlags() const;
111 
112  void renderDocument( QwtPlot *, const QString &fileName,
113  const QSizeF &sizeMM, int resolution = 85 );
114 
115  void renderDocument( QwtPlot *,
116  const QString &fileName, const QString &format,
117  const QSizeF &sizeMM, int resolution = 85 );
118 
119 #ifndef QWT_NO_SVG
120 #ifdef QT_SVG_LIB
121  void renderTo( QwtPlot *, QSvgGenerator & ) const;
122 #endif
123 #endif
124 
125 #ifndef QT_NO_PRINTER
126  void renderTo( QwtPlot *, QPrinter & ) const;
127 #endif
128 
129  void renderTo( QwtPlot *, QPaintDevice & ) const;
130 
131  virtual void render( QwtPlot *,
132  QPainter *, const QRectF &plotRect ) const;
133 
134  virtual void renderTitle( const QwtPlot *,
135  QPainter *, const QRectF &titleRect ) const;
136 
137  virtual void renderFooter( const QwtPlot *,
138  QPainter *, const QRectF &footerRect ) const;
139 
140  virtual void renderScale( const QwtPlot *, QPainter *,
141  int axisId, int startDist, int endDist,
142  int baseDist, const QRectF &scaleRect ) const;
143 
144  virtual void renderCanvas( const QwtPlot *,
145  QPainter *, const QRectF &canvasRect,
146  const QwtScaleMap* maps ) const;
147 
148  virtual void renderLegend(
149  const QwtPlot *, QPainter *, const QRectF &legendRect ) const;
150 
151  bool exportTo( QwtPlot *, const QString &documentName,
152  const QSizeF &sizeMM = QSizeF( 300, 200 ), int resolution = 85 );
153 
154 private:
155  void buildCanvasMaps( const QwtPlot *,
156  const QRectF &, QwtScaleMap maps[] ) const;
157 
158  bool updateCanvasMargins( QwtPlot *,
159  const QRectF &, const QwtScaleMap maps[] ) const;
160 
161 private:
162  class PrivateData;
164 };
165 
166 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::DiscardFlags )
167 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::LayoutFlags )
168 
169 #endif
LayoutFlag
Layout flags.
FMT_INLINE std::basic_string< Char > format(const S &format_str, Args &&...args)
Definition: core.h:2081
#define QWT_EXPORT
Definition: qwt_global.h:38
A 2-D plotting widget.
Definition: qwt_plot.h:75
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:26
QFlags< LayoutFlag > LayoutFlags
Layout flags.


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10