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

Linear scale whose major tic labels come from a user supplied string list 更多...

#include <qwt3d_scale.h>

类 Qwt3DTextScale 继承关系图:
Qwt3DLinearScale Qwt3DScale

Public 成员函数

void setLabels (const QVector< QString > &labels)
 Sets the label list (indexed by major tic index)
 
QVector< QString > labels () const
 Returns the label list
 

Protected 成员函数

QString ticLabel (unsigned int idx) const override
 Returns the custom label of the major tic at index idx
 
Qwt3DScale * clone () const override
 Returns a new heap based object utilized from Qwt3DClonePtr
 
- Protected 成员函数 继承自 Qwt3DLinearScale
 Qwt3DLinearScale ()
 Applies Qwt3DLinearAutoScaler::execute() for autoscaling
 
int autoscale (double &a, double &b, double start, double stop, int ivals) override
 Autoscales the axis
 
void calculate () override
 Creates the major and minor vector for the scale
 
void copyLinearScaleState (const Qwt3DLinearScale &other)
 Copies the linear autoscaler state from another Qwt3DLinearScale
 
- Protected 成员函数 继承自 Qwt3DScale
virtual void setLimits (double start, double stop)
 Sets start and stop value for the scale
 
virtual void setMajors (int val)
 Sets number of major intervals
 
virtual void setMinors (int val)
 Sets number of minor intervals per major interval
 
virtual void setMajorLimits (double start, double stop)
 Sets value of first and last major tic
 
int majors () const
 Returns major intervals
 
int minors () const
 Returns minor intervals
 
const std::vector< double > & majorTicks () const
 Returns const reference to major tic positions
 
const std::vector< double > & minorTicks () const
 Returns const reference to minor tic positions
 
void copyFrom (const Qwt3DScale &other)
 Copies Qwt3DScale base state from another Qwt3DScale
 

友元

class Qwt3DAxis
 
class Qwt3DClonePtr< Qwt3DScale >
 

详细描述

Linear scale whose major tic labels come from a user supplied string list

Qwt3DAxis::drawTicLabel() asks the scale for the label of every major tic via ticLabel(idx). With this scale the depth axis of a waterfall can read "t=-2.4s", "frame 17", ... instead of plain numbers.

Qwt3DAxis::setScale() hands the scale object to a Qwt3DClonePtr, whose assignment calls clone(). Any derived scale that does not override clone() is sliced to its base class right inside setScale(), and the custom ticLabel() silently stops working. Qwt3DTextScale overrides clone(), so it survives the clone; user-defined scale classes must do the same.

auto* scale = new Qwt3DTextScale();
scale->setLabels({ "oldest", "-32", "-16", "newest" });
plot->coordinates()->axes[Qwt3D::Z1].setScale(scale);
plot->coordinates()->axes[Qwt3D::Z1].setMajors(3);
Linear scale whose major tic labels come from a user supplied string list
Definition qwt3d_scale.h:127

成员函数说明

◆ clone()

Qwt3DScale * Qwt3DTextScale::clone ( ) const
overrideprotectedvirtual

Returns a new heap based object utilized from Qwt3DClonePtr

返回
A new Qwt3DTextScale copy

Qwt3DAxis::setScale() stores the object in a Qwt3DClonePtr whose assignment calls clone(). A derived scale without a clone() override would be sliced to the base class right there, silently dropping the custom ticLabel(). This override copies the base state (copyFrom) plus the label list.

重载 Qwt3DLinearScale .

◆ labels()

QVector< QString > Qwt3DTextScale::labels ( ) const

Returns the label list

返回
The labels set with setLabels()

◆ setLabels()

void Qwt3DTextScale::setLabels ( const QVector< QString > &  labels)

Sets the label list (indexed by major tic index)

Sets the label list used for the major tics

参数
labelsLabels indexed by major tic index

Indices beyond the list size fall back to the numeric label.

◆ ticLabel()

QString Qwt3DTextScale::ticLabel ( unsigned int  idx) const
overrideprotectedvirtual

Returns the custom label of the major tic at index idx

参数
idxThe current major tic index
返回
The user supplied string for a valid index, the numeric label else

Falls back to Qwt3DLinearScale::ticLabel() (the plain tic value) when idx is out of range, so a short label list never produces empty axis annotations.

重载 Qwt3DScale .


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