本页内容

QValue3DAxis Class

QValue3DAxis 类用于操作图表的坐标轴。更多内容...

头文件: #include <QValue3DAxis>
CMake: find_package(Qt6 REQUIRED COMPONENTS DataVisualization)
target_link_libraries(mytarget PRIVATE Qt6::DataVisualization)
qmake: QT += datavisualization
自: QtDataVisualization 1.0
在 QML 中: ValueAxis3D
继承自: QAbstract3DAxis
状态: 已弃用

该类已弃用。我们强烈建议不要在新代码中使用它。

属性

公共函数

QValue3DAxis(QObject *parent = nullptr)
virtual ~QValue3DAxis()
QValue3DAxisFormatter *formatter() const
QString labelFormat() const
bool reversed() const
int segmentCount() const
void setFormatter(QValue3DAxisFormatter *formatter)
void setLabelFormat(const QString &format)
void setReversed(bool enable)
void setSegmentCount(int count)
void setSubSegmentCount(int count)
int subSegmentCount() const

信号

void formatterChanged(QValue3DAxisFormatter *formatter)
void labelFormatChanged(const QString &format)
void reversedChanged(bool enable)
void segmentCountChanged(int count)
void subSegmentCountChanged(int count)

详细说明

可以为数值轴指定一个数值范围,以及用于将该范围划分为若干段和子段的段数与子段数。

标签绘制在每个分段之间。网格线绘制在每个分段和每个子分段之间。

注意:如果 可见,则始终会有至少两条网格线和标签,用于指示该范围的最小值和最大值,因为始终至少有一个分段。

属性文档

[since QtDataVisualization 1.1] formatter : QValue3DAxisFormatter*

该属性用于存储要使用的坐标轴格式化器。

当设置新的格式化器时,任何现有的格式化器都会被删除。

该枚举在 QtDataVisualization 1.1 中引入。

访问函数:

QValue3DAxisFormatter *formatter() const
void setFormatter(QValue3DAxisFormatter *formatter)

通知信号:

void formatterChanged(QValue3DAxisFormatter *formatter)

labelFormat : QString

该属性存储了此轴上标签所使用的标签格式。

该格式字符串支持标准 C++ 库中printf() 提供的以下转换指定符、长度修饰符和标志:d、i、o、x、X、f、F、e、E、g、G、c。

如果QAbstract3DGraph::locale 的值不是"C" ,则支持的转换指定符仅限于:d、e、E、f、g、G和i。此外,仅支持精度修饰符。其余格式设置来自应用程序的默认QLocale 。

用法示例:

axis->setLabelFormat("%.2f mm");

访问函数:

QString labelFormat() const
void setLabelFormat(const QString &format)

通知器信号:

void labelFormatChanged(const QString &format)

另请参阅 formatter 和QAbstract3DGraph::locale 。

[since QtDataVisualization 1.1] reversed : bool

该属性控制坐标轴是否以反向方式渲染。

如果true ,则坐标轴将以反向方式渲染,即在绘制图表时,最小值和最大值的位置会被互换。此属性不会影响坐标轴的实际最小值和最大值。

该枚举在 QtDataVisualization 1.1 中引入。

访问函数:

bool reversed() const
void setReversed(bool enable)

通知器信号:

void reversedChanged(bool enable)

segmentCount : int

该属性用于指定轴上的分段数。

这表示将绘制多少个标签。待绘制的网格线数量按以下公式计算:segments * subsegments + 1 。预设默认值为5 。该值不能小于1 。

访问函数:

int segmentCount() const
void setSegmentCount(int count)

通知信号:

void segmentCountChanged(int count)

另请参阅 setSubSegmentCount()。

subSegmentCount : int

该属性表示轴上每个分段内部的分段子段数量。

除了各线段之间外,各子线段之间也会绘制网格线。预设默认值为1 。该值不能小于1 。

访问函数:

int subSegmentCount() const
void setSubSegmentCount(int count)

通知信号:

void subSegmentCountChanged(int count)

另请参阅 setSegmentCount()。

成员函数文档

[explicit] QValue3DAxis::QValue3DAxis(QObject *parent = nullptr)

使用给定的parent 实例化QValue3DAxis。

[virtual noexcept] QValue3DAxis::~QValue3DAxis()

销毁QValue3DAxis 。

© 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.