QCustom3DItem Class

QCustom3DItem クラスは、グラフにカスタム項目を追加します。詳細...

ヘッダー #include <QCustom3DItem>
CMake: find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs)
qmake QT += graphs
QML で Custom3DItem
を継承: QObject
継承される

QCustom3DLabel そしてQCustom3DVolume

プロパティ

パブリック機能

QCustom3DItem(QObject *parent = nullptr)
QCustom3DItem(const QString &meshFile, QVector3D position, QVector3D scaling, const QQuaternion &rotation, const QImage &texture, QObject *parent = nullptr)
virtual ~QCustom3DItem() override
bool isPositionAbsolute() const
bool isScalingAbsolute() const
bool isShadowCasting() const
bool isVisible() const
QString meshFile() const
QVector3D position() const
QQuaternion rotation()
QVector3D scaling() const
void setMeshFile(const QString &meshFile)
void setPosition(QVector3D position)
void setPositionAbsolute(bool positionAbsolute)
void setRotation(const QQuaternion &rotation)
void setRotationAxisAndAngle(QVector3D axis, float angle)
void setScaling(QVector3D scaling)
void setScalingAbsolute(bool scalingAbsolute)
void setShadowCasting(bool enabled)
void setTextureFile(const QString &textureFile)
void setTextureImage(const QImage &textureImage)
void setVisible(bool visible)
QString textureFile() const

シグナル

void meshFileChanged(const QString &meshFile)
void positionAbsoluteChanged(bool positionAbsolute)
void positionChanged(QVector3D position)
void rotationChanged(const QQuaternion &rotation)
void scalingAbsoluteChanged(bool scalingAbsolute)
void scalingChanged(QVector3D scaling)
void shadowCastingChanged(bool shadowCasting)
void textureFileChanged(const QString &textureFile)
void visibleChanged(bool visible)

詳細説明

カスタムアイテムは、カスタムメッシュ、位置、スケーリング、回転、およびオプションのテクスチャを持ちます。

Q3DGraphsWidgetItem::addCustomItem()も参照してください

プロパティ ドキュメント

meshFile : QString

このプロパティは、アイテムのメッシュファイル名を保持する。

ファイル内のアイテムはメッシュ形式でなければなりません。他の形式はバルサムアセットインポートツールで変換できます。メッシュファイルには、頂点、法線、UVを含めることを推奨します。

アクセス機能

QString meshFile() const
void setMeshFile(const QString &meshFile)

通知シグナル

void meshFileChanged(const QString &meshFile)

position : QVector3D

このプロパティは、アイテムの位置をQVector3D として保持する。

デフォルトはQVector3D(0.0, 0.0, 0.0)

項目位置は、positionAbsolute プロパティに応じて、データ座標または絶対座標のいずれかで指定されます。絶対座標を使用する場合、-1.0...1.0 間の値は軸範囲内になります。

注: positionAbsolutefalse の場合、軸の範囲外に配置されたアイテムはレンダリングされません。ただし、アイテムが部分的に表示されるQCustom3DVolume であり、scalingAbsolutefalse でもある場合を除きます。その場合、ボリュームの可視部分がレンダリングされる。

アクセス関数:

QVector3D position() const
void setPosition(QVector3D position)

通知シグナル:

void positionChanged(QVector3D position)

positionAbsoluteも参照のこと

positionAbsolute : bool

このプロパティは、アイテムの位置をデータ座標で扱うか、絶対座標で扱うかを保持する。

デフォルトはfalse です。絶対座標を持つアイテムは常にレンダリングされ、データ座標を持つアイテムは軸の範囲内にある場合にのみレンダリングされます。

アクセス関数:

bool isPositionAbsolute() const
void setPositionAbsolute(bool positionAbsolute)

Notifier シグナル:

void positionAbsoluteChanged(bool positionAbsolute)

positionも参照

rotation : QQuaternion

このプロパティは、アイテムの回転をQQuaternion として保持する。

デフォルトはQQuaternion(0.0, 0.0, 0.0, 0.0) です。

アクセス関数

QQuaternion rotation()
void setRotation(const QQuaternion &rotation)

通知シグナル:

void rotationChanged(const QQuaternion &rotation)

scaling : QVector3D

このプロパティは、アイテムのスケーリングをQVector3D として保持します。

デフォルトはQVector3D(0.1, 0.1, 0.1) です。

アイテムのスケーリングは、scalingAbsolute プロパティによって、データ値か絶対値のどちらかになります。絶対値として解釈されるデフォルトのベクトルは、アイテムのメッシュが正規化され、グラフのアスペクト比がデフォルトから変更されていない場合に、アイテムをグラフの高さの 10% に設定します。

アクセス関数:

QVector3D scaling() const
void setScaling(QVector3D scaling)

通知シグナル:

void scalingChanged(QVector3D scaling)

scalingAbsoluteも参照してください

scalingAbsolute : bool

このプロパティは、項目のスケーリングをデータ値で扱うか、絶対値で扱うかを保持する。

デフォルトはtrue です。

絶対的なスケーリングを持つアイテムは、軸の範囲に関係なく、同じサイズでレンダリングされます。デー タ ス ケー リ ン グ を持つ項目は、 軸の範囲に従っ て見かけ上のサ イ ズが変わ り ます。positionAbsolutetrue の場合、 こ のプ ロ パテ ィ は無視 さ れ、 拡縮は絶対値 と し て解釈 さ れます。アイテムに回転がある場合、データ スケーリングは回転していないアイテムで計算されます。同様に、QCustom3DVolume 項目の場合、範囲のクリッピングは回転していない項目で計算されます。

注: QCustom3DLabel アイテムまたはpolar グラフで使用されるカスタム アイテムでは、絶対スケーリングのみがサポートされます。

注: カスタム項目のメッシュは、[-1 ,1] の範囲に正規化する必要があります。そうしないと、データのスケーリングが正確に行われません。

アクセス関数:

bool isScalingAbsolute() const
void setScalingAbsolute(bool scalingAbsolute)

通知シグナル:

void scalingAbsoluteChanged(bool scalingAbsolute)

scaling およびpositionAbsoluteも参照

shadowCasting : bool

このプロパティは、アイテムのシャドウキャストが有効かどうかを保持する。

デフォルトはtrue です。false の場合、アイテムはQ3DGraphsWidgetItem::ShadowQualityに関係なく影を落としません。

アクセス関数

bool isShadowCasting() const
void setShadowCasting(bool enabled)

通知シグナル

void shadowCastingChanged(bool shadowCasting)

textureFile : QString

このプロパティは、アイテムのテクスチャファイル名を保持する。

このプロパティとテクスチャイメージの両方が未設定の場合、グレーのソリッドテクスチャが使用されます。

注意: メモリを節約するために、ファイルからロードされたQImage は、テクスチャが作成された後にクリアされます。

アクセス関数

QString textureFile() const
void setTextureFile(const QString &textureFile)

通知シグナル

void textureFileChanged(const QString &textureFile)

visible : bool

このプロパティは、アイテムの可視性を保持する。

デフォルトはtrue です。

アクセス関数:

bool isVisible() const
void setVisible(bool visible)

Notifier シグナル:

void visibleChanged(bool visible)

メンバ関数ドキュメント

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

指定されたparent でカスタム 3D アイテムを構築します。

[explicit] QCustom3DItem::QCustom3DItem(const QString &meshFile, QVector3D position, QVector3D scaling, const QQuaternion &rotation, const QImage &texture, QObject *parent = nullptr)

指定されたmeshFile,position,scaling,rotation,texture 画像、およびオプションのparent を持つカスタム 3D アイテムを構築します。

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

カスタム 3D アイテムを削除します。

[invokable] void QCustom3DItem::setRotationAxisAndAngle(QVector3D axis, float angle)

axisangle から回転四元数を計算する便利な関数です。

注意: この関数はメタオブジェクトシステムやQMLから呼び出すことができます。Q_INVOKABLE を参照してください。

rotationも参照して ください。

void QCustom3DItem::setTextureImage(const QImage &textureImage)

アイテムのQImage としてtextureImage の値を設定します。テクスチャのデフォルトはグレー無地です。

Note: メモリを節約するため、テクスチャが作成されると、指定されたQImage はクリアされます。

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