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

A plotting widget, displaying a polar coordinate system 更多...

#include <qwt_polar_plot.h>

类 QwtPolarPlot 继承关系图:
QwtPolarItemDict

class  PrivateData
 

Public 类型

enum  LegendPosition {
  LeftLegend , RightLegend , BottomLegend , TopLegend ,
  ExternalLegend
}
 Position of the legend, relative to the canvas 更多...
 

Public 槽

virtual void replot ()
 Replot the plot
 
void autoRefresh ()
 Auto refresh the plot
 
void setAzimuthOrigin (double)
 Set the azimuth origin
 

信号

void itemAttached (QwtPolarItem *plotItem, bool on)
 A signal indicating, that an item has been attached/detached
 
void legendDataChanged (const QVariant &itemInfo, const QList< QwtLegendData > &data)
 A signal with the attributes how to update the legend entries for a plot item
 
void layoutChanged ()
 A signal that is emitted, whenever the layout of the plot has been recalculated
 

Public 成员函数

 QwtPolarPlot (QWidget *parent=nullptr)
 Constructor
 
 QwtPolarPlot (const QwtText &title, QWidget *parent=nullptr)
 Constructor with title
 
 ~QwtPolarPlot () override
 Destructor
 
void setTitle (const QString &)
 Set the title
 
void setTitle (const QwtText &)
 Set the title
 
QwtText title () const
 Get the title
 
QwtTextLabeltitleLabel ()
 Get the title label
 
const QwtTextLabeltitleLabel () const
 Get the title label (const version)
 
void setAutoReplot (bool tf=true)
 Set auto replot
 
bool autoReplot () const
 Get auto replot
 
void setAutoScale (int scaleId)
 Set auto scale for a scale
 
bool hasAutoScale (int scaleId) const
 Check if a scale has auto scale
 
void setScaleMaxMinor (int scaleId, int maxMinor)
 Set the maximum number of minor ticks for a scale
 
int scaleMaxMinor (int scaleId) const
 Get the maximum number of minor ticks for a scale
 
int scaleMaxMajor (int scaleId) const
 Get the maximum number of major ticks for a scale
 
void setScaleMaxMajor (int scaleId, int maxMajor)
 Set the maximum number of major ticks for a scale
 
QwtScaleEnginescaleEngine (int scaleId)
 Get the scale engine for a scale
 
const QwtScaleEnginescaleEngine (int scaleId) const
 Get the scale engine for a scale (const version)
 
void setScaleEngine (int scaleId, QwtScaleEngine *)
 Set the scale engine for a scale
 
void setScale (int scaleId, double min, double max, double step=0)
 Set the scale for a scale
 
void setScaleDiv (int scaleId, const QwtScaleDiv &)
 Set the scale division for a scale
 
const QwtScaleDivscaleDiv (int scaleId) const
 Get the scale division for a scale (const version)
 
QwtScaleDivscaleDiv (int scaleId)
 Get the scale division for a scale
 
QwtScaleMap scaleMap (int scaleId, double radius) const
 Get the scale map for a scale with radius
 
QwtScaleMap scaleMap (int scaleId) const
 Get the scale map for a scale
 
void updateScale (int scaleId)
 Update a scale
 
double azimuthOrigin () const
 Get the azimuth origin
 
void zoom (const QwtPointPolar &, double factor)
 Zoom to a position with a factor
 
void unzoom ()
 Unzoom the plot
 
QwtPointPolar zoomPos () const
 Get the zoom position
 
double zoomFactor () const
 Get the zoom factor
 
QwtPolarCanvascanvas ()
 Get the canvas
 
const QwtPolarCanvascanvas () const
 Get the canvas (const version)
 
void setPlotBackground (const QBrush &c)
 Set the plot background
 
const QBrush & plotBackground () const
 Get the plot background
 
void setBackgroundColor (const QColor &c)
 Set the background color
 
QColor backgroundColor () const
 Get the background color
 
virtual void drawCanvas (QPainter *, const QRectF &) const
 Draw the canvas
 
void insertLegend (QwtAbstractLegend *, LegendPosition=RightLegend, double ratio=-1.0)
 Insert a legend
 
QwtAbstractLegendlegend ()
 Get the legend
 
const QwtAbstractLegendlegend () const
 Get the legend (const version)
 
void updateLegend ()
 Update the legend
 
void updateLegend (const QwtPolarItem *)
 Update the legend for an item
 
QwtPolarLayoutplotLayout ()
 Get the plot layout
 
const QwtPolarLayoutplotLayout () const
 Get the plot layout (const version)
 
QwtInterval visibleInterval () const
 Get the visible interval
 
QRectF plotRect () const
 Get the plot rectangle
 
QRectF plotRect (const QRectF &) const
 Get the plot rectangle for a given rectangle
 
int plotMarginHint () const
 Get the plot margin hint
 
virtual QVariant itemToInfo (QwtPolarItem *) const
 Convert an item to info
 
virtual QwtPolarIteminfoToItem (const QVariant &) const
 Convert info to an item
 
- Public 成员函数 继承自 QwtPolarItemDict
 QwtPolarItemDict ()
 Constructor
 
 ~QwtPolarItemDict ()
 Destructor
 
void setAutoDelete (bool)
 Set auto delete
 
bool autoDelete () const
 Get auto delete
 
const QwtPolarItemListitemList () const
 Get the item list
 
void detachItems (int rtti=QwtPolarItem::Rtti_PolarItem, bool autoDelete=true)
 Detach items
 

Protected 成员函数

virtual bool event (QEvent *) override
 Handle events
 
virtual void resizeEvent (QResizeEvent *) override
 Handle resize events
 
virtual void updateLayout ()
 Update the layout
 
virtual void drawItems (QPainter *painter, const QwtScaleMap &radialMap, const QwtScaleMap &azimuthMap, const QPointF &pole, double radius, const QRectF &canvasRect) const
 Draw items
 
- Protected 成员函数 继承自 QwtPolarItemDict
void insertItem (QwtPolarItem *)
 Insert an item
 
void removeItem (QwtPolarItem *)
 Remove an item
 

属性

QBrush plotBackground
 
double azimuthOrigin
 

友元

class QwtPolarItem
 

详细描述

A plotting widget, displaying a polar coordinate system

An unlimited number of plot items can be displayed on its canvas. Plot items might be curves (QwtPolarCurve), markers (QwtPolarMarker), the grid (QwtPolarGrid), or anything else derived from QwtPolarItem.

The coordinate system is defined by a radial and a azimuth scale. The scales at the axes can be explicitly set (QwtScaleDiv), or are calculated from the plot items, using algorithms (QwtScaleEngine) which can be configured separately for each axis. Autoscaling is supported for the radial scale.

In opposite to QwtPlot the scales might be different from the view, that is displayed on the canvas. The view can be changed by zooming - f.e. by using QwtPolarPanner or QwtPolarMaginfier.

成员枚举类型说明

◆ LegendPosition

Position of the legend, relative to the canvas

参见
insertLegend()
枚举值
LeftLegend 

The legend will be left from the canvas

RightLegend 

The legend will be right from the canvas

BottomLegend 

The legend will be below the canvas

TopLegend 

The legend will be between canvas and title

ExternalLegend 

External means that only the content of the legend will be handled by QwtPlot, but not its geometry. This might be interesting if an application wants to have a legend in an external window ( or on the canvas ).

注解
The legend is not painted by QwtPolarRenderer

构造及析构函数说明

◆ QwtPolarPlot() [1/2]

QwtPolarPlot::QwtPolarPlot ( QWidget *  parent = nullptr)
explicit

Constructor

参数
parentParent widget

◆ QwtPolarPlot() [2/2]

QwtPolarPlot::QwtPolarPlot ( const QwtText title,
QWidget *  parent = nullptr 
)

Constructor with title

参数
titleTitle text
parentParent widget

成员函数说明

◆ autoRefresh

void QwtPolarPlot::autoRefresh ( )
slot

Auto refresh the plot

Replots the plot if autoReplot() is true

◆ autoReplot()

bool QwtPolarPlot::autoReplot ( ) const

Get auto replot

Check if autoReplot option is set

返回
true if autoReplot option is set
参见
setAutoReplot()

◆ azimuthOrigin()

double QwtPolarPlot::azimuthOrigin ( ) const

Get the azimuth origin

Get the origin of the azimuth scale

The azimuth origin is the angle where the azimuth scale shows the value 0.0.

返回
Origin of the azimuth scale
参见
setAzimuthOrigin()

◆ backgroundColor()

QColor QwtPolarPlot::backgroundColor ( ) const

Get the background color

返回
Background color
参见
setBackgroundColor()

◆ canvas() [1/2]

QwtPolarCanvas * QwtPolarPlot::canvas ( )

Get the canvas

Get the plot's canvas

返回
Canvas widget

◆ canvas() [2/2]

const QwtPolarCanvas * QwtPolarPlot::canvas ( ) const

Get the canvas (const version)

Get the plot's canvas (const version)

返回
Canvas widget

◆ drawCanvas()

void QwtPolarPlot::drawCanvas ( QPainter *  painter,
const QRectF &  canvasRect 
) const
virtual

Draw the canvas

Redraw the canvas

参数
painterPainter used for drawing
canvasRectContents rect of the canvas

◆ drawItems()

void QwtPolarPlot::drawItems ( QPainter *  painter,
const QwtScaleMap azimuthMap,
const QwtScaleMap radialMap,
const QPointF &  pole,
double  radius,
const QRectF &  canvasRect 
) const
protectedvirtual

Draw items

Redraw the canvas items

参数
painterPainter used for drawing
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

◆ event()

bool QwtPolarPlot::event ( QEvent *  e)
overrideprotectedvirtual

Handle events

Qt event handler

Handles QEvent::LayoutRequest and QEvent::PolishRequest

参数
eQt Event
返回
True when the event was processed

◆ hasAutoScale()

bool QwtPolarPlot::hasAutoScale ( int  scaleId) const

Check if a scale has auto scale

Check if autoscaling is enabled

参数
scaleIdScale index
返回
true if autoscaling is enabled
参见
setAutoScale()

◆ infoToItem()

QwtPolarItem * QwtPolarPlot::infoToItem ( const QVariant &  itemInfo) const
virtual

Convert info to an item

Identify the plot item according to an item info object

The default implementation simply tries to unwrap a QwtPolarItem pointer.

参数
itemInfoItem info object generated from itemToInfo()
返回
A plot item when successful, otherwise nullptr
参见
itemToInfo()

◆ insertLegend()

void QwtPolarPlot::insertLegend ( QwtAbstractLegend legend,
QwtPolarPlot::LegendPosition  pos = RightLegend,
double  ratio = -1.0 
)

Insert a legend

If the position legend is QwtPolarPlot::LeftLegend or QwtPolarPlot::RightLegend the legend will be organized in one column from top to down. Otherwise the legend items will be placed in a table with a best fit number of columns from left to right. If pos != QwtPolarPlot::ExternalLegend the plot widget will become parent of the legend. It will be deleted when the plot is deleted, or another legend is set with insertLegend().

参数
legendLegend widget
posThe legend's position. For top/left position the number of columns will be limited to 1, otherwise it will be set to unlimited.
ratioRatio between legend and the bounding rect of title, canvas and axes. The legend will be shrunk if it would need more space than the given ratio. The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0 it will be reset to the default ratio. The default vertical/horizontal ratio is 0.33/0.5.
参见
legend(), QwtPolarLayout::legendPosition(), QwtPolarLayout::setLegendPosition()

◆ itemAttached

void QwtPolarPlot::itemAttached ( QwtPolarItem plotItem,
bool  on 
)
signal

A signal indicating, that an item has been attached/detached

参数
plotItemPlot item
onAttached/Detached

◆ itemToInfo()

QVariant QwtPolarPlot::itemToInfo ( QwtPolarItem plotItem) const
virtual

Convert an item to info

Build an information object to identify a plot item on the legend

The default implementation simply wraps the plot item into a QVariant object. When overloading itemToInfo() usually infoToItem() needs to be reimplemented too.

参数
plotItemPlot item
返回
QVariant containing the plot item information
参见
infoToItem()

◆ legend() [1/2]

QwtAbstractLegend * QwtPolarPlot::legend ( )

Get the legend

Get the plot's legend

返回
Legend widget
参见
insertLegend()

◆ legend() [2/2]

const QwtAbstractLegend * QwtPolarPlot::legend ( ) const

Get the legend (const version)

Get the plot's legend (const version)

返回
Legend widget
参见
insertLegend()

◆ legendDataChanged

void QwtPolarPlot::legendDataChanged ( const QVariant &  itemInfo,
const QList< QwtLegendData > &  data 
)
signal

A signal with the attributes how to update the legend entries for a plot item

参数
itemInfoInfo about a plot, build from itemToInfo()
dataAttributes of the entries ( usually <= 1 ) for the plot item
参见
itemToInfo(), infoToItem(), QwtAbstractLegend::updateLegend()

◆ plotBackground()

const QBrush & QwtPolarPlot::plotBackground ( ) const

Get the plot background

Get the plot background brush

返回
Background brush
参见
plotBackground(), plotArea()

◆ plotLayout() [1/2]

QwtPolarLayout * QwtPolarPlot::plotLayout ( )

Get the plot layout

Get the layout responsible for geometry of plot components

返回
Plot layout

◆ plotLayout() [2/2]

const QwtPolarLayout * QwtPolarPlot::plotLayout ( ) const

Get the plot layout (const version)

Get the layout responsible for geometry of plot components (const version)

返回
Plot layout

◆ plotMarginHint()

int QwtPolarPlot::plotMarginHint ( ) const

Get the plot margin hint

Get the maximum of all item margin hints

返回
Maximum margin hint
参见
QwtPolarItem::marginHint()

◆ plotRect() [1/2]

QRectF QwtPolarPlot::plotRect ( ) const

Get the plot rectangle

Get the bounding rect of the plot area

The plot area depends on the size of the canvas and the zoom parameters.

返回
Bounding rect of the plot area

◆ plotRect() [2/2]

QRectF QwtPolarPlot::plotRect ( const QRectF &  canvasRect) const

Get the plot rectangle for a given rectangle

Calculate the bounding rect of the plot area

The plot area depends on the zoom parameters.

参数
canvasRectRectangle of the canvas
返回
Rectangle for displaying 100% of the plot

◆ replot

void QwtPolarPlot::replot ( )
virtualslot

Replot the plot

Redraw the plot

If the autoReplot option is not set (which is the default) or if any curves are attached to raw data, the plot has to be refreshed explicitly in order to make changes visible.

警告
Calls canvas()->repaint, take care of infinite recursions
参见
setAutoReplot()

◆ resizeEvent()

void QwtPolarPlot::resizeEvent ( QResizeEvent *  e)
overrideprotectedvirtual

Handle resize events

Resize and update internal layout

参数
eResize event

◆ scaleDiv() [1/2]

QwtScaleDiv * QwtPolarPlot::scaleDiv ( int  scaleId)

Get the scale division for a scale

Return the scale division of a specified scale

scaleDiv(scaleId)->lBound(), scaleDiv(scaleId)->hBound() are the current limits of the scale.

参数
scaleIdScale index
返回
Scale division
参见
QwtScaleDiv, setScaleDiv(), setScale()

◆ scaleDiv() [2/2]

const QwtScaleDiv * QwtPolarPlot::scaleDiv ( int  scaleId) const

Get the scale division for a scale (const version)

Return the scale division of a specified scale

scaleDiv(scaleId)->lBound(), scaleDiv(scaleId)->hBound() are the current limits of the scale.

参数
scaleIdScale index
返回
Scale division
参见
QwtScaleDiv, setScaleDiv(), setScale()

◆ scaleEngine() [1/2]

QwtScaleEngine * QwtPolarPlot::scaleEngine ( int  scaleId)

Get the scale engine for a scale

Get scale engine for a specific scale

参数
scaleIdScale index
返回
Scale engine
参见
setScaleEngine()

◆ scaleEngine() [2/2]

const QwtScaleEngine * QwtPolarPlot::scaleEngine ( int  scaleId) const

Get the scale engine for a scale (const version)

Get scale engine for a specific scale (const version)

参数
scaleIdScale index
返回
Scale engine
参见
setScaleEngine()

◆ scaleMap() [1/2]

QwtScaleMap QwtPolarPlot::scaleMap ( int  scaleId) const

Get the scale map for a scale

Build a scale map

The azimuth map translates between the scale values and angles from [0.0, 2 * PI[. The radial map translates scale values into the distance from the pole. The radial map is calculated from the current geometry of the canvas.

参数
scaleIdScale index
返回
Map for the scale on the canvas. With this map pixel coordinates can be translated to plot coordinates and vice versa.
参见
QwtScaleMap, transform(), invTransform()

◆ scaleMap() [2/2]

QwtScaleMap QwtPolarPlot::scaleMap ( int  scaleId,
double  radius 
) const

Get the scale map for a scale with radius

Build a scale map with specified radius

The azimuth map translates between the scale values and angles from [0.0, 2 * PI[. The radial map translates scale values into the distance from the pole.

参数
scaleIdScale index
radiusRadius of the plot area in pixels
返回
Map for the scale on the canvas. With this map pixel coordinates can be translated to plot coordinates and vice versa.
参见
QwtScaleMap, transform(), invTransform()

◆ scaleMaxMajor()

int QwtPolarPlot::scaleMaxMajor ( int  scaleId) const

Get the maximum number of major ticks for a scale

Get the maximum number of major ticks for a specified axis

参数
scaleIdScale index
返回
Maximum number of major ticks
参见
setScaleMaxMajor()

◆ scaleMaxMinor()

int QwtPolarPlot::scaleMaxMinor ( int  scaleId) const

Get the maximum number of minor ticks for a scale

Get the maximum number of minor ticks for a specified axis

参数
scaleIdScale index
返回
Maximum number of minor ticks
参见
setScaleMaxMinor()

◆ setAutoReplot()

void QwtPolarPlot::setAutoReplot ( bool  enable = true)

Set auto replot

Set or reset the autoReplot option

If the autoReplot option is set, the plot will be updated implicitly by manipulating member functions. Since this may be time-consuming, it is recommended to leave this option switched off and call replot() explicitly if necessary. The autoReplot option is set to false by default, which means that the user has to call replot() in order to make changes visible.

参数
enabletrue or false. Defaults to true.
参见
replot()

◆ setAutoScale()

void QwtPolarPlot::setAutoScale ( int  scaleId)

Set auto scale for a scale

Enable autoscaling

This member function is used to switch back to autoscaling mode after a fixed scale has been set. Autoscaling calculates a useful scale division from the bounding interval of all plot items with the QwtPolarItem::AutoScale attribute. Autoscaling is only supported for the radial scale and enabled as default.

参数
scaleIdScale index
参见
hasAutoScale(), setScale(), setScaleDiv(), QwtPolarItem::boundingInterval()

◆ setAzimuthOrigin

void QwtPolarPlot::setAzimuthOrigin ( double  origin)
slot

Set the azimuth origin

Change the origin of the azimuth scale

The azimuth origin is the angle where the azimuth scale shows the value 0.0. The default origin is 0.0.

参数
originNew origin
参见
azimuthOrigin()

◆ setBackgroundColor()

void QwtPolarPlot::setBackgroundColor ( const QColor &  c)

Set the background color

参数
cBackground color
参见
backgroundColor()

◆ setPlotBackground()

void QwtPolarPlot::setPlotBackground ( const QBrush &  brush)

Set the plot background

Set the background of the plot area

The plot area is the circle around the pole. Its radius is defined by the radial scale.

参数
brushBackground brush
参见
plotBackground(), plotArea()

◆ setScale()

void QwtPolarPlot::setScale ( int  scaleId,
double  min,
double  max,
double  stepSize = 0 
)

Set the scale for a scale

Disable autoscaling and specify a fixed scale for a selected scale

参数
scaleIdScale index
minMinimum value of the scale
maxMaximum value of the scale
stepSizeMajor step size. If step == 0, the step size is calculated automatically using the maxMajor setting.
参见
setScaleMaxMajor(), setAutoScale()

◆ setScaleDiv()

void QwtPolarPlot::setScaleDiv ( int  scaleId,
const QwtScaleDiv scaleDiv 
)

Set the scale division for a scale

Disable autoscaling and specify a fixed scale for a selected scale

参数
scaleIdScale index
scaleDivScale division
参见
setScale(), setAutoScale()

◆ setScaleEngine()

void QwtPolarPlot::setScaleEngine ( int  scaleId,
QwtScaleEngine scaleEngine 
)

Set the scale engine for a scale

Change the scale engine for an axis

参数
scaleIdScale index
scaleEngineScale engine
参见
axisScaleEngine()

◆ setScaleMaxMajor()

void QwtPolarPlot::setScaleMaxMajor ( int  scaleId,
int  maxMajor 
)

Set the maximum number of major ticks for a scale

Set the maximum number of major scale intervals for a specified scale

参数
scaleIdScale index
maxMajorMaximum number of major steps
参见
scaleMaxMajor()

◆ setScaleMaxMinor()

void QwtPolarPlot::setScaleMaxMinor ( int  scaleId,
int  maxMinor 
)

Set the maximum number of minor ticks for a scale

Set the maximum number of minor scale intervals for a specified scale

参数
scaleIdScale index
maxMinorMaximum number of minor steps
参见
scaleMaxMajor()

◆ setTitle() [1/2]

void QwtPolarPlot::setTitle ( const QString &  title)

Set the title

Change the plot's title

参数
titleNew title

◆ setTitle() [2/2]

void QwtPolarPlot::setTitle ( const QwtText title)

Set the title

Change the plot's title

参数
titleNew title

◆ title()

QwtText QwtPolarPlot::title ( ) const

Get the title

Get the plot's title

返回
Title text

◆ titleLabel() [1/2]

QwtTextLabel * QwtPolarPlot::titleLabel ( )

Get the title label

Get the title label widget

返回
Title label widget

◆ titleLabel() [2/2]

const QwtTextLabel * QwtPolarPlot::titleLabel ( ) const

Get the title label (const version)

Get the title label widget (const version)

返回
Title label widget

◆ unzoom()

void QwtPolarPlot::unzoom ( )

Unzoom the plot

参见
zoom()

◆ updateLayout()

void QwtPolarPlot::updateLayout ( )
protectedvirtual

Update the layout

Rebuild the layout

◆ updateLegend() [1/2]

void QwtPolarPlot::updateLegend ( )

Update the legend

Emit legendDataChanged() for all plot items

参见
QwtPlotItem::legendData(), legendDataChanged()

◆ updateLegend() [2/2]

void QwtPolarPlot::updateLegend ( const QwtPolarItem plotItem)

Update the legend for an item

Emit legendDataChanged() for a plot item

参数
plotItemPlot item
参见
QwtPlotItem::legendData(), legendDataChanged()

◆ updateScale()

void QwtPolarPlot::updateScale ( int  scaleId)

Update a scale

Rebuild the scale

参数
scaleIdScale index

◆ visibleInterval()

QwtInterval QwtPolarPlot::visibleInterval ( ) const

Get the visible interval

Get the bounding interval of the radial scale visible on canvas

返回
Bounding interval of the radial scale that is visible on the canvas

◆ zoom()

void QwtPolarPlot::zoom ( const QwtPointPolar zoomPos,
double  zoomFactor 
)

Zoom to a position with a factor

Translate and in/decrease the zoom factor

In zoom mode the zoom position is in the center of the canvas. The radius of the circle depends on the size of the plot canvas, that is divided by the zoom factor. Thus a factor < 1.0 zooms in. Setting an invalid zoom position disables zooming.

参数
zoomPosCenter of the translation
zoomFactorZoom factor
参见
unzoom(), zoomPos(), zoomFactor()

◆ zoomFactor()

double QwtPolarPlot::zoomFactor ( ) const

Get the zoom factor

返回
Zoom factor
参见
zoom(), zoomPos()

◆ zoomPos()

QwtPointPolar QwtPolarPlot::zoomPos ( ) const

Get the zoom position

返回
Zoom position
参见
zoom(), zoomFactor()

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