QCustom3DLabel类
QCustom3DLabel类向图表中添加了自定义标签。更多...
| 头文件 | #include <QCustom3DLabel> | 
| CMake | find_package(Qt6 REQUIRED COMPONENTS Graphs) target_link_libraries(mytarget PRIVATE Qt6::Graphs) | 
| qmake | QT += graphs | 
| 由以下类实例化 | Custom3DLabel | 
| 继承自 | QCustom3DItem | 
| 状态 | 技术预览 | 
- 所有成员的列表,包括继承的成员
- QCustom3DLabel是Qt Graphs C++ 3D类的一部分。
属性
| 
 | 
公共函数
| QCustom3DLabel(QObject *parent = nullptr) | |
| QCustom3DLabel(const QString &text, const QFont &font, const QVector3D &position, const QVector3D &scaling, const QQuaternion &rotation, QObject *parent = nullptr) | |
| virtual | ~QCustom3DLabel() override | 
| QColor | backgroundColor() const | 
| QFont | font() const | 
| bool | isBackgroundEnabled() const | 
| bool | isBorderEnabled() const | 
| bool | isFacingCamera() const | 
| void | setBackgroundColor(const QColor &color) | 
| void | setBackgroundEnabled(bool enabled) | 
| void | setBorderEnabled(bool enabled) | 
| void | setFacingCamera(bool enabled) | 
| void | setFont(const QFont &font) | 
| void | setText(const QString &text) | 
| void | setTextColor(const QColor &color) | 
| QString | text() const | 
| QColor | textColor() const | 
信号
| void | backgroundColorChanged(const QColor &color) | 
| void | backgroundEnabledChanged(bool enabled) | 
| void | borderEnabledChanged(bool enabled) | 
| void | facingCameraChanged(bool enabled) | 
| void | fontChanged(const QFont &font) | 
| void | textChanged(const QString &text) | 
| void | textColorChanged(const QColor &color) | 
详细信息
自定义标签的文本、字体、位置、缩放、旋转和颜色都可以设置。此外,还可以切换标签的边框和背景的可见性。除非显式设置,否则颜色、边框和背景由活动主题决定。
注意:在缩放中,z坐标没有效果。设置相同的x和y坐标保留原始字体尺寸。
另见QAbstract3DGraph::addCustomItem()。
属性文档
backgroundColor : QColor
此属性存储标签背景的颜色,如果启用了该属性。
默认为 Qt::gray。
访问函数
| QColor | backgroundColor() const | 
| void | setBackgroundColor(const QColor &color) | 
通知信号
| void | backgroundColorChanged(const QColor &color) | 
backgroundEnabled : bool
此属性表示标签背景是否启用。
如果设置为 false,则 backgroundColor() 无效。默认为 true。
访问函数
| bool | isBackgroundEnabled() const | 
| void | setBackgroundEnabled(bool enabled) | 
通知信号
| void | backgroundEnabledChanged(bool enabled) | 
borderEnabled : bool
此属性表示标签边框是否启用。
默认为 true。
访问函数
| bool | isBorderEnabled() const | 
| void | setBorderEnabled(bool enabled) | 
通知信号
| void | borderEnabledChanged(bool enabled) | 
facingCamera : bool
此属性表示标签是否始终面向相机。
默认为 false。如果设置为 true,则 rotation() 没有作用。
访问函数
| bool | isFacingCamera() const | 
| void | setFacingCamera(bool enabled) | 
通知信号
| void | facingCameraChanged(bool enabled) | 
font : QFont
此属性存储用于标签的字体。
默认为 QFont("Arial", 20)。不支持特殊格式化(例如,轮廓)。
访问函数
| QFont | font() const | 
| void | setFont(const QFont &font) | 
通知信号
| void | fontChanged(const QFont &font) | 
text : QString
此属性存储标签的文本。
不支持富文本。
访问函数
| QString | text() const | 
| void | setText(const QString &text) | 
通知信号
| void | textChanged(const QString &text) | 
textColor : QColor
该属性保存标签文本的颜色。
如果启用,也影响标签边框。默认为 Qt::white。
访问函数
| QColor | textColor() const | 
| void | setTextColor(const QColor &color) | 
通知信号
| void | textColorChanged(const QColor &color) | 
另请参阅 borderEnabled。
成员函数文档
[显式构造函数] QCustom3DLabel::QCustom3DLabel(QObject *parent = nullptr)
使用指定的 parent 构造自定义 3D 标签。
[显式构造函数] QCustom3DLabel::QCustom3DLabel(const QString &text, const QFont &font, const QVector3D &position, const QVector3D &scaling, const QQuaternion &rotation, QObject *parent = nullptr)
使用指定的 text、font、position、scaling、rotation 以及可选的 parent 构造自定义 3D 标签。
注意: 如果 scaling 设置了相同的 x 和 y 坐标,则保留原始字体尺寸。
[重载虚析构函数] QCustom3DLabel::~QCustom3DLabel()
删除自定义 3D 标签。
© 2024Qt公司有限公司。此处包含的文档贡献的版权属于其各自的拥有者。此处提供的文档是在自由软件基金会出版的 GNU自由文档许可版1.3 条件下授予的。Qt及其相应标志是芬兰和/或其他国家/地区的 The Qt Company Ltd 的商标。所有其他商标均为其各自所有者的财产。