このページでは

QItemModelScatterDataProxy Class

Q3DScatter を使用して、アイテムモデル内のデータを表示するためのプロキシクラス。詳細...

ヘッダー: #include <QItemModelScatterDataProxy>
CMake: find_package(Qt6 REQUIRED COMPONENTS DataVisualization)
target_link_libraries(mytarget PRIVATE Qt6::DataVisualization)
qmake: QT += datavisualization
バージョン: QtDataVisualization 1.0
QML内での使用開始: ItemModelScatterDataProxy
継承元: QScatterDataProxy
ステータス: 非推奨

このクラスは非推奨です。新しいコードでの使用は強く推奨しません。

プロパティ

パブリック関数

QItemModelScatterDataProxy(QObject *parent = nullptr)
QItemModelScatterDataProxy(QAbstractItemModel *itemModel, QObject *parent = nullptr)
QItemModelScatterDataProxy(QAbstractItemModel *itemModel, const QString &xPosRole, const QString &yPosRole, const QString &zPosRole, QObject *parent = nullptr)
QItemModelScatterDataProxy(QAbstractItemModel *itemModel, const QString &xPosRole, const QString &yPosRole, const QString &zPosRole, const QString &rotationRole, QObject *parent = nullptr)
virtual ~QItemModelScatterDataProxy()
QAbstractItemModel *itemModel() const
void remap(const QString &xPosRole, const QString &yPosRole, const QString &zPosRole, const QString &rotationRole)
QString rotationRole() const
QRegularExpression rotationRolePattern() const
QString rotationRoleReplace() const
void setItemModel(QAbstractItemModel *itemModel)
void setRotationRole(const QString &role)
void setRotationRolePattern(const QRegularExpression &pattern)
void setRotationRoleReplace(const QString &replace)
void setXPosRole(const QString &role)
void setXPosRolePattern(const QRegularExpression &pattern)
void setXPosRoleReplace(const QString &replace)
void setYPosRole(const QString &role)
void setYPosRolePattern(const QRegularExpression &pattern)
void setYPosRoleReplace(const QString &replace)
void setZPosRole(const QString &role)
void setZPosRolePattern(const QRegularExpression &pattern)
void setZPosRoleReplace(const QString &replace)
QString xPosRole() const
QRegularExpression xPosRolePattern() const
QString xPosRoleReplace() const
QString yPosRole() const
QRegularExpression yPosRolePattern() const
QString yPosRoleReplace() const
QString zPosRole() const
QRegularExpression zPosRolePattern() const
QString zPosRoleReplace() const

シグナル

void itemModelChanged(const QAbstractItemModel *itemModel)
void rotationRoleChanged(const QString &role)
void rotationRolePatternChanged(const QRegularExpression &pattern)
void rotationRoleReplaceChanged(const QString &replace)
void xPosRoleChanged(const QString &role)
void xPosRolePatternChanged(const QRegularExpression &pattern)
void xPosRoleReplaceChanged(const QString &replace)
void yPosRoleChanged(const QString &role)
void yPosRolePatternChanged(const QRegularExpression &pattern)
void yPosRoleReplaceChanged(const QString &replace)
void zPosRoleChanged(const QString &role)
void zPosRolePatternChanged(const QRegularExpression &pattern)
void zPosRoleReplaceChanged(const QString &replace)

詳細な説明

QItemModelScatterDataProxy を使用すると、QAbstractItemModel から派生したモデルを、Q3DScatter のデータソースとして利用できます。これは、QAbstractItemModel のロールを、Q3DScatter ポイントの XYZ 値にマッピングします。

データの解決は、マッピングまたはモデルが変更されるたびに非同期で行われます。データが解決されると、QScatterDataProxy::arrayReset() が発行されます。ただし、モデルの初期化後の挿入、削除、および単一のデータ項目の変更は、同じフレーム内にモデル全体の解決を引き起こす変更が含まれていない限り、同期的に解決されます。

マッピングでは、QAbstractItemModel の行や列は無視され、すべての項目が同等に扱われます。これには、モデルが、散布点のX、Y、Z値にマッピング可能なデータ項目の役割を提供することが必要です。

たとえば、材料サンプルに対して行われたさまざまな測定値を格納するためのカスタムQAbstractItemModel があり、「密度」、「硬度」、「導電率」などのロールに対するデータを提供していると仮定します。このプロキシを使用すると、これらの特性を散布図で可視化できます。

// Map "density" value to X-axis, "hardness" to Y-axis and "conductivity" to Z-axis.
QItemModelScatterDataProxy *proxy = new QItemModelScatterDataProxy(customModel,
                                                                   QStringLiteral("density"),
                                                                   QStringLiteral("hardness"),
                                                                   QStringLiteral("conductivity"));

モデルのフィールドに、必要な形式と完全に一致するデータが含まれていない場合は、各ロールに対して検索パターンの正規表現と置換ルールを指定し、必要な形式の値を取得することができます。 正規表現を使用した置換の仕組みの詳細については、QString::replace(constQRegularExpression &rx, constQString &after) 関数のドキュメントを参照してください。なお、正規表現の使用はパフォーマンスに影響を与えるため、目的の値を取得するために検索や置換を必要としないアイテムモデルを利用するのがより効率的です。

たとえば、検索パターンをロールと組み合わせて使用する方法については、ItemModelBarDataProxy の「Simple Bar Graph」サンプルでの使用例を参照してください。

「Qt Data Visualization データ処理」も参照してください 。

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

itemModel : QAbstractItemModel*

このプロパティには、3D散布図シリーズのデータソースとして使用するアイテムモデルが格納されます。

アクセス関数:

QAbstractItemModel *itemModel() const
void setItemModel(QAbstractItemModel *itemModel)

通知シグナル:

void itemModelChanged(const QAbstractItemModel *itemModel)

rotationRole : QString

このプロパティは、アイテムのローテーションにマッピングするためのアイテムモデルの役割を担います。

このモデルは、回転の値として、QQuaternion に直接変換可能なバリアント、または"scalar,x,y,z" や"@angle,x,y,z" といった文字列表現のいずれかを指定できます。前者の場合、指定された値を用いてクォータニオンが直接生成され、後者の場合はQQuaternion::fromAxisAndAngle()メソッドを使用してクォータニオンが生成されます。

アクセス関数:

QString rotationRole() const
void setRotationRole(const QString &role)

通知シグナル:

void rotationRoleChanged(const QString &role)

rotationRolePattern : QRegularExpression

このプロパティは、回転ロールによってマッピングされた値が、アイテムの回転として使用される前に、検索と置換が行われるかどうかを指定します。

このプロパティは、置換対象となるマッピング済み値の部分を検索するための正規表現を指定し、rotationRoleReplace プロパティには置換文字列が含まれます。

アクセス関数:

QRegularExpression rotationRolePattern() const
void setRotationRolePattern(const QRegularExpression &pattern)

通知シグナル:

void rotationRolePatternChanged(const QRegularExpression &pattern)

関連項目: rotationRole およびrotationRoleReplace 。

rotationRoleReplace : QString

このプロパティには、回転ロールパターンと組み合わせて使用される置換内容が格納されます。

デフォルトは空の文字列です。正規表現を使用した検索と置換の仕組みの詳細については、QString::replace(constQRegularExpression &rx, constQString &after) 関数のドキュメントを参照してください。

アクセス関数:

QString rotationRoleReplace() const
void setRotationRoleReplace(const QString &replace)

Notifierシグナル:

void rotationRoleReplaceChanged(const QString &replace)

「 rotationRole 」および「rotationRolePattern 」も参照してください 。

xPosRole : QString

このプロパティは、X座標にマッピングするためのアイテムモデルの役割を持ちます。

アクセス関数:

QString xPosRole() const
void setXPosRole(const QString &role)

通知シグナル:

void xPosRoleChanged(const QString &role)

xPosRolePattern : QRegularExpression

このプロパティは、x位置ロールによってマッピングされた値が、アイテムの位置値として使用される前に、検索と置換が行われるかどうかを指定します。

このプロパティは、置換対象となるマッピング済み値の部分を検索するための正規表現を指定し、xPosRoleReplace プロパティには置換文字列が格納されます。

アクセス関数:

QRegularExpression xPosRolePattern() const
void setXPosRolePattern(const QRegularExpression &pattern)

通知シグナル:

void xPosRolePatternChanged(const QRegularExpression &pattern)

関連項目: xPosRole およびxPosRoleReplace 。

xPosRoleReplace : QString

このプロパティには、x 位置のロールパターンと組み合わせて使用される置換内容が格納されます。

デフォルトは空の文字列です。正規表現を使用した検索と置換の仕組みの詳細については、QString::replace(constQRegularExpression &rx, constQString &after) 関数のドキュメントを参照してください。

アクセス関数:

QString xPosRoleReplace() const
void setXPosRoleReplace(const QString &replace)

通知シグナル:

void xPosRoleReplaceChanged(const QString &replace)

「 xPosRole 」および「xPosRolePattern 」も参照してください 。

yPosRole : QString

このプロパティは、Y座標にマッピングするためのアイテムモデルの役割を担います。

アクセス関数:

QString yPosRole() const
void setYPosRole(const QString &role)

通知信号:

void yPosRoleChanged(const QString &role)

yPosRolePattern : QRegularExpression

このプロパティは、y 位置ロールによってマッピングされた値が、アイテムの位置値として使用される前に、検索と置換が行われるかどうかを指定します。

このプロパティは、マッピングされた値の中から置換対象となる部分を検索するための正規表現を指定し、yPosRoleReplace プロパティには置換文字列が格納されます。

アクセス関数:

QRegularExpression yPosRolePattern() const
void setYPosRolePattern(const QRegularExpression &pattern)

通知シグナル:

void yPosRolePatternChanged(const QRegularExpression &pattern)

関連項目: yPosRole およびyPosRoleReplace 。

yPosRoleReplace : QString

このプロパティには、y 位置のロールパターンと組み合わせて使用する置換内容が格納されます。

デフォルトは空の文字列です。正規表現を使用した検索と置換の仕組みの詳細については、QString::replace(constQRegularExpression &rx, constQString &after) 関数のドキュメントを参照してください。

アクセス関数:

QString yPosRoleReplace() const
void setYPosRoleReplace(const QString &replace)

通知シグナル:

void yPosRoleReplaceChanged(const QString &replace)

yPosRole およびyPosRolePatternも参照してください 。

zPosRole : QString

このプロパティは、Z位置にマッピングするためのアイテムモデルの役割を担います。

アクセス関数:

QString zPosRole() const
void setZPosRole(const QString &role)

通知シグナル:

void zPosRoleChanged(const QString &role)

zPosRolePattern : QRegularExpression

このプロパティは、z 位置ロールによってマッピングされた値が、アイテムの位置値として使用される前に、検索と置換が行われるかどうかを指定します。

このプロパティは、マッピングされた値の中から置換対象となる部分を見つけるための正規表現を指定し、zPosRoleReplace プロパティには置換文字列が格納されます。

アクセス関数:

QRegularExpression zPosRolePattern() const
void setZPosRolePattern(const QRegularExpression &pattern)

通知シグナル:

void zPosRolePatternChanged(const QRegularExpression &pattern)

関連項目: zPosRole およびzPosRoleReplace 。

zPosRoleReplace : QString

このプロパティには、z位置ロールパターンと組み合わせて使用する置換内容が格納されます。

デフォルトは空の文字列です。正規表現を使用した検索と置換の仕組みの詳細については、QString::replace(constQRegularExpression &rx, constQString &after) 関数のドキュメントを参照してください。

アクセス関数:

QString zPosRoleReplace() const
void setZPosRoleReplace(const QString &replace)

通知シグナル:

void zPosRoleReplaceChanged(const QString &replace)

「 zPosRole 」および「zPosRolePattern 」も参照してください 。

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

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

オプションのparent を指定して、QItemModelScatterDataProxyを生成します。

[explicit] QItemModelScatterDataProxy::QItemModelScatterDataProxy(QAbstractItemModel *itemModel, QObject *parent = nullptr)

itemModel およびオプションのparent を使用して、QItemModelScatterDataProxyを構築します。通常、アイテムモデルは他のコントロールによって所有されているため、このプロキシはitemModel の所有権を取得しません。

[explicit] QItemModelScatterDataProxy::QItemModelScatterDataProxy(QAbstractItemModel *itemModel, const QString &xPosRole, const QString &yPosRole, const QString &zPosRole, QObject *parent = nullptr)

itemModel およびオプションのparent を使用して、QItemModelScatterDataProxyを構築します。通常、アイテムモデルは他のコントロールによって所有されているため、このプロキシはitemModel の所有権を取得しません。xPosRole プロパティはxPosRole に、yPosRole プロパティはyPosRole に、zPosRole プロパティはzPosRole に設定されます。

[explicit] QItemModelScatterDataProxy::QItemModelScatterDataProxy(QAbstractItemModel *itemModel, const QString &xPosRole, const QString &yPosRole, const QString &zPosRole, const QString &rotationRole, QObject *parent = nullptr)

itemModel およびオプションのparent を使用して、QItemModelScatterDataProxyを構築します。通常、アイテムモデルは他のコントロールによって所有されているため、このプロキシはitemModel の所有権を取得しません。xPosRole プロパティはxPosRole に、yPosRole プロパティはyPosRole に、zPosRole プロパティはzPosRole に、rotationRole プロパティはrotationRole に設定されます。

[virtual noexcept] QItemModelScatterDataProxy::~QItemModelScatterDataProxy()

QItemModelScatterDataProxy を削除します。

void QItemModelScatterDataProxy::remap(const QString &xPosRole, const QString &yPosRole, const QString &zPosRole, const QString &rotationRole)

xPosRole 、yPosRole 、zPosRole 、およびrotationRole のマッピングを変更しました。

void QItemModelScatterDataProxy::setItemModel(QAbstractItemModel *itemModel)

itemModel を Q3DScatter のアイテムモデルとして設定します。モデルの所有権を取得するわけではありませんが、モデルに接続して変更を監視します。

注: プロパティ `itemModel`のセッター 関数です。

itemModel()も参照してください 。

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