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 |
| 継承元: | |
| ステータス: | 非推奨 |
このクラスは非推奨です。新しいコードでの使用は強く推奨しません。
プロパティ
|
|
パブリック関数
| 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 の範囲内の値が軸の範囲内となります。
注: positionAbsolute がfalse に設定されている場合、軸の範囲外に配置されたアイテムは レンダリングされません。ただし、そのアイテムが部分的に表示されるQCustom3DVolumeであり、かつscalingAbsolute もfalse に設定されている場合は例外です。その場合、ボリュームの表示される部分がレンダリングされます。
アクセス関数:
| QVector3D | position() const |
| void | setPosition(const QVector3D &position) |
Notifierシグナル:
| void | positionChanged(const QVector3D &position) |
positionAbsoluteも参照してください 。
positionAbsolute : bool
このプロパティは、アイテムの位置をデータ座標で扱うか、絶対座標で扱うかを指定します。
デフォルトはfalse です。絶対座標を持つアイテムは常にレンダリングされますが、データ座標を持つアイテムは、軸の範囲内にある場合にのみレンダリングされます。
アクセス関数:
| bool | isPositionAbsolute() const |
| void | setPositionAbsolute(bool positionAbsolute) |
通知シグナル:
| 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 です。
絶対スケーリングが適用された項目は、軸の範囲にかかわらず、常に同じサイズでレンダリングされます。 データスケーリングが設定されたアイテムは、軸の範囲に応じて見かけのサイズが変化します。positionAbsolute がtrue の場合、このプロパティは無視され、スケーリングは絶対値として解釈されます。アイテムに回転が設定されている場合、データスケーリングは回転前のアイテムに基づいて計算されます。同様に、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) |
通知シグナル:
| 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)
axis およびangle から回転クォータニオンを生成するための便利な関数です。
注:この関数は 、メタオブジェクトシステムを介して、およびQMLから呼び出すことができます。Q_INVOKABLE を参照してください。
rotationも参照してください 。
void QCustom3DItem::setTextureImage(const QImage &textureImage)
textureImage の値を、そのアイテムのQImage として設定します。テクスチャはデフォルトで一色の灰色になります。
注: メモリを節約するため 、指定されたQImage は、テクスチャの作成後にクリアされます。
© 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.