QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
| Public 类型 | Public 成员函数 | 所有成员列表
QwtPlotRenderer类 参考

Renderer for exporting a plot to a document, a printer or anything else, that is supported by QPainter/QPaintDevice 更多...

#include <qwt_plot_renderer.h>

类 QwtPlotRenderer 继承关系图:

class  PrivateData
 

Public 类型

enum  DiscardFlag {
  DiscardNone = 0x00 , DiscardBackground = 0x01 , DiscardTitle = 0x02 , DiscardLegend = 0x04 ,
  DiscardCanvasBackground = 0x08 , DiscardFooter = 0x10 , DiscardCanvasFrame = 0x20
}
 Discard flags 更多...
 
enum  LayoutFlag { DefaultLayout = 0x00 , FrameWithScales = 0x01 }
 Layout flags 更多...
 

Public 成员函数

 QwtPlotRenderer (QObject *=nullptr)
 Constructor
 
void setDiscardFlag (DiscardFlag flag, bool on=true)
 Change a flag, indicating what to discard from rendering
 
bool testDiscardFlag (DiscardFlag flag) const
 Test if a discard flag is enabled
 
void setDiscardFlags (DiscardFlags flags)
 Set the flags, indicating what to discard from rendering
 
DiscardFlags discardFlags () const
 Get the flags indicating what to discard from rendering
 
void setLayoutFlag (LayoutFlag flag, bool on=true)
 Change a layout flag
 
bool testLayoutFlag (LayoutFlag flag) const
 Test if a layout flag is enabled
 
void setLayoutFlags (LayoutFlags flags)
 Set the layout flags
 
LayoutFlags layoutFlags () const
 Get the layout flags
 
void renderDocument (QwtPlot *, const QString &fileName, const QSizeF &sizeMM, int resolution=85)
 Render a plot to a file
 
void renderDocument (QwtPlot *, const QString &fileName, const QString &format, const QSizeF &sizeMM, int resolution=85)
 Render a plot to a file with specified format
 
void renderTo (QwtPlot *, QPrinter &) const
 Render the plot to a QPrinter
 
void renderTo (QwtPlot *, QPaintDevice &) const
 Render the plot to a QPaintDevice
 
virtual void render (QwtPlot *, QPainter *, const QRectF &plotRect) const
 Paint the contents of a QwtPlot instance into a given rectangle
 
virtual void renderTitle (const QwtPlot *, QPainter *, const QRectF &titleRect) const
 Render the title into a given rectangle
 
virtual void renderFooter (const QwtPlot *, QPainter *, const QRectF &footerRect) const
 Render the footer into a given rectangle
 
virtual void renderScale (const QwtPlot *, QPainter *, QwtAxisId, int startDist, int endDist, int baseDist, const QRectF &scaleRect) const
 Paint a scale into a given rectangle
 
virtual void renderCanvas (const QwtPlot *, QPainter *, const QRectF &canvasRect, const QwtScaleMap *maps) const
 Render the canvas into a given rectangle
 
virtual void renderLegend (const QwtPlot *, QPainter *, const QRectF &legendRect) const
 Render the legend into a given rectangle
 
bool exportTo (QwtPlot *, const QString &documentName, const QSizeF &sizeMM=QSizeF(300, 200), int resolution=85)
 Execute a file dialog and render the plot to the selected file
 

详细描述

Renderer for exporting a plot to a document, a printer or anything else, that is supported by QPainter/QPaintDevice

成员枚举类型说明

◆ DiscardFlag

Discard flags

Flags to control which components of the plot are rendered

枚举值
DiscardNone 

Render all components of the plot

DiscardBackground 

Don't render the background of the plot

DiscardTitle 

Don't render the title of the plot

DiscardLegend 

Don't render the legend of the plot

DiscardCanvasBackground 

Don't render the background of the canvas

DiscardFooter 

Don't render the footer of the plot

Don't render the frame of the canvas

注解
This flag has no effect when using style sheets, where the frame is part of the background

◆ LayoutFlag

Layout flags

Flags to control the layout of the rendered plot

参见
setLayoutFlag(), testLayoutFlag()
枚举值
DefaultLayout 

Use the default layout as on screen

Instead of the scales a box is painted around the plot canvas, where the scale ticks are aligned to.

构造及析构函数说明

◆ QwtPlotRenderer()

QwtPlotRenderer::QwtPlotRenderer ( QObject *  parent = nullptr)
explicit

Constructor

参数
[in]parentParent object

Destructor

成员函数说明

◆ discardFlags()

QwtPlotRenderer::DiscardFlags QwtPlotRenderer::discardFlags ( ) const

Get the flags indicating what to discard from rendering

返回
Flags indicating what to discard from rendering
参见
DiscardFlag, setDiscardFlags(), setDiscardFlag(), testDiscardFlag()

◆ exportTo()

bool QwtPlotRenderer::exportTo ( QwtPlot plot,
const QString &  documentName,
const QSizeF &  sizeMM = QSizeF(300, 200),
int  resolution = 85 
)

Execute a file dialog and render the plot to the selected file

参数
[in]plotPlot widget
[in]documentNameDefault document name
[in]sizeMMSize for the document in millimeters
[in]resolutionResolution in dots per Inch (dpi)
返回
True when exporting was successful
参见
renderDocument()

◆ layoutFlags()

QwtPlotRenderer::LayoutFlags QwtPlotRenderer::layoutFlags ( ) const

Get the layout flags

返回
Layout flags
参见
LayoutFlag, setLayoutFlags(), setLayoutFlag(), testLayoutFlag()

◆ render()

void QwtPlotRenderer::render ( QwtPlot plot,
QPainter *  painter,
const QRectF &  plotRect 
) const
virtual

Paint the contents of a QwtPlot instance into a given rectangle

参数
[in]plotPlot to be rendered
[in]painterPainter
[in]plotRectBounding rectangle
参见
renderDocument(), renderTo(), QwtPainter::setRoundingAlignment()

◆ renderCanvas()

void QwtPlotRenderer::renderCanvas ( const QwtPlot plot,
QPainter *  painter,
const QRectF &  canvasRect,
const QwtScaleMap maps 
) const
virtual

Render the canvas into a given rectangle

参数
[in]plotPlot widget
[in]painterPainter
[in]canvasRectCanvas rectangle
[in]mapsMaps mapping between plot and paint device coordinates

◆ renderDocument() [1/2]

void QwtPlotRenderer::renderDocument ( QwtPlot plot,
const QString &  fileName,
const QSizeF &  sizeMM,
int  resolution = 85 
)

Render a plot to a file

The format of the document will be auto-detected from the suffix of the file name.

参数
[in]plotPlot widget
[in]fileNamePath of the file where the document will be stored
[in]sizeMMSize for the document in millimeters
[in]resolutionResolution in dots per Inch (dpi)

◆ renderDocument() [2/2]

void QwtPlotRenderer::renderDocument ( QwtPlot plot,
const QString &  fileName,
const QString &  format,
const QSizeF &  sizeMM,
int  resolution = 85 
)

Render a plot to a file with specified format

Supported formats are:

  • pdf: Portable Document Format PDF
  • ps: PostScript
  • svg: Scalable Vector Graphics SVG
  • all image formats supported by Qt (see QImageWriter::supportedImageFormats()) Scalable vector graphic formats like PDF or SVG are superior to raster graphics formats.
    参数
    [in]plotPlot widget
    [in]fileNamePath of the file where the document will be stored
    [in]formatFormat for the document
    [in]sizeMMSize for the document in millimeters
    [in]resolutionResolution in dots per Inch (dpi)
    参见
    renderTo(), render(), QwtPainter::setRoundingAlignment()

◆ renderFooter()

void QwtPlotRenderer::renderFooter ( const QwtPlot plot,
QPainter *  painter,
const QRectF &  footerRect 
) const
virtual

Render the footer into a given rectangle

参数
[in]plotPlot widget
[in]painterPainter
[in]footerRectBounding rectangle for the footer

◆ renderLegend()

void QwtPlotRenderer::renderLegend ( const QwtPlot plot,
QPainter *  painter,
const QRectF &  legendRect 
) const
virtual

Render the legend into a given rectangle

参数
[in]plotPlot widget
[in]painterPainter
[in]legendRectBounding rectangle for the legend

◆ renderScale()

void QwtPlotRenderer::renderScale ( const QwtPlot plot,
QPainter *  painter,
QwtAxisId  axisId,
int  startDist,
int  endDist,
int  baseDist,
const QRectF &  scaleRect 
) const
virtual

Paint a scale into a given rectangle

Render the scale into a given rectangle.

参数
[in]plotPlot widget
[in]painterPainter
[in]axisIdAxis identifier
[in]startDistStart border distance
[in]endDistEnd border distance
[in]baseDistBase distance
[in]scaleRectBounding rectangle for the scale

◆ renderTitle()

void QwtPlotRenderer::renderTitle ( const QwtPlot plot,
QPainter *  painter,
const QRectF &  titleRect 
) const
virtual

Render the title into a given rectangle

参数
[in]plotPlot widget
[in]painterPainter
[in]titleRectBounding rectangle for the title

◆ renderTo() [1/2]

void QwtPlotRenderer::renderTo ( QwtPlot plot,
QPaintDevice &  paintDevice 
) const

Render the plot to a QPaintDevice

This function renders the contents of a QwtPlot instance to QPaintDevice object. The target rectangle is derived from its device metrics.

参数
[in]plotPlot to be rendered
[in]paintDeviceDevice to paint on, f.e. a QImage
参见
renderDocument(), render(), QwtPainter::setRoundingAlignment()

◆ renderTo() [2/2]

void QwtPlotRenderer::renderTo ( QwtPlot plot,
QPrinter &  printer 
) const

Render the plot to a QPrinter

This function renders the contents of a QwtPlot instance to QPaintDevice object. The size is derived from the printer metrics.

参数
[in]plotPlot to be rendered
[in]printerPrinter to paint on
参见
renderDocument(), render(), QwtPainter::setRoundingAlignment()

◆ setDiscardFlag()

void QwtPlotRenderer::setDiscardFlag ( DiscardFlag  flag,
bool  on = true 
)

Change a flag, indicating what to discard from rendering

参数
[in]flagFlag to change
[in]onOn/Off
参见
DiscardFlag, testDiscardFlag(), setDiscardFlags(), discardFlags()

◆ setDiscardFlags()

void QwtPlotRenderer::setDiscardFlags ( DiscardFlags  flags)

Set the flags, indicating what to discard from rendering

参数
[in]flagsFlags to set
参见
DiscardFlag, setDiscardFlag(), testDiscardFlag(), discardFlags()

◆ setLayoutFlag()

void QwtPlotRenderer::setLayoutFlag ( LayoutFlag  flag,
bool  on = true 
)

Change a layout flag

参数
[in]flagFlag to change
[in]onOn/Off
参见
LayoutFlag, testLayoutFlag(), setLayoutFlags(), layoutFlags()

◆ setLayoutFlags()

void QwtPlotRenderer::setLayoutFlags ( LayoutFlags  flags)

Set the layout flags

参数
[in]flagsFlags to set
参见
LayoutFlag, setLayoutFlag(), testLayoutFlag(), layoutFlags()

◆ testDiscardFlag()

bool QwtPlotRenderer::testDiscardFlag ( DiscardFlag  flag) const

Test if a discard flag is enabled

参数
[in]flagFlag to be tested
返回
True if flag is enabled
参见
DiscardFlag, setDiscardFlag(), setDiscardFlags(), discardFlags()

◆ testLayoutFlag()

bool QwtPlotRenderer::testLayoutFlag ( LayoutFlag  flag) const

Test if a layout flag is enabled

参数
[in]flagFlag to be tested
返回
True if flag is enabled
参见
LayoutFlag, setLayoutFlag(), setLayoutFlags(), layoutFlags()

该类的文档由以下文件生成: