QCustom3DLabel 类

QCustom3DLabel 类向图形添加自定义标签。 更多...

头: #include <QCustom3DLabel>
CMake: find_package(Qt6 REQUIRED COMPONENTS DataVisualization)
target_link_libraries(mytarget PRIVATE Qt6::DataVisualization)
qmake: QT += datavisualization
Since: QtDataVisualization 1.1
实例化: Custom3DLabel
继承: QCustom3DItem

特性

公共函数

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 ()
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 )

详细描述

The text, font, position, scaling, rotation, and colors of a custom label can be set. In addition, the visibility of the borders and background of the label can be toggled. Colors, borders, and background are determined by the active theme unless set explicitly.

注意: In scaling, the z-coordinate has no effect. Setting the same x- and y-coordinates retains the original font dimensions.

另请参阅 QAbstract3DGraph::addCustomItem ().

特性文档编制

backgroundColor : QColor

This property holds the color for the label background, if enabled.

默认为 Qt::gray .

访问函数:

QColor backgroundColor () const
void setBackgroundColor (const QColor & color )

通知程序信号:

void backgroundColorChanged (const QColor & color )

另请参阅 backgroundEnabled .

backgroundEnabled : bool

此特性保持是否启用标签背景。

若设为 false , backgroundColor () 不起作用。默认为 true .

访问函数:

bool isBackgroundEnabled () const
void setBackgroundEnabled (bool enabled )

通知程序信号:

void backgroundEnabledChanged (bool enabled )

borderEnabled : bool

This property holds whether label borders are enabled.

默认为 true .

访问函数:

bool isBorderEnabled () const
void setBorderEnabled (bool enabled )

通知程序信号:

void borderEnabledChanged (bool enabled )

facingCamera : bool

This property holds whether the label will always face the camera.

默认为 false 。若设为 true , rotation () has no effect.

访问函数:

bool isFacingCamera () const
void setFacingCamera (bool enabled )

通知程序信号:

void facingCameraChanged (bool enabled )

font : QFont

This property holds the font to be used for the label.

默认为 QFont("Arial", 20) . Special formatting (for example, outlined) is not supported.

访问函数:

QFont font () const
void setFont (const QFont & font )

通知程序信号:

void fontChanged (const QFont & font )

text : QString

This property holds the text for the label.

Rich text is not supported.

访问函数:

QString text () const
void setText (const QString & text )

通知程序信号:

void textChanged (const QString & text )

textColor : QColor

This property holds the color for the label text.

Also affects the label border, if enabled. Defaults to Qt::white .

访问函数:

QColor textColor () const
void setTextColor (const QColor & color )

通知程序信号:

void textColorChanged (const QColor & color )

另请参阅 borderEnabled .

成员函数文档编制

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

Constructs a custom 3D label with the given parent .

[explicit] QCustom3DLabel:: QCustom3DLabel (const QString & text , const QFont & font , const QVector3D & position , const QVector3D & scaling , const QQuaternion & rotation , QObject * parent = nullptr)

Constructs a custom 3D label with the given text , font , position , scaling , rotation , and optional parent .

注意: Setting the same x- and y-coordinates for scaling retains the original font dimensions.

[虚拟] QCustom3DLabel:: ~QCustom3DLabel ()

Deletes the custom 3D label.