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

此属性用于保存此坐标轴上的标签格式。

格式字符串支持printf() 在标准 C++ 库中提供的以下转换指定符、长度修饰符和标志: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)

Notifier 信号:

void labelFormatChanged(const QString &format)

另请参见 formatterQAbstract3DGraph::locale

[since QtDataVisualization 1.1] reversed : bool

该属性用于确定是否反向渲染坐标轴。

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

此属性在 QtDataVisualization 1.1 中引入。

访问函数:

bool reversed() const
void setReversed(bool enable)

Notifier 信号:

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

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