QLogValueAxis Class
QLogValueAxis 类可在图表的坐标轴上添加对数值。更多内容...
| 头文件: | #include <QLogValueAxis> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Graphs) target_link_libraries(mytarget PRIVATE Qt6::Graphs) |
| qmake: | QT += graphs |
| 自: | Qt 6.12 |
| 在 QML 中: | LogValueAxis |
| 继承自: | QAbstractAxis |
- 所有成员列表(包括继承的成员)
- QLogValueAxis 属于Qt Graphs 的2D C++ 类。
属性
|
公共函数
| QLogValueAxis(QObject *parent = nullptr) | |
| virtual | ~QLogValueAxis() override |
| qreal | base() const |
| QString | labelFormat() const |
| QString | labelPostFormat() const |
| int | labelPrecision() const |
| qreal | max() const |
| qreal | min() const |
| qreal | pan() const |
| void | setBase(qreal base) |
| void | setLabelFormat(const QString &format) |
| void | setLabelPostFormat(const QString &format) |
| void | setLabelPrecision(int decimals) |
| void | setMax(qreal max) |
| void | setMin(qreal min) |
| void | setPan(qreal pan) |
| void | setRange(qreal min, qreal max) |
| void | setSubTickCount(qsizetype count) |
| void | setZoom(qreal zoom) |
| qsizetype | subTickCount() const |
| qsizetype | tickCount() const |
| qreal | visualMax() const |
| qreal | visualMin() const |
| qreal | zoom() const |
重新实现的公共函数
| virtual QAbstractAxis::AxisType | type() const override |
信号
| void | baseChanged(qreal base) |
| void | labelFormatChanged(const QString &format) |
| void | labelPostFormatChanged(const QString &format) |
| void | labelPrecisionChanged(int precision) |
| void | maxChanged(qreal max) |
| void | minChanged(qreal min) |
| void | panChanged(qreal pan) |
| void | subTickCountChanged(qsizetype subTickCount) |
| void | tickCountChanged(qsizetype tickCount) |
| void | visualMaxChanged(qreal visualMax) |
| void | visualMinChanged(qreal visualMin) |
| void | zoomChanged(qreal zoom) |
重新实现的受保护函数
| virtual bool | event(QEvent *event) override |
属性文档
base : qreal
对数底数。
该值必须大于 0,且不能等于 1。默认值为 10.0
访问函数:
| qreal | base() const |
| void | setBase(qreal base) |
通知信号:
| void | baseChanged(qreal base) |
labelFormat : QString
该属性保存了坐标轴的标签格式。
该格式字符串支持标准 C++ 库中 `printf() ` 提供的以下转换指定符、长度修饰符和标志:d、i、o、x、X、f、F、e、E、g、G、c。随后,格式化的字符串将通过 `QLogValueAxis::labelPostFormat` 进行处理。
默认值为空,此时将使用“f”格式。
访问函数:
| QString | labelFormat() const |
| void | setLabelFormat(const QString &format) |
通知器信号:
| void | labelFormatChanged(const QString &format) |
另请参阅 QString::asprintf()。
[since 6.12] labelPostFormat : QString
该属性存储了坐标轴的标签帖子格式。
标签值首先会经过 `QLogValueAxis::labelFormat ` 进行格式化,然后才经过此属性处理。
默认值为“%1”。
该枚举类型在 Qt 6.12 中引入。
访问函数:
| QString | labelPostFormat() const |
| void | setLabelPostFormat(const QString &format) |
通知信号:
| void | labelPostFormatChanged(const QString &format) |
另请参阅 QString::arg()。
labelPrecision : int
该属性用于指定显示标签时使用的有效数字最大位数。默认值为 6。任何负数精度值都将被忽略,并采用默认值 6。
访问函数:
| int | labelPrecision() const |
| void | setLabelPrecision(int decimals) |
通知信号:
| void | labelPrecisionChanged(int precision) |
max : qreal
该属性存储了该轴上的最大值。
设置此属性时,系统会根据需要调整最小值,以确保范围保持有效。默认值为 10.0
访问函数:
| qreal | max() const |
| void | setMax(qreal max) |
通知信号:
| void | maxChanged(qreal max) |
min : qreal
该属性存储了该轴上的最小值。
设置此属性时,系统会根据需要调整最大值,以确保范围保持有效。默认值为 0.0
访问函数:
| qreal | min() const |
| void | setMin(qreal min) |
通知信号:
| void | minChanged(qreal min) |
pan : qreal
该属性存储坐标轴的平移值。
平移值可移动坐标轴的中心,而不会影响网格和标签的间隔。默认值为 0。
访问函数:
| qreal | pan() const |
| void | setPan(qreal pan) |
通知信号:
| void | panChanged(qreal pan) |
subTickCount : qsizetype
该属性存储轴上的子刻度数量。这表示图表中主刻度线之间绘制了多少个子刻度。子刻度不显示标签。将该值设为 -1 时,子刻度数量将被设置为对数底数的最近整数值。默认值为 -1。
访问函数:
| qsizetype | subTickCount() const |
| void | setSubTickCount(qsizetype count) |
通知信号:
| void | subTickCountChanged(qsizetype subTickCount) |
[read-only] tickCount : int
该属性存储轴上的刻度线数量。此值为只读。
访问函数:
| qsizetype | tickCount() const |
通知信号:
| void | tickCountChanged(qsizetype tickCount) |
[read-only] visualMax : qreal
该属性保存了轴的视觉最大值。
当轴被平移或缩放时,该属性保存轴的视觉最大值。默认值为QLogValueAxis::max
访问函数:
| qreal | visualMax() const |
通知信号:
| void | visualMaxChanged(qreal visualMax) |
[read-only] visualMin : qreal
该属性保存了轴的视觉最小值。
当轴被平移或缩放时,此属性保存轴的视觉最小值。默认值为QLogValueAxis::min
访问函数:
| qreal | visualMin() const |
通知信号:
| void | visualMinChanged(qreal visualMin) |
zoom : qreal
该属性存储坐标轴的缩放值。
缩放值可放大或缩小坐标轴(从而放大或缩小图表),同时不会影响网格间隔和刻度标签。默认值为 1。
访问函数:
| qreal | zoom() const |
| void | setZoom(qreal zoom) |
通知信号:
| void | zoomChanged(qreal zoom) |
成员函数文档
[explicit] QLogValueAxis::QLogValueAxis(QObject *parent = nullptr)
创建一个作为parent 子节点的轴对象。
[override virtual noexcept] QLogValueAxis::~QLogValueAxis()
销毁该对象。
[override virtual protected] bool QLogValueAxis::event(QEvent *event)
重写了:QObject::event(QEvent *e)。
void QLogValueAxis::setRange(qreal min, qreal max)
将坐标轴的范围设置为min 到max 。如果min 大于max ,则该函数不进行任何更改并返回。
[override virtual] QAbstractAxis::AxisType QLogValueAxis::type() const
重写了:QAbstractAxis::type() const。
返回轴的类型。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.