QCustom3DItem Class

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

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

QCustom3DLabel そしてQCustom3DVolume

プロパティ

パブリック機能

QCustom3DItem(QObject *parent = nullptr)
QCustom3DItem(const QString &meshFile, const QVector3D &position, const QVector3D &scaling, const QQuaternion &rotation, const QImage &texture, QObject *parent = nullptr)
virtual ~QCustom3DItem()
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(const QVector3D &position)
void setPositionAbsolute(bool positionAbsolute)
void setRotation(const QQuaternion &rotation)
void setRotationAxisAndAngle(const QVector3D &axis, float angle)
void setScaling(const 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(const QVector3D &position)
void rotationChanged(const QQuaternion &rotation)
void scalingAbsoluteChanged(bool scalingAbsolute)
void scalingChanged(const QVector3D &scaling)
void shadowCastingChanged(bool shadowCasting)
void textureFileChanged(const QString &textureFile)
void visibleChanged(bool visible)

詳細説明

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

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

プロパティ ドキュメント

meshFile : QString

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

ファイル内のアイテムは、Wavefront OBJ フォーマットで、頂点、法線、UV を含む必要があります。また、三角形である必要があります。ファイルに法線または 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(const QVector3D &position)

通知シグナル:

void positionChanged(const 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(const QVector3D &scaling)

通知シグナル:

void scalingChanged(const QVector3D &scaling)

scalingAbsoluteも参照してください

[since QtDataVisualization 1.2] scalingAbsolute : bool

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

デフォルトはtrue です。

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

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

: カスタム項目のメッシュは、範囲[-1 ,1] に正規化されていなければなりません。

このプロパティは QtDataVisualization 1.2 で導入されました。

アクセス関数

bool isScalingAbsolute() const
void setScalingAbsolute(bool scalingAbsolute)

Notifier シグナル:

void scalingAbsoluteChanged(bool scalingAbsolute)

scaling およびpositionAbsoluteも参照してください

shadowCasting : bool

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

デフォルトはtrue である。false の場合、アイテムはQAbstract3DGraph::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, const QVector3D &position, const QVector3D &scaling, const QQuaternion &rotation, const QImage &texture, QObject *parent = nullptr)

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

[virtual noexcept] QCustom3DItem::~QCustom3DItem()

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

[invokable] void QCustom3DItem::setRotationAxisAndAngle(const 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.