qwt_plot_renderer.h
/******************************************************************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_PLOT_RENDERER_H
#define QWT_PLOT_RENDERER_H
#include "qwt_global.h"
#include "qwt_axis_id.h"
#include <qobject.h>
#include <qsize.h>
class QwtPlot;
class QwtScaleMap;
class QRectF;
class QPainter;
class QPaintDevice;
#ifndef QT_NO_PRINTER
class QPrinter;
#endif
#ifndef QWT_NO_SVG
#ifdef QT_SVG_LIB
class QSvgGenerator;
#endif
#endif
class QWT_EXPORT QwtPlotRenderer : public QObject
{
Q_OBJECT
public:
enum DiscardFlag
{
DiscardNone = 0x00,
DiscardBackground = 0x01,
DiscardTitle = 0x02,
DiscardLegend = 0x04,
DiscardCanvasBackground = 0x08,
DiscardFooter = 0x10,
DiscardCanvasFrame = 0x20
};
Q_DECLARE_FLAGS( DiscardFlags, DiscardFlag )
enum LayoutFlag
{
DefaultLayout = 0x00,
FrameWithScales = 0x01
};
Q_DECLARE_FLAGS( LayoutFlags, LayoutFlag )
explicit 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& fileName,
const QSizeF& sizeMM, int resolution = 85 );
void renderDocument( QwtPlot*,
const QString& fileName, const QString& format,
const QSizeF& sizeMM, int resolution = 85 );
#ifndef QWT_NO_SVG
#ifdef QT_SVG_LIB
void renderTo( QwtPlot*, QSvgGenerator& ) const;
#endif
#endif
#ifndef QT_NO_PRINTER
void renderTo( QwtPlot*, QPrinter& ) const;
#endif
void renderTo( QwtPlot*, QPaintDevice& ) const;
virtual void render( QwtPlot*,
QPainter*, const QRectF& plotRect ) const;
virtual void renderTitle( const QwtPlot*,
QPainter*, const QRectF& titleRect ) const;
virtual void renderFooter( const QwtPlot*,
QPainter*, const QRectF& footerRect ) const;
virtual void renderScale( const QwtPlot*, QPainter*,
QwtAxisId, int startDist, int endDist,
int baseDist, const QRectF& scaleRect ) const;
virtual void renderCanvas( const QwtPlot*,
QPainter*, const QRectF& canvasRect,
const QwtScaleMap* maps ) const;
virtual void renderLegend(
const QwtPlot*, QPainter*, const QRectF& legendRect ) const;
bool exportTo( QwtPlot*, const QString& documentName,
const QSizeF& sizeMM = QSizeF( 300, 200 ), int resolution = 85 );
private:
void buildCanvasMaps( const QwtPlot*,
const QRectF&, QwtScaleMap maps[] ) const;
bool updateCanvasMargins( QwtPlot*,
const QRectF&, const QwtScaleMap maps[] ) const;
private:
class PrivateData;
PrivateData* m_data;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::DiscardFlags )
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::LayoutFlags )
#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