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

An item which draws scales and grid lines on a polar plot 更多...

#include <qwt_polar_grid.h>

类 QwtPolarGrid 继承关系图:
QwtPolarItem

class  PrivateData
 

Public 类型

enum  DisplayFlag {
  SmartOriginLabel = 1 , HideMaxRadiusLabel = 2 , ClipAxisBackground = 4 , SmartScaleDraw = 8 ,
  ClipGridLines = 16
}
 Display flags to avoid conflicts when painting scales and grid lines 更多...
 
enum  GridAttribute { AutoScaling = 0x01 }
 Grid attributes 更多...
 
- Public 类型 继承自 QwtPolarItem
enum  RttiValues {
  Rtti_PolarItem = 0 , Rtti_PolarGrid , Rtti_PolarMarker , Rtti_PolarCurve ,
  Rtti_PolarSpectrogram , Rtti_PolarUserItem = 1000
}
 Runtime type information 更多...
 
enum  ItemAttribute { Legend = 0x01 , AutoScale = 0x02 }
 Plot Item Attributes 更多...
 
enum  RenderHint { RenderAntialiased = 0x01 }
 Render hints 更多...
 

Public 成员函数

 QwtPolarGrid ()
 Constructor
 
 ~QwtPolarGrid () override
 Destructor
 
virtual int rtti () const override
 Get the runtime type information
 
void setDisplayFlag (DisplayFlag, bool on=true)
 Set a display flag
 
bool testDisplayFlag (DisplayFlag) const
 Test a display flag
 
void setGridAttribute (GridAttribute, bool on=true)
 Set a grid attribute
 
bool testGridAttribute (GridAttribute) const
 Test a grid attribute
 
void showGrid (int scaleId, bool show=true)
 Show/hide the grid for a scale
 
bool isGridVisible (int scaleId) const
 Check if the grid is visible for a scale
 
void showMinorGrid (int scaleId, bool show=true)
 Show/hide the minor grid for a scale
 
bool isMinorGridVisible (int scaleId) const
 Check if the minor grid is visible for a scale
 
void showAxis (int axisId, bool show=true)
 Show/hide an axis
 
bool isAxisVisible (int axisId) const
 Check if an axis is visible
 
void setPen (const QPen &p)
 Set the pen
 
void setFont (const QFont &)
 Set the font
 
void setMajorGridPen (const QPen &p)
 Set the major grid pen
 
void setMajorGridPen (int scaleId, const QPen &p)
 Set the major grid pen for a scale
 
QPen majorGridPen (int scaleId) const
 Get the major grid pen for a scale
 
void setMinorGridPen (const QPen &p)
 Set the minor grid pen
 
void setMinorGridPen (int scaleId, const QPen &p)
 Set the minor grid pen for a scale
 
QPen minorGridPen (int scaleId) const
 Get the minor grid pen for a scale
 
void setAxisPen (int axisId, const QPen &p)
 Set the axis pen
 
QPen axisPen (int axisId) const
 Get the axis pen
 
void setAxisFont (int axisId, const QFont &p)
 Set the axis font
 
QFont axisFont (int axisId) const
 Get the axis font
 
void setScaleDraw (int axisId, QwtScaleDraw *)
 Set the scale draw for an axis
 
const QwtScaleDrawscaleDraw (int axisId) const
 Get the scale draw for an axis (const version)
 
QwtScaleDrawscaleDraw (int axisId)
 Get the scale draw for an axis
 
void setAzimuthScaleDraw (QwtRoundScaleDraw *)
 Set the azimuth scale draw
 
const QwtRoundScaleDrawazimuthScaleDraw () const
 Get the azimuth scale draw (const version)
 
QwtRoundScaleDrawazimuthScaleDraw ()
 Get the azimuth scale draw
 
virtual void draw (QPainter *p, const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, const QPointF &pole, double radius, const QRectF &rect) const override
 Draw the grid
 
virtual void updateScaleDiv (const QwtScaleDiv &azimuthMap, const QwtScaleDiv &radialMap, const QwtInterval &) override
 Update the scale division
 
virtual int marginHint () const override
 Get the margin hint
 
- Public 成员函数 继承自 QwtPolarItem
 QwtPolarItem (const QwtText &title=QwtText())
 Constructor
 
virtual ~QwtPolarItem ()
 Destructor
 
void attach (QwtPolarPlot *plot)
 Attach the item to a plot
 
void detach ()
 Detach the item from its plot
 
QwtPolarPlotplot () const
 Get the attached plot
 
void setTitle (const QString &title)
 Set the title from a QString
 
void setTitle (const QwtText &title)
 Set the title from a QwtText
 
const QwtTexttitle () const
 Get the title
 
void setItemAttribute (ItemAttribute, bool on=true)
 Set an item attribute
 
bool testItemAttribute (ItemAttribute) const
 Test an item attribute
 
void setRenderHint (RenderHint, bool on=true)
 Set a render hint
 
bool testRenderHint (RenderHint) const
 Test a render hint
 
void setRenderThreadCount (uint numThreads)
 Set the number of render threads
 
uint renderThreadCount () const
 Get the number of render threads
 
double z () const
 Get the z value
 
void setZ (double z)
 Set the z value
 
void show ()
 Show the item
 
void hide ()
 Hide the item
 
virtual void setVisible (bool)
 Set the visibility
 
bool isVisible () const
 Get the visibility
 
virtual void itemChanged ()
 Update the item and trigger autoRefresh
 
virtual void legendChanged ()
 Update the legend
 
virtual QwtInterval boundingInterval (int scaleId) const
 Get the bounding interval for a scale
 
void setLegendIconSize (const QSize &)
 Set the legend icon size
 
QSize legendIconSize () const
 Get the legend icon size
 
virtual QList< QwtLegendDatalegendData () const
 Get the legend data
 
virtual QwtGraphic legendIcon (int index, const QSizeF &) const
 Get the legend icon
 

Protected 成员函数

void drawRays (QPainter *, const QRectF &, const QPointF &pole, double radius, const QwtScaleMap &azimuthMap, const QList< double > &) const
 Draw the rays
 
void drawCircles (QPainter *, const QRectF &, const QPointF &pole, const QwtScaleMap &radialMap, const QList< double > &) const
 Draw the circles
 
void drawAxis (QPainter *, int axisId) const
 Draw an axis
 

详细描述

An item which draws scales and grid lines on a polar plot

The QwtPolarGrid class can be used to draw a coordinate grid. A coordinate grid consists of major and minor gridlines. The locations of the gridlines are determined by the azimuth and radial scale divisions.

QwtPolarGrid is also responsible for drawing the axis representing the scales. It is possible to display 4 radial and one azimuth axis.

Whenever the scale divisions of the plot widget changes the grid is synchronized by updateScaleDiv().

参见
QwtPolarPlot, QwtPolar::Axis

成员枚举类型说明

◆ DisplayFlag

Display flags to avoid conflicts when painting scales and grid lines

The default setting enables all flags.

参见
setDisplayFlag(), testDisplayFlag()
枚举值
SmartOriginLabel 

Try to avoid situations, where the label of the origin is painted over another axis.

HideMaxRadiusLabel 

Often the outermost tick of the radial scale is close to the canvas border. With HideMaxRadiusLabel enabled it is not painted.

ClipAxisBackground 

The tick labels of the radial scales might be hard to read, when they are painted on top of the radial grid lines ( or on top of a curve/spectrogram ). When ClipAxisBackground the bounding rect of each label is added to the clip region.

SmartScaleDraw 

Don't paint the backbone of the radial axes, when they are very close to a line of the azimuth grid.

ClipGridLines 

All grid lines are clipped against the plot area before being painted. When the plot is zoomed in this will have an significant impact on the performance of the painting code.

◆ GridAttribute

Grid attributes

参见
setGridAttributes(), testGridAttributes()
枚举值
AutoScaling 

When AutoScaling is enabled, the radial axes will be adjusted to the interval, that is currently visible on the canvas plot.

构造及析构函数说明

◆ QwtPolarGrid()

QwtPolarGrid::QwtPolarGrid ( )
explicit

Constructor

Enables major and disables minor grid lines. The azimuth and right radial axis are visible. All other axes are hidden. AutoScaling is enabled.

Destructor

成员函数说明

◆ axisFont()

QFont QwtPolarGrid::axisFont ( int  axisId) const

Get the axis font

Get the font for the tick labels of a specific axis

参数
axisIdAxis id (QwtPolar::Axis)
返回
Font for the axis
参见
setAxisFont()

◆ axisPen()

QPen QwtPolarGrid::axisPen ( int  axisId) const

Get the axis pen

Get the pen for painting a specific axis

参数
axisIdAxis id (QwtPolar::Axis)
返回
Pen for the axis
参见
setAxisPen()

◆ azimuthScaleDraw() [1/2]

QwtRoundScaleDraw * QwtPolarGrid::azimuthScaleDraw ( )

Get the azimuth scale draw

Get the scale draw for the azimuth scale

返回
Scale draw for the azimuth scale
参见
setAzimuthScaleDraw(), scaleDraw()

◆ azimuthScaleDraw() [2/2]

const QwtRoundScaleDraw * QwtPolarGrid::azimuthScaleDraw ( ) const

Get the azimuth scale draw (const version)

Get the scale draw for the azimuth scale

返回
Scale draw for the azimuth scale
参见
setAzimuthScaleDraw(), scaleDraw()

◆ draw()

void QwtPolarGrid::draw ( QPainter *  painter,
const QwtScaleMap azimuthMap,
const QwtScaleMap radialMap,
const QPointF &  pole,
double  radius,
const QRectF &  canvasRect 
) const
overridevirtual

Draw the grid

Draw the grid and axes

参数
painterPainter
azimuthMapMaps azimuth values to values related to 0.0, M_2PI
radialMapMaps radius values into painter coordinates
polePosition of the pole in painter coordinates
radiusRadius of the complete plot area in painter coordinates
canvasRectContents rect of the canvas in painter coordinates

实现了 QwtPolarItem.

◆ drawAxis()

void QwtPolarGrid::drawAxis ( QPainter *  painter,
int  axisId 
) const
protected

Draw an axis

Paint an axis

参数
painterPainter
axisIdAxis id (QwtPolar::Axis)

◆ drawCircles()

void QwtPolarGrid::drawCircles ( QPainter *  painter,
const QRectF &  canvasRect,
const QPointF &  pole,
const QwtScaleMap radialMap,
const QList< double > &  values 
) const
protected

Draw the circles

Draw circles

参数
painterPainter
canvasRectContents rect of the canvas in painter coordinates
polePosition of the pole in painter coordinates
radialMapMaps radius values into painter coordinates.
valuesRadial values, indicating the distances from the pole

◆ drawRays()

void QwtPolarGrid::drawRays ( QPainter *  painter,
const QRectF &  canvasRect,
const QPointF &  pole,
double  radius,
const QwtScaleMap azimuthMap,
const QList< double > &  values 
) const
protected

Draw the rays

Draw lines from the pole

参数
painterPainter
canvasRectContents rect of the canvas in painter coordinates
polePosition of the pole in painter coordinates
radiusLength of the lines in painter coordinates
azimuthMapMaps azimuth values to values related to 0.0, M_2PI
valuesAzimuth values, indicating the direction of the lines

◆ isAxisVisible()

bool QwtPolarGrid::isAxisVisible ( int  axisId) const

Check if an axis is visible

参数
axisIdAxis id (QwtPolar::Axis)
返回
True if the axis is visible
参见
showAxis()

◆ isGridVisible()

bool QwtPolarGrid::isGridVisible ( int  scaleId) const

Check if the grid is visible for a scale

Check if grid lines are visible for a scale

参数
scaleIdScale id (QwtPolar::Scale)
返回
True if grid lines are enabled
参见
QwtPolar::Scale, showGrid()

◆ isMinorGridVisible()

bool QwtPolarGrid::isMinorGridVisible ( int  scaleId) const

Check if the minor grid is visible for a scale

Check if minor grid lines are visible for a scale

参数
scaleIdScale id (QwtPolar::Scale)
返回
True if minor grid lines are enabled
参见
showMinorGrid()

◆ majorGridPen()

QPen QwtPolarGrid::majorGridPen ( int  scaleId) const

Get the major grid pen for a scale

Get the pen for painting the major grid lines of a specific scale

参数
scaleIdScale id (QwtPolar::Scale)
返回
Pen for major grid lines
参见
setMajorGridPen(), minorGridPen()

◆ marginHint()

int QwtPolarGrid::marginHint ( ) const
overridevirtual

Get the margin hint

返回
Number of pixels necessary to paint the azimuth scale
参见
QwtRoundScaleDraw::extent()

重载 QwtPolarItem .

◆ minorGridPen()

QPen QwtPolarGrid::minorGridPen ( int  scaleId) const

Get the minor grid pen for a scale

Get the pen for painting the minor grid lines of a specific scale

参数
scaleIdScale id (QwtPolar::Scale)
返回
Pen for minor grid lines
参见
setMinorGridPen()

◆ rtti()

int QwtPolarGrid::rtti ( ) const
overridevirtual

Get the runtime type information

返回
QwtPlotItem::Rtti_PolarGrid

重载 QwtPolarItem .

◆ scaleDraw() [1/2]

QwtScaleDraw * QwtPolarGrid::scaleDraw ( int  axisId)

Get the scale draw for an axis

Get the scale draw of a specified axis

参数
axisIdAxis index (QwtPolar::AxisLeft <= axisId <= QwtPolar::AxisBottom)
返回
Scale draw for the axis, or nullptr if axis is invalid
参见
setScaleDraw(), azimuthScaleDraw()

◆ scaleDraw() [2/2]

const QwtScaleDraw * QwtPolarGrid::scaleDraw ( int  axisId) const

Get the scale draw for an axis (const version)

Get the scale draw of a specified axis

参数
axisIdAxis index (QwtPolar::AxisLeft <= axisId <= QwtPolar::AxisBottom)
返回
Scale draw for the axis, or nullptr if axis is invalid
参见
azimuthScaleDraw()

◆ setAxisFont()

void QwtPolarGrid::setAxisFont ( int  axisId,
const QFont &  font 
)

Set the axis font

Assign a font for the tick labels of a specific axis

参数
axisIdAxis id (QwtPolar::Axis)
fontNew font
参见
axisFont()

◆ setAxisPen()

void QwtPolarGrid::setAxisPen ( int  axisId,
const QPen &  pen 
)

Set the axis pen

Assign a pen for painting an axis

参数
axisIdAxis id (QwtPolar::Axis)
penPen for the axis
参见
axisPen()

◆ setAzimuthScaleDraw()

void QwtPolarGrid::setAzimuthScaleDraw ( QwtRoundScaleDraw scaleDraw)

Set the azimuth scale draw

Set a scale draw for the azimuth scale

参数
scaleDrawObject responsible for drawing scales (ownership is transferred)
参见
azimuthScaleDraw(), setScaleDraw()

◆ setDisplayFlag()

void QwtPolarGrid::setDisplayFlag ( DisplayFlag  flag,
bool  on = true 
)

Set a display flag

Change the display flags

参数
flagDisplay flag to modify
onTrue to enable, false to disable
参见
DisplayFlag

◆ setFont()

void QwtPolarGrid::setFont ( const QFont &  font)

Set the font

Assign a font for all scale tick labels

参数
fontFont for all scale tick labels
参见
setAxisFont()

◆ setGridAttribute()

void QwtPolarGrid::setGridAttribute ( GridAttribute  attribute,
bool  on = true 
)

Set a grid attribute

Specify an attribute for the grid

参数
attributeGrid attribute to set
onTrue to enable, false to disable
参见
GridAttribute, testGridAttribute(), updateScaleDiv(), QwtPolarPlot::zoom(), QwtPolarPlot::scaleDiv()

◆ setMajorGridPen() [1/2]

void QwtPolarGrid::setMajorGridPen ( const QPen &  pen)

Set the major grid pen

Assign a pen for the major grid lines

参数
penPen for major grid lines
参见
setPen(), setMinorGridPen(), majorGridPen()

◆ setMajorGridPen() [2/2]

void QwtPolarGrid::setMajorGridPen ( int  scaleId,
const QPen &  pen 
)

Set the major grid pen for a scale

Assign a pen for the major grid lines of a specific scale

参数
scaleIdScale id (QwtPolar::Scale)
penPen for major grid lines
参见
setPen(), setMinorGridPen(), majorGridPen()

◆ setMinorGridPen() [1/2]

void QwtPolarGrid::setMinorGridPen ( const QPen &  pen)

Set the minor grid pen

Assign a pen for the minor grid lines

参数
penPen for minor grid lines
参见
setPen(), setMajorGridPen(), minorGridPen()

◆ setMinorGridPen() [2/2]

void QwtPolarGrid::setMinorGridPen ( int  scaleId,
const QPen &  pen 
)

Set the minor grid pen for a scale

Assign a pen for the minor grid lines of a specific scale

参数
scaleIdScale id (QwtPolar::Scale)
penPen for minor grid lines
参见
setPen(), setMajorGridPen(), minorGridPen()

◆ setPen()

void QwtPolarGrid::setPen ( const QPen &  pen)

Set the pen

Assign a pen for all axes and grid lines

参数
penPen for all axes and grid lines
参见
setMajorGridPen(), setMinorGridPen(), setAxisPen()

◆ setScaleDraw()

void QwtPolarGrid::setScaleDraw ( int  axisId,
QwtScaleDraw scaleDraw 
)

Set the scale draw for an axis

Set a scale draw for a specified axis

参数
axisIdAxis index (QwtPolar::AxisLeft <= axisId <= QwtPolar::AxisBottom)
scaleDrawObject responsible for drawing scales (ownership is transferred)
参见
scaleDraw(), setAzimuthScaleDraw()

◆ showAxis()

void QwtPolarGrid::showAxis ( int  axisId,
bool  show = true 
)

Show/hide an axis

参数
axisIdAxis id (QwtPolar::Axis)
showTrue to show, false to hide
参见
isAxisVisible()

◆ showGrid()

void QwtPolarGrid::showGrid ( int  scaleId,
bool  show = true 
)

Show/hide the grid for a scale

Show/hide grid lines for a scale

参数
scaleIdScale id (QwtPolar::Scale)
showTrue to show, false to hide
参见
QwtPolar::Scale, isGridVisible()

◆ showMinorGrid()

void QwtPolarGrid::showMinorGrid ( int  scaleId,
bool  show = true 
)

Show/hide the minor grid for a scale

Show/hide minor grid lines for a scale

参数
scaleIdScale id (QwtPolar::Scale)
showTrue to show, false to hide

To display minor grid lines, showGrid() needs to be enabled too.

参见
showGrid()

◆ testDisplayFlag()

bool QwtPolarGrid::testDisplayFlag ( DisplayFlag  flag) const

Test a display flag

参数
flagDisplay flag to test
返回
True if flag is enabled
参见
DisplayFlag

◆ testGridAttribute()

bool QwtPolarGrid::testGridAttribute ( GridAttribute  attribute) const

Test a grid attribute

参数
attributeGrid attribute to test
返回
True if attribute is enabled
参见
GridAttribute, setGridAttribute()

◆ updateScaleDiv()

void QwtPolarGrid::updateScaleDiv ( const QwtScaleDiv azimuthScaleDiv,
const QwtScaleDiv radialScaleDiv,
const QwtInterval interval 
)
overridevirtual

Update the scale division

Update the item to changes of the axes scale division

参数
azimuthScaleDivScale division of the azimuth-scale
radialScaleDivScale division of the radius-axis
intervalThe interval of the radius-axis that is visible on the canvas

If AutoScaling is enabled the radial scale is calculated from the interval, otherwise the scales are adopted to the plot scales.

参见
QwtPolarPlot::setGridAttributes()

重载 QwtPolarItem .


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