qwt_plot_renderer.h
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* 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 <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
};
typedef QFlags<DiscardFlag> DiscardFlags;
enum LayoutFlag
{
DefaultLayout = 0x00,
FrameWithScales = 0x01
};
typedef QFlags<LayoutFlag> LayoutFlags;
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
#if QT_VERSION >= 0x040500
void renderTo( QwtPlot *, QSvgGenerator & ) const;
#endif
#endif
#endif
#ifndef QT_NO_PRINTER
void renderTo( QwtPlot *, QPrinter & ) const;
#endif
void renderTo( QwtPlot *, QPaintDevice &p ) const;
virtual void render( QwtPlot *,
QPainter *, const QRectF &rect ) const;
virtual void renderTitle( const QwtPlot *,
QPainter *, const QRectF & ) const;
virtual void renderFooter( const QwtPlot *,
QPainter *, const QRectF & ) const;
virtual void renderScale( const QwtPlot *, QPainter *,
int axisId, int startDist, int endDist,
int baseDist, const QRectF & ) const;
virtual void renderCanvas( const QwtPlot *,
QPainter *, const QRectF &canvasRect,
const QwtScaleMap* maps ) const;
virtual void renderLegend(
const QwtPlot *, QPainter *, const QRectF & ) 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 *d_data;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::DiscardFlags )
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::LayoutFlags )
#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