このページでは

QCustom3DLabel Class

QCustom3DLabel クラスは、グラフにカスタムラベルを追加します。詳細...

ヘッダー: #include <QCustom3DLabel>
CMake: find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs)
qmake: QT += graphs
QML内: Custom3DLabel
継承元: QCustom3DItem

プロパティ

パブリック関数

QCustom3DLabel(QObject *parent = nullptr)
QCustom3DLabel(const QString &text, const QFont &font, QVector3D position, QVector3D scaling, const QQuaternion &rotation, QObject *parent = nullptr)
virtual ~QCustom3DLabel() override
QColor backgroundColor() const
QFont font() const
bool isBackgroundVisible() const
bool isBorderVisible() const
bool isFacingCamera() const
void setBackgroundColor(QColor color)
void setBackgroundVisible(bool visible)
void setBorderVisible(bool visible)
void setFacingCamera(bool enabled)
void setFont(const QFont &font)
void setText(const QString &text)
void setTextColor(QColor color)
QString text() const
QColor textColor() const

シグナル

void backgroundColorChanged(QColor color)
void backgroundVisibleChanged(bool visible)
void borderVisibleChanged(bool visible)
void facingCameraChanged(bool enabled)
void fontChanged(const QFont &font)
void textChanged(const QString &text)
void textColorChanged(QColor color)

詳細説明

カスタムラベルのテキスト、フォント、位置、拡大縮小、回転、および色を設定できます。さらに、ラベルの枠線や背景の表示/非表示を切り替えることができます。色、枠線、背景は、明示的に設定されていない限り、アクティブなテーマによって決定されます。

注: 拡大・縮小処理において 、z座標は影響しません。x座標とy座標を同じ値に設定すると、元のフォントの寸法が維持されます。

関連項目: Q3DGraphsWidgetItem::addCustomItem()。

プロパティのドキュメント

backgroundColor : QColor

このプロパティは、有効になっている場合、ラベルの背景色を指定します。

デフォルト値はQt::gray です。

アクセス関数:

QColor backgroundColor() const
void setBackgroundColor(QColor color)

通知シグナル:

void backgroundColorChanged(QColor color)

「backgroundVisible」も参照してください 。

backgroundVisible : bool

このプロパティは、ラベルの背景が表示されるかどうかを指定します。

false に設定されている場合、backgroundColor()は効果を持ちません。デフォルトはtrue です。

アクセス関数:

bool isBackgroundVisible() const
void setBackgroundVisible(bool visible)

Notifierシグナル:

void backgroundVisibleChanged(bool visible)

borderVisible : bool

このプロパティは、ラベルの枠線が表示されるかどうかを指定します。

デフォルト値はtrue です。

アクセス関数:

bool isBorderVisible() const
void setBorderVisible(bool visible)

Notifierシグナル:

void borderVisibleChanged(bool visible)

facingCamera : bool

このプロパティは、ラベルが常にカメラの方を向くかどうかを指定します。

デフォルトはfalse です。true に設定された場合、rotation()は効果を持ちません。

アクセス関数:

bool isFacingCamera() const
void setFacingCamera(bool enabled)

Notifierシグナル:

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

通知シグナル:

void textColorChanged(QColor color)

「borderVisible」も参照してください 。

メンバ関数のドキュメント

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

指定されたparent を使用して、カスタム3Dラベルを作成します。

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

指定されたtext 、font 、position 、scaling 、rotation 、およびオプションのparent を使用して、カスタム3Dラベルを作成します。

注: scaling に対して同じx座標とy座標を設定すると 、元のフォントの寸法が維持されます。

[override virtual noexcept] QCustom3DLabel::~QCustom3DLabel()

カスタム3Dラベルを削除します。

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