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

QwtPlotRescaler takes care of fixed aspect ratios for plot scales 更多...

#include <qwt_plot_rescaler.h>

类 QwtPlotRescaler 继承关系图:

class  AxisData
 
class  PrivateData
 

Public 类型

enum  RescalePolicy { Fixed , Expanding , Fitting }
 Rescale policies 更多...
 
enum  ExpandingDirection { ExpandUp , ExpandDown , ExpandBoth }
 Expanding directions 更多...
 

Public 成员函数

 QwtPlotRescaler (QWidget *canvas, QwtAxisId referenceAxis=QwtAxis::XBottom, RescalePolicy=Expanding)
 Constructs a rescaler for the given canvas
 
void setEnabled (bool)
 Enables or disables the rescaler
 
bool isEnabled () const
 Checks if the rescaler is enabled
 
void setRescalePolicy (RescalePolicy)
 Sets the rescale policy
 
RescalePolicy rescalePolicy () const
 Gets the rescale policy
 
void setExpandingDirection (ExpandingDirection)
 Sets the expanding direction for all axes
 
void setExpandingDirection (QwtAxisId, ExpandingDirection)
 Sets the expanding direction for a specific axis
 
ExpandingDirection expandingDirection (QwtAxisId) const
 Gets the expanding direction for a specific axis
 
void setReferenceAxis (QwtAxisId)
 Sets the reference axis
 
QwtAxisId referenceAxis () const
 Gets the reference axis
 
void setAspectRatio (double ratio)
 Sets the aspect ratio for all axes
 
void setAspectRatio (QwtAxisId, double ratio)
 Sets the aspect ratio for a specific axis
 
double aspectRatio (QwtAxisId) const
 Gets the aspect ratio for a specific axis
 
void setIntervalHint (QwtAxisId, const QwtInterval &)
 Sets an interval hint for an axis
 
QwtInterval intervalHint (QwtAxisId) const
 Gets the interval hint for an axis
 
QWidget * canvas ()
 Gets the canvas widget
 
const QWidget * canvas () const
 Gets the canvas widget (const version)
 
QwtPlotplot ()
 Gets the plot widget
 
const QwtPlotplot () const
 Gets the plot widget (const version)
 
virtual bool eventFilter (QObject *, QEvent *) override
 Event filter for the plot canvas
 
void rescale () const
 Rescales the plot axes
 

Protected 成员函数

virtual void canvasResizeEvent (QResizeEvent *)
 Event handler for resize events of the plot canvas
 
virtual void rescale (const QSize &oldSize, const QSize &newSize) const
 Adjust the plot axes scales
 
virtual QwtInterval expandScale (QwtAxisId, const QSize &oldSize, const QSize &newSize) const
 Calculate the new scale interval of a plot axis
 
virtual QwtInterval syncScale (QwtAxisId, const QwtInterval &reference, const QSize &size) const
 Synchronize an axis scale according to the scale of the reference axis
 
virtual void updateScales (QwtInterval intervals[QwtAxis::AxisPositions]) const
 Update the axes scales
 
Qt::Orientation orientation (QwtAxisId) const
 
QwtInterval interval (QwtAxisId) const
 
QwtInterval expandInterval (const QwtInterval &, double width, ExpandingDirection) const
 Expand the interval
 

详细描述

QwtPlotRescaler takes care of fixed aspect ratios for plot scales

QwtPlotRescaler auto adjusts the axes of a QwtPlot according to fixed aspect ratios.

成员枚举类型说明

◆ ExpandingDirection

Expanding directions

When rescalePolicy() is set to Expanding its direction depends on ExpandingDirection

枚举值
ExpandUp 

The upper limit of the scale is adjusted

ExpandDown 

The lower limit of the scale is adjusted

ExpandBoth 

Both limits of the scale are adjusted

◆ RescalePolicy

Rescale policies

The rescale policy defines how to rescale the reference axis and their depending axes.

参见
ExpandingDirection, setIntervalHint()
枚举值
Fixed 

The interval of the reference axis remains unchanged, when the geometry of the canvas changes. All other axes will be adjusted according to their aspect ratio.

Expanding 

The interval of the reference axis will be shrunk/expanded, when the geometry of the canvas changes. All other axes will be adjusted according to their aspect ratio.

The interval, that is represented by one pixel is fixed.

Fitting 

The intervals of the axes are calculated, so that all axes include their interval hint.

构造及析构函数说明

◆ QwtPlotRescaler()

QwtPlotRescaler::QwtPlotRescaler ( QWidget *  canvas,
QwtAxisId  referenceAxis = QwtAxis::XBottom,
RescalePolicy  policy = Expanding 
)
explicit

Constructs a rescaler for the given canvas

参数
[in]canvasCanvas widget
[in]referenceAxisReference axis, see RescalePolicy
[in]policyRescale policy
参见
setRescalePolicy(), setReferenceAxis()

Destructs the rescaler

成员函数说明

◆ aspectRatio()

double QwtPlotRescaler::aspectRatio ( QwtAxisId  axisId) const

Gets the aspect ratio for a specific axis

参数
[in]axisIdAxis identifier
返回
Aspect ratio between the specified axis and the reference axis
参见
setAspectRatio()

◆ canvas() [1/2]

QWidget * QwtPlotRescaler::canvas ( )

Gets the canvas widget

返回
Canvas widget

◆ canvas() [2/2]

const QWidget * QwtPlotRescaler::canvas ( ) const

Gets the canvas widget (const version)

返回
Canvas widget (const)

◆ canvasResizeEvent()

void QwtPlotRescaler::canvasResizeEvent ( QResizeEvent *  event)
protectedvirtual

Event handler for resize events of the plot canvas

参数
eventResize event
参见
rescale()

◆ eventFilter()

bool QwtPlotRescaler::eventFilter ( QObject *  object,
QEvent *  event 
)
overridevirtual

Event filter for the plot canvas

Handles resize and polish request events for the canvas.

参数
[in]objectObject that received the event
[in]eventEvent that was received
返回
false to allow further processing of the event

◆ expandingDirection()

QwtPlotRescaler::ExpandingDirection QwtPlotRescaler::expandingDirection ( QwtAxisId  axisId) const

Gets the expanding direction for a specific axis

参数
[in]axisIdAxis identifier
返回
Expanding direction for the specified axis
参见
setExpandingDirection()

◆ expandInterval()

QwtInterval QwtPlotRescaler::expandInterval ( const QwtInterval interval,
double  width,
ExpandingDirection  direction 
) const
protected

Expand the interval

参数
intervalInterval to be expanded
widthDistance to be added to the interval
directionDirection of the expand operation
返回
Expanded interval

◆ expandScale()

QwtInterval QwtPlotRescaler::expandScale ( QwtAxisId  axisId,
const QSize &  oldSize,
const QSize &  newSize 
) const
protectedvirtual

Calculate the new scale interval of a plot axis

参数
axisIdAxis
oldSizePrevious size of the canvas
newSizeNew size of the canvas
返回
Calculated new interval for the axis

◆ interval()

QwtInterval QwtPlotRescaler::interval ( QwtAxisId  axisId) const
protected
参数
axisIdAxis
返回
Normalized interval of an axis

◆ intervalHint()

QwtInterval QwtPlotRescaler::intervalHint ( QwtAxisId  axisId) const

Gets the interval hint for an axis

参数
[in]axisIdAxis identifier
返回
Interval hint
参见
setIntervalHint(), RescalePolicy

◆ isEnabled()

bool QwtPlotRescaler::isEnabled ( ) const

Checks if the rescaler is enabled

返回
true if enabled, false otherwise
参见
setEnabled(), eventFilter()

◆ orientation()

Qt::Orientation QwtPlotRescaler::orientation ( QwtAxisId  axisId) const
protected
返回
Orientation of an axis
参数
axisIdAxis

◆ plot() [1/2]

QwtPlot * QwtPlotRescaler::plot ( )

Gets the plot widget

返回
Plot widget

◆ plot() [2/2]

const QwtPlot * QwtPlotRescaler::plot ( ) const

Gets the plot widget (const version)

返回
Plot widget (const)

◆ referenceAxis()

QwtAxisId QwtPlotRescaler::referenceAxis ( ) const

Gets the reference axis

返回
Reference axis identifier
参见
setReferenceAxis()

◆ rescale() [1/2]

void QwtPlotRescaler::rescale ( ) const

Rescales the plot axes

Adjusts the plot axes scales based on the current canvas size.

◆ rescale() [2/2]

void QwtPlotRescaler::rescale ( const QSize &  oldSize,
const QSize &  newSize 
) const
protectedvirtual

Adjust the plot axes scales

参数
oldSizePrevious size of the canvas
newSizeNew size of the canvas

◆ rescalePolicy()

QwtPlotRescaler::RescalePolicy QwtPlotRescaler::rescalePolicy ( ) const

Gets the rescale policy

返回
Rescale policy
参见
setRescalePolicy()

◆ setAspectRatio() [1/2]

void QwtPlotRescaler::setAspectRatio ( double  ratio)

Sets the aspect ratio for all axes

Sets the aspect ratio between the scale of the reference axis and other scales. The default ratio is 1.0.

参数
[in]ratioAspect ratio
参见
aspectRatio()

◆ setAspectRatio() [2/2]

void QwtPlotRescaler::setAspectRatio ( QwtAxisId  axisId,
double  ratio 
)

Sets the aspect ratio for a specific axis

Sets the aspect ratio between the scale of the reference axis and another scale. The default ratio is 1.0.

参数
[in]axisIdAxis identifier
[in]ratioAspect ratio
参见
aspectRatio()

◆ setEnabled()

void QwtPlotRescaler::setEnabled ( bool  on)

Enables or disables the rescaler

When enabled is true, an event filter is installed for the canvas, otherwise the event filter is removed.

参数
[in]ontrue to enable, false to disable
参见
isEnabled(), eventFilter()

◆ setExpandingDirection() [1/2]

void QwtPlotRescaler::setExpandingDirection ( ExpandingDirection  direction)

Sets the expanding direction for all axes

参数
[in]directionExpanding direction
参见
expandingDirection()

◆ setExpandingDirection() [2/2]

void QwtPlotRescaler::setExpandingDirection ( QwtAxisId  axisId,
ExpandingDirection  direction 
)

Sets the expanding direction for a specific axis

参数
[in]axisIdAxis identifier
[in]directionExpanding direction
参见
expandingDirection()

◆ setIntervalHint()

void QwtPlotRescaler::setIntervalHint ( QwtAxisId  axisId,
const QwtInterval interval 
)

Sets an interval hint for an axis

In Fitting mode, the hint is used as the minimal interval that always needs to be displayed.

参数
[in]axisIdAxis identifier
[in]intervalInterval hint
参见
intervalHint(), RescalePolicy

◆ setReferenceAxis()

void QwtPlotRescaler::setReferenceAxis ( QwtAxisId  axisId)

Sets the reference axis

The reference axis is used as the basis for rescale calculations.

参数
[in]axisIdAxis identifier
参见
referenceAxis()

◆ setRescalePolicy()

void QwtPlotRescaler::setRescalePolicy ( RescalePolicy  policy)

Sets the rescale policy

参数
[in]policyRescale policy
参见
rescalePolicy()

◆ syncScale()

QwtInterval QwtPlotRescaler::syncScale ( QwtAxisId  axisId,
const QwtInterval reference,
const QSize &  size 
) const
protectedvirtual

Synchronize an axis scale according to the scale of the reference axis

参数
axisIdAxis
referenceInterval of the reference axis
sizeSize of the canvas
返回
New interval for axis

◆ updateScales()

void QwtPlotRescaler::updateScales ( QwtInterval  intervals[QwtAxis::AxisPositions]) const
protectedvirtual

Update the axes scales

参数
intervalsScale intervals

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