|
QWT 7.0.1
|
A Widget which contains a scale. More...
#include <qwt_scale_widget.h>
Classes | |
| class | PrivateData |
Public Types | |
| enum | LayoutFlag { TitleInverted = 1 } |
| Layout flags of the title. More... | |
| enum | BuiltinActions { ActionNone = 0x00 , ActionWheelZoom = 0x01 , ActionClickPan = 0x02 , ActionAll = 0xFF } |
| 内置的动作 More... | |
Signals | |
| void | scaleDivChanged () |
| Signal emitted, whenever the scale division changes/当刻度分度发生变化时发出的信号 | |
| void | requestScaleRangeUpdate (double min, double max) |
| Request to change the axis scale division/坐标轴主动请求变更刻度范围 | |
| void | selectionChanged (bool selected) |
| 当前轴被选中状态发生变化发射信号 | |
Public Member Functions | |
| QwtScaleWidget (QWidget *parent=NULL) | |
| Create a scale with the position QwtScaleWidget::Left. | |
| QwtScaleWidget (QwtScaleDraw::Alignment, QWidget *parent=NULL) | |
| void | setTitle (const QString &title) |
| Give title new text contents. | |
| void | setTitle (const QwtText &title) |
| Give title new text contents. | |
| QwtText | title () const |
| void | setLayoutFlag (LayoutFlag, bool on) |
| Toggle an layout flag. | |
| bool | testLayoutFlag (LayoutFlag) const |
| Test a layout flag. | |
| void | setBorderDist (int dist1, int dist2) |
| Specify distances of the scale's endpoints from the widget's borders. | |
| int | startBorderDist () const |
| int | endBorderDist () const |
| void | getBorderDistHint (int &start, int &end) const |
| Calculate a hint for the border distances./计算边框距离的“建议值” | |
| void | getMinBorderDist (int &start, int &end) const |
| Get the minimum value for the distances of the scale's endpoints from the widget borders. | |
| void | setMinBorderDist (int start, int end) |
| int | startMinBorderDist () const |
| minimum value for the distances of the scale's endpoints from the widget borders.(Left or top Distance) | |
| int | endMinBorderDist () const |
| minimum value for the distances of the scale's endpoints from the widget borders.(Right or bottom distance) | |
| void | setMargin (int) |
| Specify the margin to the colorBar/base line. | |
| int | margin () const |
| void | setSpacing (int) |
| Specify the distance between color bar, scale and title. | |
| int | spacing () const |
| void | setEdgeMargin (int offset) |
| 设置坐标轴和绘图边缘的空白偏移距离 | |
| int | edgeMargin () const |
| 边缘距离 | |
| void | setScaleDiv (const QwtScaleDiv &) |
| Assign a scale division. | |
| void | setTransformation (QwtTransform *) |
| Set the transformation. | |
| void | setScaleDraw (QwtScaleDraw *) |
| Set a scale draw. | |
| const QwtScaleDraw * | scaleDraw () const |
| QwtScaleDraw * | scaleDraw () |
| void | setLabelAlignment (Qt::Alignment) |
| Change the alignment for the labels. | |
| void | setLabelRotation (double rotation) |
| Change the rotation for the labels. | |
| void | setColorBarEnabled (bool) |
| En/disable a color bar associated to the scale. | |
| bool | isColorBarEnabled () const |
| void | setColorBarWidth (int) |
| Set the width of the color bar. | |
| int | colorBarWidth () const |
| void | setColorMap (const QwtInterval &, QwtColorMap *) |
| Set the color map and value interval, that are used for displaying the color bar. | |
| QwtInterval | colorBarInterval () const |
| const QwtColorMap * | colorMap () const |
| virtual QSize | sizeHint () const QWT_OVERRIDE |
| virtual QSize | minimumSizeHint () const QWT_OVERRIDE |
| int | titleHeightForWidth (int width) const |
| Find the height of the title for a given width. | |
| int | dimForLength (int length, const QFont &scaleFont) const |
| Find the minimum dimension for a given length. | |
| void | drawColorBar (QPainter *, const QRectF &) const |
| Draw the color bar of the scale widget. | |
| void | drawTitle (QPainter *, QwtScaleDraw::Alignment, const QRectF &rect) const |
| Rotate and paint a title according to its position into a given rectangle. | |
| void | setAlignment (QwtScaleDraw::Alignment) |
| Change the alignment. | |
| QwtScaleDraw::Alignment | alignment () const |
| QRectF | colorBarRect (const QRectF &) const |
| Calculate the the rectangle for the color bar. | |
| QRect | scaleRect () const |
| 去除了colorBar,margin,edgeMargin,BorderDistHint这些区域的矩形,也就是用来绘制刻度的区域 | |
| void | setTextColor (const QColor &c) |
| Set the font color of the coordinate axis/设置坐标轴的字体颜色 | |
| QColor | textColor () const |
| font color of the coordinate axis/坐标轴的字体颜色 | |
| void | setScaleColor (const QColor &c) |
| set color of the coordinate axis/设置坐标轴的颜色 | |
| QColor | scaleColor () const |
| color of the coordinate axis/坐标轴的颜色 | |
| void | layoutScale (bool update_geometry=true) |
| Recalculate the scale's geometry and layout based on the current geometry and fonts. | |
| QwtAxisId | axisID () const |
| 获取此轴窗口对应的axisID | |
| bool | isXAxis () const |
| 是否是x坐标轴 | |
| bool | isYAxis () const |
| 是否是y坐标轴 | |
| void | setBuildinActions (BuiltinActionsFlags acts) |
| 设置内置的动作 | |
| BuiltinActionsFlags | buildinActions () const |
| 内置的动作 | |
| bool | testBuildinActions (BuiltinActions ba) const |
| 检测内置动作是否激活 | |
| void | setSelected (bool selected) |
| 设置当前轴被选中 | |
| bool | isSelected () const |
| 当前轴是否被选中 | |
| void | setSelectionColor (const QColor &color) |
| 设置选中的颜色 | |
| QColor | selectionColor () const |
| 选中的颜色 | |
| void | setZoomFactor (double factor) |
| 设置缩放因子(默认1.2) | |
| double | zoomFactor () const |
| 缩放因子 | |
| void | setSelectedPenWidthOffset (qreal offset=1) |
| 设置坐标轴在选中状态下的画笔宽度附加值 | |
| qreal | selectedPenWidthOffset () const |
| 获取当前坐标轴在选中状态下的画笔宽度附加值 | |
| bool | isOnScale (const QPoint &pos) const |
| 判断鼠标位置是否落在“纯刻度区域” | |
Protected Member Functions | |
| virtual void | paintEvent (QPaintEvent *) QWT_OVERRIDE |
| paintEvent | |
| virtual void | resizeEvent (QResizeEvent *) QWT_OVERRIDE |
| Event handler for resize events. | |
| virtual void | changeEvent (QEvent *) QWT_OVERRIDE |
| Change Event handler. | |
| void | draw (QPainter *) const |
| draw the scale | |
| void | scaleChange () |
| Notify a change of the scale. | |
A Widget which contains a scale.
This Widget can be used to decorate composite widgets with a scale.
│<--------------------------— plot yleft edge │ │ │ │tick ┌ ┌--------------------------------— │ │ │ │label│ │ │edge │YLeft │space │ 6 -│margin │ │margin│Title │ │ │ │ │ │ │ │ 5 -│ │ │ │ │ │ │ │ │ │ │ │ 4 -│ │ plot cavans │ │ │ │ │ │ │ │ │ │ 3 -│ │ │ │ │ │ │ │ │ │ │ │ 2 -│ │ │ │ │ │ │ │ │ │ │ │ 1 -│ │_________________________________
|
explicit |
Create a scale with the position QwtScaleWidget::Left.
| parent | Parent widget |
Constructor
| align | Alignment. |
| parent | Parent widget |
| QwtScaleDraw::Alignment QwtScaleWidget::alignment | ( | ) | const |
| QwtAxisId QwtScaleWidget::axisID | ( | ) | const |
获取此轴窗口对应的axisID
| QwtScaleWidget::BuiltinActionsFlags QwtScaleWidget::buildinActions | ( | ) | const |
内置的动作
|
protectedvirtual |
Change Event handler.
| event | Change event |
Invalidates internal caches if necessary
| QwtInterval QwtScaleWidget::colorBarInterval | ( | ) | const |
| QRectF QwtScaleWidget::colorBarRect | ( | const QRectF & | rect | ) | const |
Calculate the the rectangle for the color bar.
| rect | Bounding rectangle for all components of the scale |
| int QwtScaleWidget::colorBarWidth | ( | ) | const |
| const QwtColorMap * QwtScaleWidget::colorMap | ( | ) | const |
| int QwtScaleWidget::dimForLength | ( | int | length, |
| const QFont & | scaleFont | ||
| ) | const |
Find the minimum dimension for a given length.
dim is the height, length the width seen in direction of the title.
| length | width for horizontal, height for vertical scales |
| scaleFont | Font of the scale |
| void QwtScaleWidget::drawColorBar | ( | QPainter * | painter, |
| const QRectF & | rect | ||
| ) | const |
Draw the color bar of the scale widget.
| painter | Painter |
| rect | Bounding rectangle for the color bar |
| void QwtScaleWidget::drawTitle | ( | QPainter * | painter, |
| QwtScaleDraw::Alignment | align, | ||
| const QRectF & | rect | ||
| ) | const |
Rotate and paint a title according to its position into a given rectangle.
| painter | Painter |
| align | Alignment |
| rect | Bounding rectangle |
| int QwtScaleWidget::edgeMargin | ( | ) | const |
边缘距离
| int QwtScaleWidget::endBorderDist | ( | ) | const |
| int QwtScaleWidget::endMinBorderDist | ( | ) | const |
minimum value for the distances of the scale's endpoints from the widget borders.(Right or bottom distance)
| void QwtScaleWidget::getBorderDistHint | ( | int & | start, |
| int & | end | ||
| ) | const |
Calculate a hint for the border distances./计算边框距离的“建议值”
This member function calculates the distance of the scale's endpoints from the widget borders which is required for the mark labels to fit into the widget. The maximum of this distance an the minimum border distance is returned.
本函数根据刻度标记文字的大小,计算刻度两端与控件边框之间所需的距离,以确保文字完整显示。 最终返回该距离与最小边框距离中的较大值。
| start | Return parameter for the border width at the beginning of the scale/刻度起始端与边框的宽度 |
| end | Return parameter for the border width at the end of the scale/刻度末端与边框的宽度 |
| void QwtScaleWidget::getMinBorderDist | ( | int & | start, |
| int & | end | ||
| ) | const |
Get the minimum value for the distances of the scale's endpoints from the widget borders.
| start | Return parameter for the border width at the beginning of the scale |
| end | Return parameter for the border width at the end of the scale |
| bool QwtScaleWidget::isColorBarEnabled | ( | ) | const |
| bool QwtScaleWidget::isOnScale | ( | const QPoint & | pos | ) | const |
判断鼠标位置是否落在“纯刻度区域”
| pos | 鼠标位置(相对于本 QWidget 的坐标) |
| bool QwtScaleWidget::isSelected | ( | ) | const |
当前轴是否被选中
| selected |
| bool QwtScaleWidget::isXAxis | ( | ) | const |
是否是x坐标轴
| bool QwtScaleWidget::isYAxis | ( | ) | const |
是否是y坐标轴
| void QwtScaleWidget::layoutScale | ( | bool | update_geometry = true | ) |
Recalculate the scale's geometry and layout based on the current geometry and fonts.
| update_geometry | Notify the layout system and call update to redraw the scale |
| int QwtScaleWidget::margin | ( | ) | const |
|
virtual |
|
signal |
Request to change the axis scale division/坐标轴主动请求变更刻度范围
Emitted when built-in actions (zoom/pan) need to alter the scale. 内置动作(缩放/平移)需要改变刻度时发射此信号。
Unlike normal QwtPlot updates, here the axis drives the change: QwtPlot receives this signal and adjusts item bounds accordingly. 与常规 QwtPlot 更新不同,此处由轴驱动变更:QwtPlot 接收信号后调整图元范围。
| min | min scale division requested/请求的最小刻度范围 |
| min | max scale division requested/请求的最大刻度范围 |
|
protectedvirtual |
Event handler for resize events.
| event | Resize event |
|
protected |
Notify a change of the scale.
This virtual function can be overloaded by derived classes. The default implementation updates the geometry and repaints the widget.
| QColor QwtScaleWidget::scaleColor | ( | ) | const |
color of the coordinate axis/坐标轴的颜色
| QwtScaleDraw * QwtScaleWidget::scaleDraw | ( | ) |
| const QwtScaleDraw * QwtScaleWidget::scaleDraw | ( | ) | const |
| QRect QwtScaleWidget::scaleRect | ( | ) | const |
去除了colorBar,margin,edgeMargin,BorderDistHint这些区域的矩形,也就是用来绘制刻度的区域
| qreal QwtScaleWidget::selectedPenWidthOffset | ( | ) | const |
获取当前坐标轴在选中状态下的画笔宽度附加值
|
signal |
当前轴被选中状态发生变化发射信号
| selected |
| QColor QwtScaleWidget::selectionColor | ( | ) | const |
选中的颜色
| void QwtScaleWidget::setAlignment | ( | QwtScaleDraw::Alignment | alignment | ) |
| void QwtScaleWidget::setBorderDist | ( | int | dist1, |
| int | dist2 | ||
| ) |
Specify distances of the scale's endpoints from the widget's borders.
The actual borders will never be less than minimum border distance.
| dist1 | Left or top Distance |
| dist2 | Right or bottom distance |
| void QwtScaleWidget::setBuildinActions | ( | BuiltinActionsFlags | acts | ) |
设置内置的动作
| actions | 内置动作 |
| void QwtScaleWidget::setColorBarEnabled | ( | bool | on | ) |
En/disable a color bar associated to the scale.
| void QwtScaleWidget::setColorBarWidth | ( | int | width | ) |
| void QwtScaleWidget::setColorMap | ( | const QwtInterval & | interval, |
| QwtColorMap * | colorMap | ||
| ) |
Set the color map and value interval, that are used for displaying the color bar.
| interval | Value interval |
| colorMap | Color map |
| void QwtScaleWidget::setEdgeMargin | ( | int | offset | ) |
设置坐标轴和绘图边缘的空白偏移距离
edgeMargin和margin刚好相反,margin是和绘图的偏移,edgeMargin是和绘图边缘的偏移
| offset |
| void QwtScaleWidget::setLabelAlignment | ( | Qt::Alignment | alignment | ) |
Change the alignment for the labels.
| void QwtScaleWidget::setLabelRotation | ( | double | rotation | ) |
Change the rotation for the labels.
See QwtScaleDraw::setLabelRotation().
| rotation | Rotation |
| void QwtScaleWidget::setLayoutFlag | ( | LayoutFlag | flag, |
| bool | on | ||
| ) |
| void QwtScaleWidget::setMargin | ( | int | margin | ) |
| void QwtScaleWidget::setMinBorderDist | ( | int | start, |
| int | end | ||
| ) |
Set a minimum value for the distances of the scale's endpoints from the widget borders. This is useful to avoid that the scales are "jumping", when the tick labels or their positions change often.
设置刻度两端与控件边框的最小距离。当刻度标签或其位置频繁变化时,可避免刻度出现“跳动”现象。
| start | Minimum for the start border/起始端最小边距 |
| end | Minimum for the end border/末端最小边距 |
| void QwtScaleWidget::setScaleColor | ( | const QColor & | c | ) |
set color of the coordinate axis/设置坐标轴的颜色
| c |
| void QwtScaleWidget::setScaleDiv | ( | const QwtScaleDiv & | scaleDiv | ) |
Assign a scale division.
The scale division determines where to set the tick marks.
| scaleDiv | Scale Division |
| void QwtScaleWidget::setScaleDraw | ( | QwtScaleDraw * | scaleDraw | ) |
Set a scale draw.
scaleDraw has to be created with new and will be deleted in ~QwtScaleWidget() or the next call of setScaleDraw(). scaleDraw will be initialized with the attributes of the previous scaleDraw object.
| scaleDraw | ScaleDraw object |
| void QwtScaleWidget::setSelected | ( | bool | selected | ) |
| void QwtScaleWidget::setSelectedPenWidthOffset | ( | qreal | offset = 1 | ) |
设置坐标轴在选中状态下的画笔宽度附加值
当一个坐标轴(例如 X 轴或 Y 轴)被用户选中时,其绘制的画笔宽度会 在原始宽度的基础上增加这个附加值,从而实现视觉上的突出显示效果。
| offset | 选中时增加的宽度值(单位:像素)。 该值应为非负数。如果为 0,则选中状态下的线宽与普通状态相同。 |
| void QwtScaleWidget::setSelectionColor | ( | const QColor & | color | ) |
设置选中的颜色
| color |
| void QwtScaleWidget::setSpacing | ( | int | spacing | ) |
Specify the distance between color bar, scale and title.
| spacing | Spacing |
| void QwtScaleWidget::setTextColor | ( | const QColor & | c | ) |
Set the font color of the coordinate axis/设置坐标轴的字体颜色
| c |
| void QwtScaleWidget::setTitle | ( | const QString & | title | ) |
| void QwtScaleWidget::setTitle | ( | const QwtText & | title | ) |
Give title new text contents.
| title | New title |
| void QwtScaleWidget::setTransformation | ( | QwtTransform * | transformation | ) |
Set the transformation.
| transformation | Transformation |
| void QwtScaleWidget::setZoomFactor | ( | double | factor | ) |
设置缩放因子(默认1.2)
| factor |
|
virtual |
| int QwtScaleWidget::spacing | ( | ) | const |
| int QwtScaleWidget::startBorderDist | ( | ) | const |
| int QwtScaleWidget::startMinBorderDist | ( | ) | const |
minimum value for the distances of the scale's endpoints from the widget borders.(Left or top Distance)
| bool QwtScaleWidget::testBuildinActions | ( | QwtScaleWidget::BuiltinActions | ba | ) | const |
检测内置动作是否激活
| ba |
| bool QwtScaleWidget::testLayoutFlag | ( | LayoutFlag | flag | ) | const |
Test a layout flag.
| flag | Layout flag |
| QColor QwtScaleWidget::textColor | ( | ) | const |
font color of the coordinate axis/坐标轴的字体颜色
| QwtText QwtScaleWidget::title | ( | ) | const |
| int QwtScaleWidget::titleHeightForWidth | ( | int | width | ) | const |
Find the height of the title for a given width.
| width | Width |
| double QwtScaleWidget::zoomFactor | ( | ) | const |
缩放因子